Spaces:
Paused
Paused
| title: AutoGDataset Thai | |
| emoji: 📚 | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: gradio | |
| sdk_version: 5.44.1 | |
| app_file: app.py | |
| pinned: false | |
| hf_oauth: true | |
| # AutoGDataset Thai 🇹🇭 | |
| เครื่องมือสร้างชุดข้อมูล (Dataset) ภาษาไทยจากไฟล์ PDF โดยใช้ LangChain กับ Hugging Face Inference APIset Thai | |
| emoji: 📚 | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: gradio | |
| sdk_version: 5.44.1 | |
| app_file: app.py | |
| pinned: false | |
| hf_oauth: true | |
| ---AutoGDataset Thai | |
| emoji: �🇭 | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: gradio | |
| sdk_version: 5.44.1 | |
| app_file: app.py | |
| pinned: false | |
| hf_oauth: true | |
| --- | |
| # AutoGDataset Thai 🇹🇭 | |
| เครื่องมือสร้างชุดข้อมูล (Dataset) ภาษาไทยจากไฟล์ PDF โดยใช้ LangChain กับ Hugging Face Inference API | |
| ## คุณสมบัติเด่น ✨ | |
| - **รองรับงานหลากหลาย**: QA, RLHF, DPO, Constitutional AI, Chain of Thought, Dialogue และอื่นๆ | |
| - **เน้นภาษาไทย**: รองรับโมเดลภาษาไทยและ prompt ที่เหมาะสมกับบริบททางวัฒนธรรม | |
| - **โมเดลที่รองรับ**: OpenThaiGPT, Typhoon, WangchanBERTa และ multilingual models | |
| - **ปรับแต่งได้**: สามารถกำหนด prompt และพารามิเตอร์ต่างๆ ได้ | |
| ## โมเดลที่แนะนำ 🤖 | |
| ### โมเดลภาษาไทย | |
| - `openthaigpt/openthaigpt-1.0.0-alpha-7b-chat` | |
| - `scb10x/llama-3-typhoon-v1.5-8b-instruct` | |
| - `airesearch/wangchanberta-base-att-spm-uncased` | |
| ### โมเดล Multilingual | |
| - `google/mt5-large` | |
| - `microsoft/mdeberta-v3-base` | |
| - `facebook/xglm-7.5B` | |
| ## การใช้งาน 🚀 | |
| ### รันในเครื่อง | |
| ```bash | |
| pip install -r requirements.txt | |
| python app.py | |
| ``` | |
| ### บน Hugging Face Spaces | |
| 1. เพิ่ม secret `HF_TOKEN` หากจำเป็น | |
| 2. อัปโหลดไฟล์ PDF | |
| 3. เลือกประเภทงานและโมเดล | |
| 4. คลิกสร้างชุดข้อมูล | |
| ## ประเภทงานที่รองรับ 📋 | |
| ### งานพื้นฐาน | |
| - **QA**: คำถาม-คำตอบ `{question: str, answer: str}` | |
| - **Summarization**: การสรุป `{summary: str}` | |
| - **Keywords**: คำสำคัญ `{keyword: str}` | |
| - **NER**: การจดจำเอนทิตี `{text: str, label: str, start: int, end: int}` | |
| - **Classification**: การจำแนกประเภท `{labels: [str], rationale: str}` | |
| - **MCQ**: คำถามแบบเลือกตอบ `{question: str, options: [str], answer_index: int}` | |
| - **True/False**: จริง/เท็จ `{statement: str, answer: bool, explanation: str}` | |
| - **Translation**: การแปล `{source: str, target: str}` | |
| ### งานขั้นสูงสำหรับ AI Training | |
| - **RLHF**: `{prompt: str, responses: [str], scores: [float], preferred_response: str}` | |
| - **DPO**: `{prompt: str, chosen: str, rejected: str, reason: str}` | |
| - **Instruction_Following**: `{instruction: str, input: str, output: str, difficulty: str}` | |
| - **Constitutional_AI**: `{problematic_prompt: str, constitutional_response: str, principle: str}` | |
| - **Chain_of_Thought**: `{problem: str, thinking_steps: [str], final_answer: str}` | |
| - **Dialogue**: `{dialogue: [{role: str, content: str}], context: str}` | |
| - **Thai_Culture**: `{question_th: str, answer_th: str, cultural_context: str}` | |
| ## หมายเหตุสำคัญ 📝 | |
| - ใช้ HF Inference API ผ่าน LangChain ไม่ต้องติดตั้ง `transformers` ในเครื่อง | |
| - ไฟล์ผลลัพธ์จะถูกบันทึกใน `outputs/` ทั้งแบบ JSON และ JSONL | |
| - ต้องเข้าสู่ระบบ Hugging Face สำหรับ Spaces (ตั้งค่า `REQUIRE_LOGIN=0` เพื่อปิดการใช้งาน) | |
| - รองรับการปรับแต่ง prompt สำหรับผลลัพธ์ที่ดีขึ้น | |
| ## การติดตั้ง Dependencies 📦 | |
| ```bash | |
| pip install gradio pypdf huggingface_hub langchain langchain-community pythainlp transformers torch | |
| ``` | |
| สำหรับการประมวลผลภาษาไทยที่ดีขึ้น แนะนำให้ติดตั้ง: | |
| - `pythainlp`: สำหรับการประมวลผลภาษาไทย | |
| - `thai-word-segmentation`: สำหรับการตัดคำภาษาไทย | |