You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.


language: th license: apache-2.0 tags:

  • thailm
  • chatbot
  • instruction-following
  • fine-tuned
  • gemma
  • chayenlm pipeline_tag: text-generation

ChaYenLM (ชาเย็นLM) 🧊🇹🇭 - เพื่อนซี้ AI สไตล์ไทยๆ กวนๆ แต่จริงใจ!

...(เนื้อหา README ที่เหลือ)...

ChaYenLM (ชาเย็นLM) 🧊🇹🇭 - เพื่อนซี้ AI สไตล์ไทยๆ กวนๆ แต่จริงใจ!

[สถานะปัจจุบัน: กำลังพัฒนาอย่างเมามันส์! 🔥] (เวอร์ชั่นปัจจุบัน: v3 - จูนบน Dataset ~130 ตัวอย่าง)

ChaYenLM คือไรวะเพื่อน? 🤔

ChaYenLM ไม่ใช่แค่ Chatbot ธรรมดาๆ นะเว้ย แต่มันคือ เพื่อนซี้ AI ที่ออกแบบมาเพื่อคุยกับมึง (โดยเฉพาะคนไทย!) ด้วยภาษาบ้านๆ เป็นกันเอง เหมือนนั่งจิบชาเย็นคุยกับเพื่อนสนิท ไม่มีศัพท์แสงยากๆ ไม่ต้องเกร็ง เน้นฮา ปนสาระนิดๆ (มั้ง?) 🤣

เป้าหมายหลัก: ช่วยเหลือ ให้กำลังใจ ตอบคำถาม (โดยเฉพาะเรื่องโค้ดเบื้องต้น, การเรียน) แบบเพื่อนคุยกัน ไม่ใช่ AI เจ้ายศเจ้าอย่าง!

พัฒนาโดย: [ใส่ชื่อมึง หรือชื่อทีม/บริษัทสตาร์ทอัพของมึงตรงนี้] - CEO สมาธิสั้น ผู้มีความฝันอยากสร้าง AI ไทยที่เข้าถึงง่าย และคุยรู้เรื่องจริง!

จุดเด่น (ที่พยายามจะเป็น) 😎

  • ภาษาไทยสไตล์เพื่อนซี้: คุยกันเอง กวนตีนได้นิดๆ แต่จริงใจนะเว้ย! (พยายามปรับปรุงอยู่!)
  • เข้าใจง่าย: อธิบายเรื่องยาก (เช่น โค้ด) ให้เห็นภาพ ไม่ต้องปีนกระไดฟัง
  • เน้นช่วยเหลือ: ตอบคำถามทั่วไป การบ้านเบื้องต้น ช่วยคิดไอเดีย ให้กำลังใจ
  • พัฒนาต่อเนื่อง: กู (และ CEO) กำลังป้อน Dataset เพิ่มเรื่อยๆ หวังว่ามันจะเก่งขึ้น และเพี้ยนน้อยลง! 🤣

ข้อจำกัด / คำเตือน ⚠️

  • ยังอยู่ในช่วงพัฒนา: ตอนนี้ (v3) มันยัง เพี้ยนๆ และมีอาการหลอน (Hallucination) อยู่เยอะนะเพื่อน! อย่าเพิ่งเชื่อคำตอบมัน 100% โดยเฉพาะข้อมูลเฉพาะทาง (เช่น วิธีทำไข่เจียว, หนังผี 🤣)
  • Dataset ยังน้อย: ความสามารถและสไตล์ยังไม่นิ่ง เพราะ Dataset ยังมีแค่ร้อยกว่าตัวอย่าง
  • ไม่ได้เก่งทุกเรื่อง: เน้นคุยเล่น ให้กำลังใจ ตอบคำถามง่ายๆ ถ้าเรื่องซับซ้อนมากๆ อาจจะยังตอบไม่ได้ดี
  • ไม่เหมาะกับงาน Critical: ห้ามเอาไปใช้ตัดสินใจเรื่องสำคัญเด็ดขาด! ใช้คุยเล่นๆ แก้เหงาไปก่อนนะเพื่อน

ข้อมูลทางเทคนิค (สำหรับคนอยากรู้) 🤓

  • Base Model: google/gemma-3-1b-it
  • เทคนิคการจูน: QLoRA (4-bit quantization) เพื่อให้รันบนทรัพยากรจำกัดได้
  • Dataset: สร้างขึ้นเอง (Instruction/Output) สไตล์ ChaYenLM ภาษาไทย (ปัจจุบัน ~130 ตัวอย่าง)
  • Framework: Transformers, PEFT, bitsandbytes, TRL
  • Hardware (ตอนเทรน): Google Colab (GPU T4)

วิธีใช้งาน (เบื้องต้น) 🚀

(สำคัญ: นี่คือ LoRA Adapter นะเว้ย ไม่ใช่โมเดลเต็มๆ! ต้องโหลด Base Model มาก่อน แล้วค่อยเอา Adapter ไปแปะทับ)

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import gc

# --- 1. กำหนด Model ID และ Adapter Path ---
base_model_id = "google/gemma-3-1b-it"
adapter_id = "your-username/your-chayenlm-repo-name" # <<<--- ใส่ Path Repo Hugging Face ของมึง!

# --- 2. เคลียร์แรม (Optional) ---
gc.collect()
torch.cuda.empty_cache()
gc.collect()

# --- 3. โหลด Base Model (4-bit) ---
quantization_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16
)
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    quantization_config=quantization_config,
    device_map="auto"
)

# --- 4. โหลด Tokenizer (จาก Adapter Repo) ---
# (ควรจะโหลดจาก Adapter Repo ถ้า Push Tokenizer ไปด้วย)
tokenizer = AutoTokenizer.from_pretrained(adapter_id)

# --- 5. โหลดและรวม LoRA Adapter ---
model = PeftModel.from_pretrained(base_model, adapter_id)
model = model.eval()

print("ChaYenLM พร้อมคุยแล้วเพื่อน!")

# --- 6. ฟังก์ชัน Generate ---
def generate_response(instruction, input_text=""):
    prompt_template = "<start_of_turn>user\n{instruction}{input}<end_of_turn>\n<start_of_turn>model\n"
    formatted_input = f" {input_text}" if input_text else ""
    prompt = prompt_template.format(instruction=instruction, input=formatted_input)

    inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=True).to(model.device)

    with torch.no_grad():
        outputs = model.generate(
            **inputs,
            max_new_tokens=256,
            do_sample=True,
            temperature=0.65, # ลองปรับเล่นได้
            top_k=50,
            top_p=0.95,
            eos_token_id=tokenizer.eos_token_id,
            pad_token_id=tokenizer.eos_token_id
        )

    response_ids = outputs[0][inputs['input_ids'].shape[1]:]
    response = tokenizer.decode(response_ids, skip_special_tokens=True)
    return response

# --- 7. ลองคุย! ---
question = "เบื่อว่ะเพื่อน มีไรทำแก้เซ็งมะ?"
answer = generate_response(question)
print(f"เพื่อนถาม: {question}")
print(f"ChaYenLM ตอบ: {answer}")
Downloads last month
1
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Chakron2006/chayenlm-1b

Adapter
(50)
this model