Only this pageAll pages
Powered by GitBook
1 of 39

OpenThaiGPT

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Web Demo!

Demo: https://demo72b.aieat.or.th/ Hosted by Siam.AI Cloud

องค์กรที่ร่วมสนับสนุน (Sponsors)

Latest update: 7 April 2024

กลุ่ม OpenThaiGPT

OpenThaiGPT ก่อตั้งโดยการร่วมมือกันของสองสมาคมปัญญาประดิษฐ์ประเทศไทย ประกอบไปด้วย

สมาคมผู้ประกอบการปัญญาประดิษฐ์ประเทศไทย (AIEAT)
สมาคมปัญญาประดิษฐ์ประเทศไทย (AIAT)
  • สมาคมผู้ประกอบการปัญญาประดิษฐ์ประเทศไทย (AIEAT)

  • สมาคมปัญญาประดิษฐ์ประเทศไทย (AIAT)

และทีมงานจากองค์กรดังต่อไปนี้

  • ศูนย์เทคโนโลยีอิเล็กทรอนิกส์และคอมพิวเตอร์แห่งชาติ (เนคเทค)

  • มหาวิทยาลัยมหิดล

  • Microsoft Thailand

  • บริษัท ไอแอพพ์เทคโนโลยี จำกัด

Colab Demo!

Updated: 12/8/24

OpenThaiGPT version 1.0.0 or later

ตั้งแต่เวอร์ชัน 1.0.0 เป็นต้นไป สามารถใช้ colab นี้ในการ Load model, Finetune, Inference ได้

https://colab.research.google.com/drive/1w1giDWhmq3WIUCK4AISFJtGIqiPDtRSC?usp=sharing

OpenThaiGPT 13b 1.0.0-beta (with 4 bits)

Running on GPU T4 in Google Colab:

OpenThaiGPT 7b 1.0.0-beta

Running on GPU T4 in Google Colab:

Version 1.0.0-alpha

Running on GPU T4 in Google Colab:

Version 0.1.0-beta

Running on GPU T4 in Google Colab:

Version 0.1.0-alpha

Running on GPU A100 in Google Colab:

Version 0.0.4

Running on GPU T4 in Google Colab:

Botnoi Consulting Co., Ltd.

  • SABLE Co., Ltd.

  • Ananda development

  • โรงเรียนวิทยาศาสตร์จุฬาภรณราชวิทยาลัย ชลบุรี

  • บจ. เคเคส

  • บริษัท แสตนด์อัพโค้ด จำกัด

  • Agoda

  • Metapeace Interface

  • Systech

  • TMS Tech

  • บริษัท จันวาณิชย์ จำกัด

  • Pretraining LLM

    Previous Versions and Resources

    Pre-training Volunteer Event (11 March 19:00-20:15)

    สตาฟนิวจากทีม Pre-training นะครับ

    ขอเรียนเชิญอาสาสมัครทุกท่านมาเข้าร่วมกิจกรรม First Meet ทีม Pretraining วันเสาร์ที่ 11 มีนาคม 2566

    เวลา 19:00-20:15 ครับ Agenda ของกิจกรรม First Meet ครับ:

    - 19:00-19:15 Dr. Prachya Boonkwan กล่าวต้อนรับและแนะนำทีม Pretraining - 19:15-19:45 แนะนำ 6 Working Groups ย่อยในทีม Pretraining และหน้าที่ของแต่ล่ะ Group - 19:45-20:00 QA - 20:00-20:15 เปิดให้ลงชื่อสมัครเข้า Working Groups ต่างๆ ลิงค์ซูมสำหรับ PPLM - First meet up ครับผม วันที่ 11 มีนาคม 2566 เวลา 19.00 น. Join Zoom Meeting https://zoom.us/j/96353648642?pwd=emNQOXdTZlZpSGoxbXdBb3FlYnMrUT09 Meeting ID: 963 5364 8642 Passcode: 594712

    Previous Events

    Computing Resources

    ยินดีต้อนรับสู่ OpenThaiGPT 1.6 และ OpenThaiGPT R1

    โมเดลภาษาขนาดใหญ่ Free และ Opensource เพื่อคนไทยทุกคน

    🇹🇭 OpenThaiGPT 1.6 72b โมเดลภาษาขนาดใหญ่รุ่นล่าสุด ได้รับการปรับปรุงจากรุ่น 1.5 และ 🧠 OpenThaiGPT R1 32b โมเดลด้านการคิดวิเคราะห์และให้เหตุผล และพร้อมให้บริการแล้ว โมเดลนี้ได้รับการพัฒนาเพื่อการใช้งานทั่วไปและมีความสามารถด้านการคิดเชิงเหตุผลที่แข็งแกร่ง โดยเฉพาะอย่างยิ่งในภาษาไทย

    ทดลองใช้งาน

    ทดลองใช้งานผ่าน ChindaX:

    Free Working Datasets

    For OpenThaiGPT

    Pretraining

    Finetuning

    ร่วมกับเรา (Join Us)

    เข้าร่วม Discord และลงทะเบียนอาสาสมัครข้างล่าง เพื่อเริ่มช่วยการพัฒนา

    เข้าร่วม Discord (Discord Channel)

    Related Paper / Knowledge

    InstructGPT Finetuning

    Code ที่ใช้ Finetune OpenThaiGPT version 0.1.0-beta

    Colabs ที่ใช้ Finetune OpenThaiGPT version 0.0.1

    Released Code / Colabs

    License

    Model: APACHE LICENSE, VERSION 2.0

    Dataset: CC BY-SA

    ChatGPT สร้างขึ้นมาได้อย่างไร (How to build ChatGPT?)

    https://colab.research.google.com/drive/1MA1FHwknrs6mVstOHcSyFTnDNWrus-G-?usp=sharing

    https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta
    Pretraining LLM
    InstructGPT Finetuning
    Reinforcement Learning with Human Feedback (RLHF)
    https://creativecommons.org/licenses/by-sa/3.0/th/
    https://www.apache.org/licenses/LICENSE-2.0

    Safety Net Volunteer Event (12 March 19:00-19:45)

    ขออนุญาตประชาสัมพันธ์นะครับ สวัสดีครับ ผมโอ๊ตจากทีม SafetyNet นะครับ

    ขอรบกวนชวนเชิญอาสาสมัครท่านที่สนใจ SafetyNet เข้าร่วมงาน First Meet ของทีม SafetyNet ใน วันอาทิตย์ที่ 12 มีนาคม 2566 เวลา 19:00-19:45 ครับ

    โดยเป้าหมายหลักของกิจกรรมในครั้งนี้เพื่อ จัดกลุ่มอาสาสมัครทุกท่านเป็นทีมย่อยๆ และหาตัวแทนของแต่ละกลุ่มย่อย ที่จะมาช่วยกันพัฒนา SafetyNet ครับ

    Agenda ของกิจกรรม First Meet ครับ:

    - 19:00-19:10 แนะนำ SatetyNet และอธิบายถึงความสำคัญ รวมถึงแผนการปัจจุบัน - 19:10-19:25 อธิบายถึงกลุ่มย่อย และหน้าที่ - 19:25-19:30 QA - 19:30-19:45 อาสาสมัครลงชื่อเข้ากลุ่มที่ต้องการ ลิงค์ซูมสำหรับ First meet up ครับผม วันที่ 12 มีนาคม 2566 เวลา 19.00 น. Join Google Meet link: https://meet.google.com/nhj-mrin-jvx

    ดาวน์โหลดโมเดล

    OpenThaiGPT 1.6 72b: https://huggingface.co/openthaigpt/openthaigpt-1.6-72b-instruct OpenTHaiGPT R1 32b: https://huggingface.co/openthaigpt/openthaigpt-r1-32b-instruct

    🌟 OpenThaiGPT 1.6 72b

    OpenThaiGPT 1.6 72b เป็นโมเดลภาษาไทยขนาด 72 พันล้านพารามิเตอร์ ที่ออกแบบมาสำหรับงานทั่วไปพร้อมความสามารถในการคิดวิเคราะห์ที่แข็งแกร่ง ต่อยอดจากพื้นฐานของ OpenThaiGPT 1.5 รุ่นล่าสุดนี้แสดงให้เห็นถึงประสิทธิภาพที่ดีขึ้นในการทดสอบหลากหลายรูปแบบ โดยเฉพาะอย่างยิ่งในด้านการเขียนโค้ดและงานด้านภาษาทั่วไป

    จุดเด่น

    • โมเดลภาษาไทยขั้นสูง ด้วยพารามิเตอร์ 72 พันล้าน

    • ความสามารถในการคิดวิเคราะห์ที่แข็งแกร่ง ทั้งในภาษาไทยและภาษาอังกฤษ

    • ประสิทธิภาพที่ดีขึ้น เมื่อเทียบกับรุ่น OpenThaiGPT ก่อนหน้านี้

    • ความสามารถที่สมดุล ทั้งด้านคณิตศาสตร์ การเขียนโค้ด และงานด้านภาษาทั่วไป

    • ความเข้าใจที่ลึกซึ้ง ในภาษาไทยและบริบททางวัฒนธรรม

    การปรับปรุงหลักใน OpenThaiGPT 1.6 72b

    เมื่อเทียบกับ OpenThaiGPT 1.5 72b รุ่น 1.6 แสดงให้เห็น:

    • ประสิทธิภาพด้านการเขียนโค้ดที่ดีขึ้นอย่างมาก ทั้งในภาษาไทย (LiveCodeBench-TH: 32.43 เทียบกับ 12.61) และภาษาอังกฤษ (LiveCodeBench: 54.21 เทียบกับ 46.38)

    • ความเข้าใจภาษาทั่วไปที่เทียบเคียงกัน ด้วยความแม่นยำด้านภาษาสูงถึง 98.2%

    • ความสามารถที่สมดุลดีขึ้น ระหว่างงานด้านคณิตศาสตร์และการเขียนโค้ด

    🧠 OpenThaiGPT R1 32b

    OpenThaiGPT R1 32b เป็นโมเดลภาษาไทยขั้นสูงขนาด 32 พันล้านพารามิเตอร์ที่เน้นด้านการคิดวิเคราะห์และให้เหตุผล ซึ่งมีประสิทธิภาพสูงกว่าโมเดลขนาดใหญ่อย่าง DeepSeek R1 70b และ Typhoon R1 70b แม้จะมีขนาดเล็กกว่าครึ่งหนึ่ง โมเดลนี้เชี่ยวชาญในงานที่ต้องใช้การคิดวิเคราะห์ซับซ้อน รวมถึงคณิตศาสตร์ ตรรกะ และการเขียนโค้ดในภาษาไทย

    จุดเด่น

    • โมเดลภาษาไทยที่ทันสมัยที่สุด มีประสิทธิภาพสูงกว่าโมเดลขนาดใหญ่ในการทดสอบด้านคณิตศาสตร์และการให้เหตุผลเชิงตรรกะ

    • ความสามารถในการให้เหตุผลอย่างชัดเจน สามารถแสดงกระบวนการคิดเป็นขั้นตอนได้

    • ขนาดเล็กกว่าอย่างมีนัยสำคัญ (32b) แต่มีประสิทธิภาพสูงกว่าโมเดลขนาด 70b

    • เชี่ยวชาญด้านการคิดวิเคราะห์ในภาษาไทย รวมถึงปัญหาคณิตศาสตร์และตรรกะที่ซับซ้อน

    • ประสิทธิภาพสูงในการเขียนโค้ด ทั้งในภาษาไทยและภาษาอังกฤษ

    ผลการทดสอบเปรียบเทียบ

    OpenThaiGPT 1.6 72b

    Benchmarks

    OpenThaiGPT 1.6 72b

    OpenThaiGPT 1.5 7b

    OpenThaiGPT 1.5 14b

    OpenThaiGPT 1.5 72b

    Typhoon2 Qwen2.5 7b

    Typhoon2 Llama3.1 8b

    Typhoon2 Llama3.1 70b

    NECTEC Pathumma LLM Text 1.0.0 7b

    AIME24-TH

    6.67

    0

    0

    6.67

    3.33

    3.33

    OpenThaiGPT R1 32b

    SkyThought

    OpenThaiGPT R1 32b

    DeepSeek R1 70b

    Typhoon R1 70b

    AIME24-TH

    56.67

    33.33

    53.33

    AIME24

    63.36

    53.33

    53.33

    MATH500-TH

    83.8

    75.4

    81

    Model Technical Report

    https://arxiv.org/abs/2504.01789

    If OpenThaiGPT has been beneficial for your work, kindly consider citing it as follows:

    วิธีการใช้งาน

    Online Web Interface

    https://chindax.iapp.co.th

    Transformers

    vLLM

    1. Install VLLM (https://github.com/vllm-project/vllm)

    2. Run server (เลือกอันใดอันหนึ่ง)

    • Note, change --tensor-parallel-size 2 to the amount of available GPU cards.

    1. Run inference (CURL example)

    หรือเปลี่ยนชื่อโมเดลเป็น "model": "openthaigpt/openthaigpt-r1-32b-instruct" หรือ "model": "openthaigpt/openthaigpt-1.6-72b".

    ความต้องการด้านหน่วยความจำ GPU

    จำนวนพารามิเตอร์

    FP 16 bits

    8 bits (Quantized)

    4 bits (Quantized)

    32b

    64 GB

    32 GB

    16 GB

    72b

    144 GB

    72 GB

    36 GB

    ใบอนุญาต

    • โมเดลนี้มีให้ใช้สำหรับ การวิจัย และ การใช้งานเชิงพาณิชย์ ภายใต้เงื่อนไขสัญญาอนุญาติ Qwen2.5 โปรดดูไฟล์ LICENSE สำหรับข้อมูลเพิ่มเติม

    การสนับสนุน

    • เว็บไซต์อย่างเป็นทางการ: https://openthaigpt.aieat.or.th

    • เพจ Facebook: https://web.facebook.com/groups/openthaigpt

    • เซิร์ฟเวอร์ Discord สำหรับการสนทนาและสนับสนุน ที่นี่

    • อีเมล: [email protected]

    ทีม OpenThaiGPT

    • ดร. กอบกฤตย์ วิริยะยุทธกร ([email protected] / [email protected])

    • ดร. สุเมธ ยืนยง ([email protected])

    • ดร. ทศพร ฉายอินทร์ ([email protected])

    ผู้สนับสนุน

    • ได้รับการสนับสนุน GPU Nvidia H100 x 8 ใบ จากบริษัท สยาม เอไอ คอร์เปอเรชั่น จำกัด: https://siam.ai/

    • ได้รับทุนวิจัยสนับสนุนจากกองทุนส่งเสริมวิทยาศาสตร์ วิจัยและนวัตกรรม โดยหน่วยบริหารและจัดการทุนด้านการเพิ่มความสามารถในการแข่งขันของประเทศ (บพข.) ร่วมกับ บริษัท ไอแอพพ์เทคโนโลยี จำกัด ซึ่งมี สมาคมผู้ประกอบการปัญญาประดิษฐ์ประเทศไทย เป็นผู้ดำเนินงานโครงการ

    Disclaimer: Provided responses are not guaranteed.

    https://chindax.iapp.co.th
    OpenThaiGPT
    Unhealthy Comments Corpus
    ติดต่อเรา Contact Us

    Dr. Kobkrit Viriyayudhakorn President - AIEAT [email protected]

    แผนการดำเนินงาน Roadmap

    OpenThaiGPT Roadmap

    Q1 2023

    Q2 2023

    ...

    การช่วยกันสร้าง Dataset สนทนา Chat ภาษาไทย!

    เว็บไซด์ที่ร่วมกันสร้าง Dataset สนทนา Chat ภาษาไทย

    https://tag.openthaigpt.aieat.or.th/

    เพื่อให้ทีมงาน OpenThaiGPT ได้รับ Dataset สำหรับในการพัฒนา Thai InstructGPT และ Reward Model (RM) ให้ได้เร็วที่สุด ทางทีมงานเลยพัฒนาเว็บไซด์ที่ใช้ร่วมกันสร้าง Dataset นี้โดยทำการ Fork มาจาก Website https://github.com/LAION-AI/Open-Assistant ที่เปิด Opensource ภายใตัอนุสัญญา Apache 2.0

    Q/A

    Q: ทำไมถึงเลือก Fork จากเว็บไซด์ของ Open Assistant และทำการ Host เอง ทำไมเราถึงไม่พัฒนาเอง หรือไม่ไปใช้ของ Open Assistant โดยตรงเลย? A: มีข้อดีหลายอย่างที่เลือกในการ Fork จากเว็บไซด์ Open Assistant

    (1) ไม่เสียเวลาในการพัฒนาเอง (2) ได้รับ Update แก้ไข Bug จากทาง Open Assistant อยู่เสมอ (3) ผู้พัฒนา OpenThaiGPT ได้รับ Dataset ดิบทันที เมื่อมีคนมาสร้าง Dataset บนเว็บไซด์ ไม่ต้องรอให้ทาง Open Assistant ปล่อยข้อมูล (4) สามารถนำ Dataset จาก OpenThaiGPT ส่งต่อให้ทาง Open Assistant ได้โดยง่าย เนื่องจากสร้างมาจากระบบเดียวกัน (5) ได้ Pipeline และ Guideline ในการจัดทำ Dataset ที่เป็นมาตรฐานระดับโลก (6) เนื่องจากว่าเรา Focus ภาษาไทยภาษาเดียว ทำให้เราสามารถปล่อย Dataset ได้ถี่ขึ้น (ทุกวันอาทิตย์ของสัปดาห์) (7) สามารถขยายต่อยอดในงาน Tag ข้อมูลอื่นๆ ที่ทาง OpenThaiGPT อาจจะต้องใช้ในอนาคต หรือสามารถแก้ไขปรับปรุงระบบให้สนับสนุนภาษาในภูมิภาค South-east Asia อื่นๆ อาทิเช่น CLMV ได้ไวกว่า

    ----

    Q: เว็บไซด์สร้าง Dataset ของ OpenThaiGPT เปิด Source code หรือไม่ A: เราเปิด Source code เว็บไซด์สร้าง Dataset ของ OpenThaiGPT ภายใตัอนุสัญญา Apache 2.0 ที่

    Reinforcement Learning with Human Feedback (RLHF)

    TRL

    RLHF on GPT-2

    สอนให้ Model Generate ข้อความเชิงบวก (Positive Sentiment) ได้มากขึ้นด้วย PPO https://colab.research.google.com/drive/1qce78Q00SY7CKXLVtiSGFbP5C1V_nypn?usp=sharing

    สอนให้ Model Generate ข้อความในเชิงบวก กลางๆ หรือเชิงลบ (Controlled Sentiment) โดยการกำหนด Prefix ใน Input

    Finetuning / RLHF Volunteer Event (18 March)

    ขออนุญาตประชาสัมพันธ์นะครับ สวัสดีครับ ผม ดร. สุเมธ นะครับ

    ขอชวนเชิญอาสาสมัครท่านที่สนใจ Finetuning / RLHF Volunteer เข้าร่วมงาน First Meet ของทีม Finetuning / RLHF Volunteer ใน วันเสาร์ที่ 18 มีนาคม 2566 เวลา 13:00-14:00 ครับ

    โดยเป้าหมายหลักของกิจกรรมในครั้งนี้เพื่อ จัดกลุ่มอาสาสมัครทุกท่านเป็นทีมย่อยๆ และหาตัวแทนของแต่ละกลุ่มย่อย ที่จะมาช่วยกันพัฒนา Finetuning / RLHF Volunteer ครับ

    Agenda ของกิจกรรม First Meet ครับ:

    - 13:00-13:30 แนะนำ Finetuning / RLHF และอธิบายถึงความสำคัญ รวมถึงแผนการปัจจุบัน - 13:30-13:40 อธิบายถึงกลุ่มย่อย และหน้าที่ - 13:40-13:50 Q&A - 13:50-14:00 อาสาสมัครลงชื่อเข้ากลุ่มที่ต้องการ Join Zoom Meeting https://us06web.zoom.us/j/89540845246?pwd=dzVmSzFJVWpwVFkwMjZ0VVAyalBPUT09 Meeting ID: 895 4084 5246 Passcode: 005687

    ---

    Core-team Volunteer Meeting 19 March 15:30

    สวัสดีครับ ทุกท่าน ผม ดร.ซี นะครับ วันพรุ่งนี้ (วันอาทิตย์ที่ 19 มีนาคม 2566) จะมีประชุม Core Team ของทีม OpenThaiGPT ตั้งแต่ 15:30 น - 17:30 น ขอเรียนเชิญหัวหน้าทีมทุกท่านและทีมประสานงานทั้งหมดเข้าร่วมประชุมนะครับ หรือ Volunteer ท่านอื่นๆ ที่สนใจอยากจะออกความคิดเห็นก็เรียนเชิญนะครับ

    หัวข้อการประชุม

    • ประชุมกำหนดหน้าที่ Core Team

    • กำหนดเป้าหมายร่วมกันให้ชัดเจนสำหรับ OpenThaiGPT 1.0.0

    กฎกติกาความร่วมมือ (Rules)

    เพื่อสร้างสิ่งแวดล้อมที่เหมาะสม และเปิดให้ทุกภาคส่วน สามารถเข้ามาช่วยกันพัฒนา OpenThaiGPT ได้อย่างมีประสิทธิภาพ ร่วมถึงกำหนดเป้าหมาย Goal ร่วมกันได้อย่างมีประสิทธิภาพ โดยมีกฎกติการ่วมกัน 3 ข้อดังต่อไปนี้

    1. ผลงานที่เกิดจากโครงการทั้งหมดต้องอยู่ภายใต้ลิขสิทธิ์ดังต่อไปนี้

      1. Source Code / Weight / Model = Apache 2.0

    @misc{yuenyong2025openthaigpt16r1thaicentric,
          title={OpenThaiGPT 1.6 and R1: Thai-Centric Open Source and Reasoning Large Language Models}, 
          author={Sumeth Yuenyong and Thodsaporn Chay-intr and Kobkrit Viriyayudhakorn},
          year={2025},
          eprint={2504.01789},
          archivePrefix={arXiv},
          primaryClass={cs.CL},
          url={https://arxiv.org/abs/2504.01789}, 
    }
    from transformers import AutoModelForCausalLM, AutoTokenizer
    
    model_name = "openthaigpt/openthaigpt-1.6-72b" #openthaigpt/openthaigpt-r1-32b-instruct
    
    model = AutoModelForCausalLM.from_pretrained(
        model_name,
        torch_dtype="auto",
        device_map="auto"
    )
    tokenizer = AutoTokenizer.from_pretrained(model_name)
    
    prompt = "กรุงเทพมหานครคืออะไร"
    messages = [
        {"role": "user", "content": prompt}
    ]
    text = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True
    )
    model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
    
    generated_ids = model.generate(
        **model_inputs,
        max_new_tokens=8192,
        temperature=0.6
    )
    generated_ids = [
        output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
    ]
    
    response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
    vllm serve openthaigpt/openthaigpt-1.6-72b --tensor-parallel-size 2
    vllm serve openthaigpt/openthaigpt-r1-32b-instruct --tensor-parallel-size 2
    curl -X POST 'http://127.0.0.1:8000/v1/chat/completions' \
    -H 'Content-Type: application/json' \
    -d '{
      "model": "openthaigpt/openthaigpt-1.6-72b",
      "messages": [
        {
          "role": "user",
          "content": "กรุงเทพมหานครคืออะไร"
        }
      ],
      "max_tokens": 4096,
      "temperature": 0.6,
      "top_p": 0.95,
      "top_k": 40
    }'
    Dataset = CC BY-SA
  • การเข้าถึงทรัพยากร (Open Resource) เป็นไปตามข้อมูลหน้า Open Resourcesโดยจะมีทรัพยากรบางส่วนที่เข้าถึงได้เฉพาะกลุ่มอาสาสมัครเท่านั้น ซึ่งกระบวนการมีดังต่อไปนี้

    1. ลงทะเบียนเป็นหนึ่งในสมาชิกทีมอาสาสมัคร

    2. เริ่มต้น Contribute ให้โครงการโดยวิธีการใดๆก็ได้ ตามหัวหน้าทีมอาสาสมัครนั้นๆกำหนด อาทิเช่น

      1. ทีม Data Label Website:

        1. ช่วยในการพัฒนาเว็บไซด์ Tag ข้อมูล อย่างน้อย 1 commit

      2. ทีม InstructDatset:

        1. ช่วย Tag InstructDataset อย่างน้อย 10 คู่สนทนา

      3. ทีม RLHF

        1. ช่วยเรียงลำดับผลการ Generate ของ Model เพื่อสร้าง Reward Model อย่างน้อย 10 คู่สนทนา

      4. ทีม Pretraining

        1. ช่วยทำความสะอาดข้อมูล Pretraining อย่างน้อย 10 บทความ

        2. ร่วมทำการทดลองหาโครงสร้าง LM ที่เหมาะสม อย่างน้อย 1 รูปแบบ

      5. ทีมพัฒนา OpenThaiGPT Library

        1. ช่วยพัฒนา PIP OpenThaiGPT Library อย่างน้อย 1 commit

      6. อื่นๆ ตามความเหมาะสม

    3. หัวหน้าทีมอาสาสมัครแจ้งรายชื่อให้กับทีมประสานงาน เพื่ออัพเดทรายชื่อขึ้นเว็บไซด์และเปิดให้เข้าถึงข้อมูลต่อไป

  • หากนำชื่อโครงการ OpenThaiGPT ไปใช้เพื่อทำการขอทุนหรือทางผลประโยชน์ใดๆ ต้องได้รับจดหมายรับรองจากทีมประสานงาน OpenThaiGPT ออกโดยสมาคมผู้ประกอบการปัญญาประดิษฐ์ประเทศไทย (AIEAT) และ สมาคมปัญญาประดิษฐ์ประเทศไทย (AIAT) ร่วมกันเท่านั้น

  • https://colab.research.google.com/drive/19CWnz8xhuV026nBuDEEUEMflTK9ENMIj?usp=sharing
  • สถาปัตยกรรมอะไร

  • Max_Length?

  • เป็น Multi-modal ไหม?

  • เป้าหมาย Capability

    • แปลไทย / Eng ได้ไหม

    • ย่อความได้ไหม

    • ทำ Few-shot Learning ได้ไหม

    • Math?

    • ทำความสามารถระดับ Syllable อาทิเช่น (คำผวน) ได้ไหม?

    • ต้องฉลาดพอที่จะทำข้อสอบ Entrace วิชาต่างๆได้ประมาณ 80% ไหม

  • การวัดผล

  • การเชื่อมต่อกับองค์ความรู้ข้างนอก?

  • คุณสมบัติอื่นๆ ให้ที่เป็รประโยชน์ต่อเศรษฐกิจไทยในอนาคต

  • กำหนดแผนการดำเนินงานที่ชัดเจนของแต่ละทีม (Project Schedule)

  • Q/A

  • กำหนดการประชุม Core Team ครั้งถัดไป

  • Join Zoom Meeting

    https://us06web.zoom.us/j/87017427335?pwd=bVBON0tFMU9WdFZLRWZCWXREYnI4dz09

    Meeting ID: 870 1742 7335 Passcode: 260098

    ขอบพระคุณทุกท่านมากครับ

    ---

    13.33

    0

    AIME24

    23.33

    6.67

    10

    23.33

    6.67

    3.33

    10

    0

    MATH500-TH

    43.2

    24.2

    26.2

    62

    51.8

    31

    55.8

    21.8

    MATH500

    82

    40.4

    47.4

    83.2

    65.4

    49.6

    67.4

    42.8

    LiveCodeBench-TH

    32.43

    22.52

    21.62

    12.61

    9.91

    8.11

    27.03

    0

    LiveCodeBench

    54.21

    31.12

    37.96

    46.38

    0.98

    5.87

    37.38

    0

    OpenThaiEval

    78.7

    64.5

    71.26

    77.16

    64.76

    56.63

    72.54

    65.27

    Language Accuracy

    98.2

    97.6

    98.4

    99.4

    99.4

    98.6

    99.8

    98.6

    AVERAGE

    52.34

    35.88

    39.11

    51.34

    37.78

    32.06

    47.91

    28.56

    MATH500

    89.4

    88.88

    90.2

    LiveCodeBench-TH

    62.16

    53.15

    47.75

    LiveCodeBench

    69.67

    64.97

    54.79

    OpenThaiEval

    76.05

    74.17

    77.59

    AVERAGE

    71.58

    63.31

    65.42

    https://github.com/OpenThaiGPT/Open-Assistant

    First Meet Up (25 Feb 2023)!

    Youtube Video

    Video Youtube ของงาน Event OpenThaiGPT: The First Meetup ครับผม

    Registration (ลงทะเบียน)

    ปิดการลงทะเบียนแล้ว ขอบพระคุณที่สนใจทุกท่านครับ เต็มแน่นจริงๆ มีน้ำ ชา กาแฟ และ ขนมเบรก (By iApp) มีปลั๊กไฟและอินเตอร์เน็ตให้ ไม่มีค่าใช้จ่าย (ฟรี) จอดรถได้ 4 ชม. ฟรี ถ่ายทอดสดผ่านช่องทาง Zoom URL: ---

    Agenda

    Time
    Agenda

    ---

    Avenue

    วันเสาร์ที่ 25 กุมภาพันธ์ 2023 เวลา 13:00น - 17:00น มาคุยกันครับ The Street Ratchada W50 Workwize ชั้น 3 The Street รัชดา 139 รัชดาภิเษก ถนนดินแดง กรุงเทพมหานคร 10400 เบอร์โทร 086-322-5858 เดินจากสถานีรถไฟใต้ดิน MRT ศูนย์วัฒนธรรม ประมาณ 550m

    Volunteer Meetup #1 (Zoom) 5 March 13:00

    เว็บลงทะเบียนทีมอาสาสมัครครับ

    https://docs.google.com/spreadsheets/d/1r2jDImNEBxhds_X0Xs0mZVOr26mWYvDgRwCnv-g-RJc/edit#gid=0

    สไลด์ของ ดร.ซี ครับ

    สไลด์ของ ดร.ปรัชญา ครับ

    Agenda

    Time
    Agenda

    OpenThaiGPT Meet Up #2

    งานเสวนา ความท้าทาย ความเป็นไปได้ และโอกาสของ ChatGPT สัญชาติไทย

    สถานที่/วันเวลา

    วันจันทร์ที่ 24 เมษายน เวลา 13:00น - 15:30น สถานที่ ห้องแถลงข่าว (ชั้น 1) กระทรวง อว. 70 ที่นั่ง https://goo.gl/maps/EJsndV6thHfdA8gC8

    กำหนดการ <ร่าง>

    เวลา
    กิจกรรม

    การเดินทาง

    Released OpenThaiGPT 13b <1.0.0-beta> (20/12/23)

    🇹🇭 OpenThaiGPT 13b 1.0.0-beta (20 December 2023)

    🇹🇭 OpenThaiGPT 13b Version 1.0.0-beta is a Thai language 13b-parameter LLaMA v2 Chat model further pretrained on Thai cleaned 15 billion tokens textual dataset, finetuned to follow Thai translated instructions and extend more than 10,000 most popular Thai words vocabularies into LLM's dictionary for turbo speed,

    Change Logs

    🇹🇭 OpenThaiGPT 13b Version 1.0.0-beta (Llama v2 + 15 billion Thai tokens pretrain + 10,000 Thai word extension)

    Release date: 20 December 2023

    License

    Source Code: License Apache Software License 2.0. Weight: Research and Commercial uses.

    Code and Weight

    Colab demo: Finetune Code: Inference Code: Weights: (16 bits, Huggingface format) (16 bits and 4 bits, GGUF format)

    Sponsors

    Authors

    • Kobkrit Viriyayudhakorn ([email protected])

    • Sumeth Yuenyong ([email protected])

    • Prachya Boonkwan ([email protected], [email protected])

    • Thaweewat Rugsujarit ([email protected])

    Open Resources

    เรารวบรวมทรัพยากรทั้งหมดเพื่อในการสร้าง OpenThaiGPT ให้สำเร็จโดย Open Resources ของเราที่จะเปิด เราจะเปิดให้ตามสิทธิดังต่อไปนี้

    Resource
    Description
    Open to
    Link
    Google Colabcolab.research.google.com
    Google Colabcolab.research.google.com
    Google Colabcolab.research.google.com

    Jillaphat Jaroenkantasima ([email protected])

  • Norapat Buppodom ([email protected])

  • Koravich Sangkaew ([email protected])

  • Peerawat Rojratchadakorn ([email protected])

  • Chanon Utupon ([email protected])

  • Sadhis Wongprayoon ([email protected])

  • Nucharee Thongthungwong ([email protected])

  • Chawakorn Phiantham ([email protected])

  • Patteera Triamamornwooth ([email protected])

  • Kriangkrai Saetan ([email protected])

  • Pitikorn Khlaisamniang ([email protected])

  • Jarupoj Tanomrak ([email protected])

  • Phoochit Witchutanon ([email protected])

  • Pattareeya Piravechsakul ([email protected])

  • https://colab.research.google.com/drive/1dKNjLhOl1alBezcPdLihwqEOwJhcNAum?usp=sharing
    https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta
    https://github.com/OpenThaiGPT/openthaigpt
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-beta-13b-chat-hf
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-beta-13b-chat-gguf

    ดร. กอบกฤตย์ อธิบายวิธีการทำ Reinforcement Learning with Human Feedback พร้อมกับ Colab ตัวอย่าง และถกกันถึงว่าจะพัฒนา Reward Model เพื่อการทำ PPO กันได้อย่างไร

    16:30-17:00

    ลงทะเบียนทีมอาสาสมัคร กำหนดหัวหน้าทีม กำหนด Timeline กำหนดการประชุมรายสัปดาห์ และเริ่มต้นพัฒนา OpenThaiGPT อย่างเป็นทางการ

    13:00-13:15

    ดร.เทพชัย + ดร. กอบกฤตย์ อธิบายถึงความเป็นมาของ OpenThaiGPT

    13:15-14:00

    ดร. สุเมธ อธิบายถึงการทำงานของ ChatGPT และวิธีการสร้าง ChatGPT

    14:00-14:15

    ดร. กอบกฤตย์ อธิบายวิธีการทำ OpenThaiGPT version 0.0.1 พร้อมแจก Colab พร้อมแนะนำวิธีการทำ

    14:15-15:00

    ดร. กอบกฤตย์ นำการถก เรื่องวิธีการเก็บข้อมูล Thai InstructGPT การพัฒนาเว็บไซด์เพื่อช่วยกันเก็บข้อมูลและ Guideline ที่จะเก็บข้อมูล Thai InstructGPT Dataset ได้อย่างรวดเร็ว

    15:00-16:00

    ดร. สุเมธ + ดร.ปรัชญา นำการถกกันเรื่องวิธีการ Pretraining Model จะเลือก Model อะไร ใช้ Dataset จากไหนมา Train และจะใช้ GPU Server จากไหนในการ Training

    https://forms.gle/iKUjJe5WuztRaMxS8
    https://us06web.zoom.us/j/86716196167?pwd=UXM1M3l1U3VkMHZOVG1lQ0xTZmVtZz09
    https://goo.gl/maps/xP7aDoatnmPHseaTA

    16:00-16:30

    Public

    Released Code & Colab

    Code หรือ Colab ที่ใช้ในการพัฒนา Model OpenThaiGPT

    Public

    Related Paper / Knowledge

    รวบรวม Paper หรือองค์ความรู้ทางด้าน LLM และ Transformers

    Public

    Free Working Datasets

    รวบรวม Dataset เปิดอื่นๆ ที่สามารถนำไปใช้ Train OpenThaiGPT ได้

    Public

    Proprietary Datasets (or Not sure)

    รวบรวม Dataset ปิดอื่นๆ (ที่ไม่ได้รับการยืนยันว่าเป็น Dataset เปิดหรือไม่) ที่สามารถนำไปใช้ Train OpenThaiGPT ได้

    Volunteer-Only

    Computing Resources

    แหล่งรวมวิธีการเข้าถึง GPU Farm เพื่อใช้ในการพัฒนา Model OpenThaiGPT โดย Sponsor ของเรา

    Volunteer-Only

    Released Models

    Models ที่พัฒนาโดย Community OpenThaiGPT

    Public

    Released Models Version <0.1.0-beta> (16/05/23)

    Released Datasets

    Dataset ที่พัฒนาโดย Community OpenThaiGPT

    13:00-13:15

    ดร. กอบกฤตย์ เล่าอัพเดท OpenThaiGPT ผ่าน Zoom

    13:15-13:45

    ดร. ปรัชญา เล่าถึงงาน Pretraining และเล่าถึงงานที่ต้องการให้อาสาสมัคร และเปิดให้อาสาสมัครเข้าทีม

    13:45-14:15

    ดร. สุเมธ เล่าถึงงาน Finetune InstructGPT และ RLHF และเล่าถึงงานที่ต้องการให้อาสาสมัคร และเปิดให้อาสาสมัครเข้าทีม

    14:15-15:00

    คุณ Thanathas เล่าถึงงาน Safety Net และเล่าถึงงานที่ต้องการให้อาสาสมัคร และเปิดให้อาสาสมัครเข้าทีม

    15:00-15:15

    Q/A + เปิดให้หัวหน้าทีมรับอาสาสมัครเข้าทีม

    https://docs.google.com/presentation/d/1JJxtwo1pCJC3u6aSfslSp1FJSb5ZS5xBKIiQ-6Kip_g/edit#slide=id.g215e4599848_0_88
    https://drive.google.com/file/d/1_5RRbyfSlLm3W277Zf4Kp7b8ZP6KRzR3/view?usp=sharing

    13.00น - 13.30 น

    ลงทะเบียน

    13:30น - 13:45 น

    กล่าวเปิดกิจกรรม โดย ดร.ชัย วุฒิวิวัฒน์ชัย ผู้อำนวยการศูนย์เทคโนโลยีอิเล็กทรอนิกส์และคอมพิวเตอร์แห่งชาติ

    13.45 น. - 15.00 น.

    เสวนา “ความท้าทาย ความเป็นไปได้ และโอกาสของ ChatGPT สัญชาติไทย” ดำเนินรายการโดย ดร. กอบกฤตย์ วิริยะยุทธกร - AIEAT โดย (1) ดร. เทพชัย ทรัพย์นิธิ - AIAT (Core team) (2) ดร.ปรัชญา บุญขวัญ - NECTEC (Pretraining) (3) ดร. สุเมธ ยืนยง - Mahidol (Finetuning) (4) ดร. อภิวดี ปิยธรรมรงค์ - NECTEC (Standard & Safety Net) (4) ??? - ThaiSC (5) ??? - Pantip พร้อมเปิดตัว OpenThaiGPT version 0.1.0 โดย ดร.สุเมธ และ ดร.กอบกฤตย์ และขอบคุณ Volunteers และผู้สนับสนุน

    15:00น. - 15:30น

    สอบถาม แลกเปลี่ยนความคิดเห็น และพบปะกันระหว่าง Volunteer ของโครงการ OpenThaiGPT

    https://colab.research.google.com/drive/1NkmAJHItpqu34Tur9wCFc97A6JzKR8xo
    https://colab.research.google.com/drive/1nZ6Vc2U6rOezsMxarGJY7oDw8RG5E4r_?usp=sharing
    https://colab.research.google.com/drive/13yLIifBRDQp82QO4ICs_aEvz0N8tqVPm?usp=sharing
    Google Colabcolab.research.google.com
    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu?usp=sharing
    Google Colabcolab.research.google.com
    https://colab.research.google.com/drive/1kDQidCtY9lDpk49i7P3JjLAcJM04lawu?usp=sharing
    Google Colabcolab.research.google.com
    https://colab.research.google.com/drive/1dKNjLhOl1alBezcPdLihwqEOwJhcNAum
    Logo
    Logo
    Logo

    Released Datasets (14/04/23)

    Thai Instruct Dataset

    Version
    Size
    Download URL

    Thai SelfInstruct Dataset #2 (Automatic Generated) 2023-04-14

    5000 pairs

    Tagging Dataset

    OpenThaiGPT Tagging Dataset (Thai Language Only)

    Dataset from https://tag.openthaigpt.aieat.or.th. We will release every Sunday.

    Version
    Size
    Download URL

    Oscar (Oscar Kjell)huggingface
    OSCAR or Open Super-large Crawled ALMAnaCH coRpus is a huge multilingual corpus obtained by language classification and filtering of the Common Crawl corpus using the goclassy architecture. Data is distributed by language in both original and deduplicated form.
    https://huggingface.co/datasets/thaisumhuggingface.co
    A large-scale corpus for Thai text summarization obtained from several online news websites namely Thairath, ThaiPBS, Prachathai, and The Standard. This dataset consists of over 350,000 article and summary pairs written by journalists.
    Wikipedia (Basa Bali )huggingface
    Wikipedia dataset containing cleaned articles of all languages. The datasets are built from the Wikipedia dump (https://dumps.wikimedia.org/) with one split per language. Each example contains the content of one full Wikipedia article with cleaning to strip markdown and unwanted sections (references, etc.).
    https://huggingface.co/datasets/iapp_wiki_qa_squadhuggingface.co
    iapp_wiki_qa_squad is an extractive question answering dataset from Thai Wikipedia articles. It is adapted from to format, resulting in 5761/742/739 questions from 1529/191/192 articles by iApp Technology.
    Join the OpenThaiGPT Discord Server!Discord
    Aligning language models to follow instructionsOpenAI
    Website by OpenAI
    Scaling Laws for Neural Language ModelsarXiv.org
    LLM Size for Pre-training Paper by DeepMind
    New Scaling Laws for Large Language Models — LessWrongwww.lesswrong.com
    LLM Size for Pre-training Website
    Training language models to follow instructions with human feedbackarXiv.org
    Main Paper by OpenAI

    Released OpenThaiGPT Pip Python Library <0.1.1> (26/05/23)

    ต้องการใช้ OpenThaiGPT? ทุกท่านสามารถใช้ OpenThaiGPT ได้โดยง่ายๆดังนี้

    Version 0.1.0-beta Demo on Google Colab: Version 0.1.0-alpha Demo on Google Colab:

    Version 0.0.4 Demo on Google Colab:

    Source Code

    Released Datasets (14/04/23)
    Released Code / Colabs
    Related Paper / Knowledge
    Free Working Datasets
    https://drive.google.com/drive/folders/1jR6zOe3ZeUQVkDyB56O3xjeteF81tmkb?usp=sharing
    Computing Resources
    Logo
    Logo
    Logo
    Logo
    https://docs.google.com/presentation/d/e/2PACX-1vQLsBhtsxECAx5kk_I_xtjmq1ibdcjE9NOfw7XU5zird2cYspQeg5BaeIUyJtKunmoupim1AbsKEcPe/pub

    Total Messages = 105 Total Review Count = 312 ---- Average Depth = 1.12 Average Children Count = 0.60 Average Review Count = 2.82 👍

    2023-03-12

    Total Messages = 97 Total Review Count = 263 ---- Average Depth = 1.14 Average Children Count = 0.62 Average Review Count = 2.57 👍

    2023-03-05

    Total Messages = 71 Total Review Count = 186

    2023-02-26

    Total Messages = 25 Total Review Count = 51

    https://docs.google.com/spreadsheets/d/1BSHkpRyD5RH90E85tLWe4UzpgfDHZafE2rKxLincyWI/edit?usp=sharing

    Thai SelfInstruct Dataset #1 (Automatic Generated) 2023-04-09

    1000 pairs

    https://docs.google.com/spreadsheets/d/1BSHkpRyD5RH90E85tLWe4UzpgfDHZafE2rKxLincyWI/edit?fbclid=IwAR2q_zWQNb7o5cIENZDmZeOEb9Cze3XMcDLR_WipHdDsHv04uN549jJsIAk#gid=1847493687

    Thai SEED Instruct Dataset

    (Human Reviewed) 2023-04-08

    175 pairs

    https://drive.google.com/file/d/1-bz16ASSlFZBj8m-SlQIxLxj2ZdHo99y/view?usp=sharing

    2023-04-09

    Total Messages = 123 Total Review Count = 342 ---- Average Depth = 1.13 Average Children Count = 0.59 Average Review Count = 2.78 👍

    https://drive.google.com/drive/u/3/folders/1XzLfGIYUicXfOAs1n8caXgRW2GQ50qzm

    2023-04-02

    Total Messages = 123 Total Review Count = 341 ---- Average Depth = 1.13 Average Children Count = 0.59 Average Review Count = 2.77 👍

    https://drive.google.com/drive/folders/1P6X1i4O4P0i7cEUGFPcCnIpdXSt51JuH?usp=sharing

    2023-03-26

    Total Messages = 116 Total Review Count = 336 ---- Average Depth = 1.06 Average Children Count = 0.56 Average Review Count = 2.89 👍

    https://drive.google.com/drive/folders/1YxYhMO5VodFuwDZj9g3nxx6VAUiSQZek?usp=sharing

    2023-03-19

    Changelogs

    ติดตั้ง

    สนับสนุน Python >=3.6 และติดตั้งเลือกอันใดอันหนึ่งดังต่อไปนี้

    สำหรับ CPU version

    สำหรับ GPU Version

    • OpenThaiGPT Model Version 0.0.1 - 0.0.4 = Require at least 2 GB VRam

    • OpenThaiGPT Model Version 0.1.0-alpha = Require at least 30 GB VRam (Nvidia A100 at least 40GB is recommended)

    • OpenThaiGPT Model Version 0.1.0-beta = Require at least 15 GB VRam (Nvidia T4 is recommended)

    สำหรับ CUDA 11.6 version

    สำหรับ CUDA 11.7 version

    วิธีการเรียกใช้

    Project ตัวอย่างในการเรียกใช้ (Version 0.0.4)

    https://colab.research.google.com/drive/13yLIifBRDQp82QO4ICs_aEvz0N8tqVPm?usp=sharin

    Colab ตัวอย่างการเรียกใช้ (Vesion 0.1.0)

    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF

    https://colab.research.google.com/drive/1e5sYIMC1ABUNND_vazFaruDrFqYUNlVZ?usp=sharing
    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu?usp=sharing
    https://colab.research.google.com/drive/13yLIifBRDQp82QO4ICs_aEvz0N8tqVPm?usp=sharing
    the original iapp-wiki-qa-dataset
    SQuAD
    Logo
    Logo
    https://huggingface.co/datasets/thaiqa_squadhuggingface.co
    thaiqa_squad is an open-domain, extractive question answering dataset (4,000 questions in train and 74 questions in dev) in SQuAD format, originally created by NECTEC from Wikipedia articles and adapted to SQuAD format by PyThaiNLP.
    Logo
    0.1.1 (2023-05-26)
     - Add Model version 0.1.0-beta (https://huggingface.co/kobkrit/openthaigpt-0.1.0-beta)
    0.1.0 (2023-04-23)
     - Support Model Selection
     - Add Model version 0.1.0-alpha (https://huggingface.co/kobkrit/openthaigpt-0.1.0-alpha) to supported models.
    0.0.9-0.0.10 (2023-03-19)
     - Released OpenThaiGPT Zero
    0.0.8 (2023-03-12)
     - Update README
    0.0.7 (2023-03-12)
     - Update Model to Version 0.0.4 (https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.4)
    0.0.6 (2023-03-05)
     - Update README
    0.0.5 (2023-02-28)
     - First release on PyPI.
    $ pip install openthaigpt torch --extra-index-url https://download.pytorch.org/whl/cpu
    $ pip install openthaigpt torch --extra-index-url https://download.pytorch.org/whl/cu116
    $ pip install openthaigpt torch
    import openthaigpt
    
    # OpenThaiGPT Model 0.1.0-beta
    print(openthaigpt.generate(instruction="แปลภาษาอังกฤษเป็นภาษาไทย", 
            input="We want to reduce weight.", 
            model_name = "kobkrit/openthaigpt-0.1.0-beta", 
            min_length=50, max_length=300, top_p=0.75, 
            top_k=40, num_beams=1, no_repeat_ngram_size=0, 
            temperature=0.1, early_stopping=True, load_8bit=False))
    # เราต้องการลดน้ำหนัก.
    
    # OpenThaiGPT Model 0.1.0-alpha
    print(openthaigpt.generate(instruction="อธิบายขั้นตอนการทำข้าวผัดไก่", 
            input="", model_name = "kobkrit/openthaigpt-0.1.0-alpha", 
            min_length=50, max_length=768, top_k=20,
            num_beams=5, no_repeat_ngram_size=10, temperature=1.5,
            early_stopping=True))
    # ขั้นตอนการทำข้าวผัดไก่ ได้แก่ 1. เตรียมไก่และน้ำมันมะพร้าว 2. นำไปผสมกับเนยขาว 3. ใส่เนื้อหมูที่เหลืออยู่ในเครื่องปรุงอาหาร 4. เพิ่มไข่เจียระเบียบ 5. นำผักผัก 6. เต็มไปด้วยแป้งสำหรับผัด 7. ผสานข้อมูลของคุณให้แน่ใจว่าไก่&quot;จะเป็นส่วนประกอบทั้งหมด&quot; 8. นำໄก่ไปใช้ในกระท่อมที
    
    # OpenThaiGPT Model 0.0.4
    print(openthaigpt.generate("Q: อยากลดความอ้วนทำไง\n\nA:"))
    # Q: อยากลดความอ้วนทำไง
    #
    # A: การลดน้ำหนักเป็นสิ่งที่สำคัญที่สุดสำหรับการลดไขมันในร่างกาย ดังนั้นคุณควรปรึกษาแพทย์หรือผู้เชี่ยวชาญด้านสุขภาพก่อนที่จะตัดสินใจว่าจะเลือกใช้ผลิตภัณฑ์ใดในการรักษาหรือไม่ อย่างไรก็ตาม หากคุณรู้สึกว่าตัวเองมีปัญหาในเรื่องนี้ คุณสามารถติดต่อแพทย์เพื่อสอบถามข้อมูลเพิ่มเติมเกี่ยวกับวิธีการแก้ไขปัญหานี้ได้เช่นกัน นอกจากนี้คุณยังสามารถพูดคุยกับคนอื่น ๆ เพื่อช่วยให้คำปรึกษาที่ดียิ่งขึ้นได้อีกด้วยค่ะ ขอบคุณที่มา: https://www.facebook.com/pages/%E0%B8%A8-in-the-circle-healthy-make-up.html?mibextid=a&browse=b&country=1&fb=&idx=0&pageb
    
    #####################
    
    # OpenThaiGPT-Zero
    
    # ข้อความจาก OpenThaiGPT
    openthaigpt.zero("การลดน้ำหนักเป็นเรื่องที่ต้องพิจารณาอย่างละเอียดและรอบคอบเพื่อให้ได้ผลลัพธ์ที่ดีและมีประสิทธิภาพมากที่สุด")
    # {'perplexity': 2.4544131755828857,
    # 'threshold': 10,
    # 'isGeneratedFromOpenThaiGPT': True}
    
    # ข้อความจาก OpenAI ChatGPT
    openthaigpt.zero("สวัสดีครับ มีอะไรให้ผมช่วยเหลือหรือไม่ครับ?")
    # {'perplexity': 4.949122428894043,
    # 'theshold': 10,
    # 'isGeneratedFromOpenThaiGPT': True}
    
    # ข้อความจากมนุษย์
    openthaigpt.zero("ทดสอบครับผม")
    # {'perplexity': 1758.141357421875,
    # 'threshold': 10,
    # 'isGeneratedFromOpenThaiGPT': False}
    
    # แสดงวิธีการปรับ threshold
    openthaigpt.zero("สวัสดีครับ", threshold=5)
    # {'perplexity': 8.109768867492676,
    # 'theshold': 5,
    # 'isGeneratedFromOpenThaiGPT': False}
    
    
    https://drive.google.com/drive/folders/16SHAU_lviRvgIlBDlYrmFcYrCroubwk7?usp=sharing
    https://drive.google.com/drive/folders/1UZrUpS30JIPJw1uQeSJd16CBu_hFwK8G?usp=sharing
    https://drive.google.com/drive/folders/1HRefH7w4UmjzjAahcdMXqhKUCCqQkoM7?usp=sharing
    https://drive.google.com/file/d/1gtgcdJ_WEslC1wHi10Q86VmvLCfHNeru/view?usp=share_link
    https://youtu.be/LzrlYNTd4rY
    https://www.youtube.com/watch?v=S7qYQAgMg_k
    nakcnx/Thai-UCC · Datasets at Hugging Facehuggingface
    Thai UCC Corpus is translate from by PyThaiNLP Translator and Google Translator.
    https://tag.openthaigpt.aieat.or.thtag.openthaigpt.aieat.or.th
    https://tag.openthaigpt.aieat.or.th/
    UCC (Unhealthy Comments Corpus)
    Logo

    Released Models Version <0.1.0-beta> (16/05/23)

    Version 0.1.0-beta (16 May 2023)

    Demo:

    Change Logs

    Version 0.1.0-beta (Facebook LLama Model)

    Release date: 16 May 2023

    OpenThaiGPT Version 0.1.0-beta is a 7B-parameter LLaMA model finetuned to follow Thai translated instructions below and makes use of the Huggingface LLaMA implementation.

    Statistics

    Number of parameters: 7B Dimension: 4096 Max Length Token: 2048 n heads: 32 n layers: 32 n tokens: 1T

    License

    Source Code: License Apache Software License 2.0. Weight: For research use only (due to the Facebook LLama's Weight LICENSE). Note that: A commercial use license for OpenThaiGPT 0.1.0 weight will be released later soon!

    Code and Weight

    Finetune Code: Inference Library: Weight (Lora Adapter):

    Authors

    Kobkrit Viriyayudhakorn ([email protected]), Sumeth Yuenyong ([email protected]) and Thaweewat Rugsujarit ([email protected]).

    Trained Datasets

    Dataset Name
    Instruction Pairs
    Descriptions

    ---

    Version 0.1.0-alpha (ByT5-XL Model)

    Release date: 24 April 2023 PoC Testing Website: Model and Weight: PIP Installation Page: Code Example: ----

    OpenThaiGPT version 0.1.0-alpha

    Thai First 3 billion params models

    • First Thai Byte-Level Text-to-Text Transfer Transformer

    • Support Instruction following

      • Translation to Thai

      • Explanation

    PoC Version 0.0.4 (The Fourth PoC Version)

    Release date: 12 March 2023 PoC Testing Website: Model and Weight: PIP Installation Page: Code Example: ----

    OpenThaiGPT version 0.0.4

    The Fourth PoC Model

    • ตอบคำถามได้ลงรายละเอียดมากขึ้น และตอบคำถามได้ดีขึ้นกว่า 0.0.3 เป็นส่วนมาก

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 300,000 Pantip + 5,000 Wiki QA => 12,920 Thai InstructGPT

    • RLHF: None

    PoC Version 0.0.3 (The Third PoC Version)

    Release date: 28 February 2023 Model and Weight: PIP Installation Page: Code Example: ----

    OpenThaiGPT version 0.0.3

    The Third PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 300,000 Pantip + 5,000 Wiki QA => 7,000 Thai InstructGPT

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.2 (The Second PoC Version)

    Release date: 27 February 2023 Model and Weight: PIP Installation Page: {Coming Soon} Colab Example: {Coming Soon} ----

    OpenThaiGPT version 0.0.2

    The Second PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 7,000 Thai InstructGPT

    • RLHF: None

    Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.1 (Very First PoC Version)

    Release date: 20 February 2023 Model and Weight: PIP Installation Page: {Coming Soon} Colab Example: {Coming Soon} ----

    The Very First PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 298,678 QA Pairs getting from 70,000 Pantip katoos + Wikipedia QA by iApp

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    Logo

    OpenThaiRAG

    เฟรมเวิร์กระบบ AI อัจฉริยะเพื่อการสร้างคำตอบโดยใช้การค้นคืนข้อมูล (Retrieval-Augmented Generation: RAG) แบบโอเพนซอร์สที่ออกแบบมาเฉพาะสำหรับการประมวลผลภาษาไทย

    OpenThaiRAG

    OpenThaiRAG is an open-source Retrieval-Augmented Generation (RAG) framework designed specifically for Thai language processing. This project combines the power of vector databases, large language models, and information retrieval techniques to provide accurate and context-aware responses to user queries in Thai using OpenThaiGPT 1.5 as LLM.

    OpenThaiRAG เป็นเฟรมเวิร์กการสร้างคำตอบโดยใช้การค้นคืนข้อมูล (Retrieval-Augmented Generation: RAG) แบบโอเพนซอร์สที่ออกแบบมาเฉพาะสำหรับการประมวลผลภาษาไทย โครงการนี้รวมพลังของฐานข้อมูลเวกเตอร์ โมเดลภาษาขนาดใหญ่ และเทคนิคการค้นคืนสารสนเทศเพื่อให้คำตอบที่แม่นยำและคำนึงถึงบริบทสำหรับคำถามของผู้ใช้ในภาษาไทย โดยใช้ OpenThaiGPT 1.5 เป็นโมเดลภาษาขนาดใหญ่ สำหรับข้อมูลเพิ่มเติมเกี่ยวกับโครงการ OpenThaiGPT.

    Logo
    Logo

    15,000

    Databrick's Dolly Instruction translated into Thai by Thaweewat Ruksujarit.

    52,000

    Instruction Wild's translated into Thai by Thaweewat Ruksujarit.

    51,000

    Standford Alpaca's translated into Thai by Thaweewat Ruksujarit.

    20,000

    GPT Teacher's Instruction translated into Thai by Thaweewat Ruksujarit.

    600

    ONET m6 Social Exam

    24,000

    Hello Simple AI Summary Dataset translated into Thai by Thaweewat Ruksujarit.

    OpenThaiGPT Self Instruct ()

    5,000

    Thai SelfInstruct Dataset (Automatic Generated) by OpenThaiGPT

    Paraphase

  • Zero-shot and Few-shot Learning

  • Pretraining Model: ByT5-XL (3.74 billion params)

  • InstructDataset: 50,000 Thai SelfInstruct

  • RLHF: None

  • Developer: Sumeth Yuenyong, Kobkrit Viriyayudhakorn ([email protected])

  • Developer: Kobkrit Viriyayudhakorn ([email protected])

    Thaweewat/alpaca-finance-43k-th

    43,000

    Alpaca Finance Instruction translated into Thai by Thaweewat Ruksujarit.

    kobkrit/rd-taxqa

    600

    RD's Tax QA Chatbot Training set by ทรงวุฒิ บุรงค์

    datasets/iapp_wiki_qa_squad

    4,000

    iApp Technology's Extractive QA Dataset in Thai language

    https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta
    https://github.com/OpenThaiGPT/openthaigpt
    https://huggingface.co/kobkrit/openthaigpt-0.1.0-beta
    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF
    https://huggingface.co/kobkrit/openthaigpt-0.1.0-alpha
    https://pypi.org/project/openthaigpt/
    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF
    https://colab.research.google.com/drive/13yLIifBRDQp82QO4ICs_aEvz0N8tqVPm?usp=sharin
    https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.4
    https://pypi.org/project/openthaigpt/
    https://github.com/OpenThaiGPT/openthaigpt-example
    https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.3
    https://pypi.org/project/openthaigpt/
    https://github.com/OpenThaiGPT/openthaigpt-example
    https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.2
    openthaigpt-gpt2-pantipwiki-poc

    Code

    https://github.com/OpenThaiGPT/openthairag

    Key Features

    • Vector Database Integration: Utilizes Milvus for efficient storage and retrieval of document embeddings.

    • Multilingual Embedding Model: Incorporates the BAAI/bge-m3 model for generating high-quality embeddings for Thai text.

    • Advanced Retrieval: Implements a two-stage retrieval process with initial vector search and subsequent re-ranking for improved accuracy.

    • Large Language Model Integration: Seamlessly integrates with vLLM for generating human-like responses based on retrieved context.

    • RESTful API: Offers a Flask-based web API for easy integration into various applications.

    คุณสมบัติหลัก

    • การผสานรวมฐานข้อมูลเวกเตอร์: ใช้ Milvus สำหรับการจัดเก็บและค้นคืนเอ็มเบดดิงของเอกสารอย่างมีประสิทธิภาพ

    • โมเดลเอ็มเบดดิงหลายภาษา: รวม BAAI/bge-m3 model สำหรับการสร้างเอ็มเบดดิงคุณภาพสูงสำหรับข้อความภาษาไทย

    • การค้นคืนขั้นสูง: ใช้กระบวนการค้นคืนสองขั้นตอนด้วยการค้นหาเวกเตอร์เบื้องต้นและการจัดอันดับใหม่ในภายหลังเพื่อเพิ่มความแม่นยำ

    • การผสานรวมโมเดลภาษาขนาดใหญ่: ผสานรวมกับ vLLM อย่างราบรื่นเพื่อสร้างคำตอบที่เหมือนมนุษย์ตามบริบทที่ค้นคืนได้

    • RESTful API: นำเสนอ API เว็บที่ใช้ Flask เพื่อการผสานรวมที่ง่ายกับแอปพลิเคชันต่างๆ

    Core Functionalities

    1. Document Indexing: Allows users to index Thai documents, generating and storing embeddings for efficient retrieval.

    2. Query Processing: Handles user queries by finding relevant documents and generating context-aware responses.

    3. Document Management: Provides endpoints for listing and deleting indexed documents.

    OpenThaiRAG aims to enhance natural language understanding and generation for Thai language applications, making it a valuable tool for developers working on chatbots, question-answering systems, and other NLP projects focused on Thai language processing.

    ฟังก์ชันการทำงานหลัก

    1. การทำดัชนีเอกสาร: อนุญาตให้ผู้ใช้ทำดัชนีเอกสารภาษาไทย สร้างและจัดเก็บเอ็มเบดดิงสำหรับการค้นคืนอย่างมีประสิทธิภาพ

    2. การประมวลผลคำถาม: จัดการคำถามของผู้ใช้โดยค้นหาเอกสารที่เกี่ยวข้องและสร้างคำตอบที่คำนึงถึงบริบท

    3. การจัดการเอกสาร: ให้จุดเชื่อมต่อสำหรับการแสดงรายการและลบเอกสารที่ทำดัชนีไว้

    OpenThaiRAG มีเป้าหมายเพื่อเพิ่มประสิทธิภาพการเข้าใจและการสร้างภาษาธรรมชาติสำหรับแอปพลิเคชันภาษาไทย ทำให้เป็นเครื่องมือที่มีคุณค่าสำหรับนักพัฒนาที่ทำงานเกี่ยวกับแชทบอท ระบบถาม-ตอบ และโครงการ NLP อื่นๆ ที่มุ่งเน้นการประมวลผลภาษาไทย

    Installation

    To install and run OpenThaiRAG using Docker Compose, follow these steps:

    1. Ensure you have Docker and Docker Compose installed on your system.

    2. Clone the OpenThaiRAG repository:

    3. Build and start the containers using Docker Compose:

      This command will:

      • Build the web service container

      • Start the Milvus standalone server

      • Start the etcd service

      • Start the MinIO service

      • Link all services together as defined in the docker-compose.yml file

    4. Once all containers are up and running, the OpenThaiRAG API will be available at http://localhost:5000.

    5. To stop the services, run:

    Note: Ensure that port 5000 is available on your host machine, as it's used to expose the web service. Also, verify that you have sufficient disk space for the Milvus, etcd, and MinIO data volumes.

    For production deployments, it's recommended to adjust the environment variables and security settings in the docker-compose.yml file according to your specific requirements.

    Containers

    OpenThaiRAG utilizes several containers to provide its functionality. Here's an explanation of each container's role and purpose:

    1. web:

      • Role: Main application container

      • Purpose: Hosts the Flask web service that provides the RESTful API for OpenThaiRAG. It handles document indexing, query processing, and interaction with other services.

    2. milvus:

      • Role: Vector database

      • Purpose: Stores and manages document embeddings for efficient similarity search. It's crucial for the retrieval component of the RAG system.

    3. etcd:

      • Role: Distributed key-value store

      • Purpose: Used by Milvus for metadata storage and cluster coordination. It ensures data consistency and helps manage the distributed nature of Milvus.

    4. minio:

      • Role: Object storage

      • Purpose: Provides S3-compatible object storage for Milvus. It's used to store large objects and files that are part of the Milvus ecosystem.

    These containers work together to create a robust and scalable infrastructure for the OpenThaiRAG system:

    • The web container interacts with Milvus for vector operations.

    • Milvus uses etcd for metadata management and MinIO for object storage.

    • This architecture allows for efficient document embedding storage, retrieval, and query processing, which are essential for the RAG (Retrieval-Augmented Generation) functionality of OpenThaiRAG.

    Indexing New Documents into RAG

    To insert new documents into the RAG system, you can use the index_docs.py script provided in the app directory. This script reads text files from the /docs folder and indexes their contents via the API. Here's how to use it:

    1. Prepare your documents:

      • Create text files (.txt) containing the content you want to index.

      • Place these files in the /docs directory of your project.

    2. Run the indexing script:

      This script will:

      • Read all .txt files in the /docs directory.

      • Split each document into chunks of maximum 200 characters, including the title in each chunk.

      • Send each chunk to the indexing endpoint (http://localhost:5000/index by default).

    3. Monitor the indexing process:

      • The script will log information about each indexed file.

      • At the end, it will report the total number of successfully indexed files and any files that couldn't be indexed.

    You can also customize the indexing process by modifying the index_docs.py script. For example, you can change the chunk size, adjust the indexing endpoint URL, or add additional preprocessing steps.

    Note: Ensure that your OpenThaiRAG API is running and accessible at the specified URL before running the indexing script.

    For more granular control or to index documents programmatically, you can use the /index endpoint directly:

    Example Document TXT Files

    You can see more examples at /docs.

    Getting RAG's Response.

    To get a response from the RAG system, you can use the /completions endpoint. This endpoint accepts a POST request with a JSON payload containing the user's query and optional parameters.

    Here's a list of query parameters supported by the /completions endpoint:

    1. prompt (required): The input text to generate completions for.

    2. max_tokens (optional): The maximum number of tokens to generate. Defaults to 16.

    3. temperature (optional): Controls randomness in generation. Higher values (e.g., 0.8) make output more random, lower values (e.g., 0.2) make it more focused. Defaults to 1.0.

    4. top_p (optional): An alternative to temperature, called nucleus sampling. Keeps the model from considering unlikely options. Defaults to 1.0.

    5. n (optional): How many completions to generate for each prompt. Defaults to 1.

    6. stream (optional): Whether to stream back partial progress. Defaults to false.

    7. logprobs (optional): Include the log probabilities on the logprobs most likely tokens. Defaults to null.

    8. echo (optional): Echo back the prompt in addition to the completion. Defaults to false.

    9. stop (optional): Up to 4 sequences where the API will stop generating further tokens.

    10. presence_penalty (optional): Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far. Defaults to 0.

    11. frequency_penalty (optional): Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far. Defaults to 0.

    12. best_of (optional): Generates best_of completions server-side and returns the "best" (the one with the highest log probability per token). Defaults to 1.

    13. logit_bias (optional): Modify the likelihood of specified tokens appearing in the completion.

    14. user (optional): A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

    Note: Some parameters may not be applicable depending on the specific model and configuration of your OpenThaiRAG setup.

    via API: Non-Streaming

    via API: Streaming

    via OpenAI Library

    You can take a look at /app/query_rag_using_openai.py. To use the OpenAI library to get RAG responses, you can follow these steps:

    1. Install the OpenAI library:

    2. Configure the OpenAI client to use the vLLM server:

    3. Define your prompt:

    4. For a non-streaming response:

    5. For a streaming response:

    You can find the complete example in the /app/query_rag_using_openai.py file.

    Full API Documentation

    For detailed API documentation and examples, please refer to our Postman collection: OpenThaiRAG API Postman Collection

    Maintainer

    OpenThaiGPT Team

    • Kobkrit Viriyayudhakorn ([email protected])

    • Sumeth Yuenyong ([email protected])

    • Apivadee Piyatumrong ([email protected])

    • Jillaphat Jaroenkantasima ([email protected])

    License

    Apache 2.0

    OpenThaiRAG Logo
    GitHub - OpenThaiGPT/openthaigpt-example: Example for OpenThaiGPTGitHub
    https://github.com/OpenThaiGPT/openthaigpt-example
    GitHub - OpenThaiGPT/openthaigpt: OpenThaiGPT focuses on developing a Thai Chatbot system to have capabilities equivalent to ChatGPT, as well as being able to connect to external systems and be able to retrieve data flexibly. Easily expandable and customizable and developed into Free open source software for everyone.GitHub

    Released OpenThaiGPT 7b <1.0.0-beta> (16/08/23)

    🇹🇭 OpenThaiGPT 1.0.0-beta (16 August 2023)

    🇹🇭 OpenThaiGPT Version 1.0.0-beta is a Thai language 7B-parameter LLaMA v2 Chat model finetuned to follow Thai translated instructions and extend more than 24,554 most popular Thai words vocabularies into LLM's dictionary for turbo speed.

    Web Demo:

    อัพเดท! จากทีม Finetune (8 Apr)

    8 Apr 2023

    สวัสดีครับ ทุกท่าน 
ทางผม (ดร.ซี) และ ดร. สุเมธ (พี่เต้ย) มาขออัพเดทสถานการณ์ทีม Finetuning หน่อยครับ จากประชุมครั้งที่แล้ว เรามีเปลี่ยนทิศทางครับ TLDR; หลักๆคือ ปรับแผนครับบบ!! จาก RLHF -> Self-Instruct ครับ

    InstructGPT ใช้ Data และ Labour เยอะมาก

    เมื่อเดือนที่แล้ว เราจะทำ Model ออกมาด้วยเทคนิค InstructGPT ตาม Paper ของ OpenAI ครับ () ที่เป็นเทคนิคใช้เทรน ChatGPT ซึ่งการ Finetuning Model ประกอบไปด้วย 3 ส่วนหลักๆ

    (1) Pre-training ภาษาที่ใหญ่พอและที่เทรนมามากพอ (2) Finetuning บน Dataset InstructGPT (3) RLHF ให้คุณภาพดีขึ้น โดยส่วนที่ (1) เราให้ทีม จัดการไปครับ ส่วนที่ (2) เราใช้ Dataset จาก ThaiInstructGPT ที่เอาคำถามมาจากเว็บไซด์ Pantip เป็นต้นแบบและเก็บคำตอบจาก ChatGPT ซึ่งส่วนมากจะเป็นคำถามองค์ความรู้ทั่วไป แต่ก็ยังขาดชุดคำถาม-คำตอบที่เป็นคำสั่งละเอียดๆ อาทิเช่น คำสั่งแปลภาษา, คำสั่งแก้โค้ด, คำสั่งให้ตอบข้อสอบองค์ความรู้จาก O-net, คำสั่งเขียนโค้ด, คำสั่งที่แสดงถึงความฉลาดต่างๆ, และคำสั่งที่เป็นแบบ Few-shot Learning ครับ

    git clone https://github.com/OpenThaiGPT/openthairag
    cd openthairag
    docker-compose up -d
    python app/index_docs.py
    pip install openai==0.28
    import openai
    
    openai.api_base = "http://127.0.0.1:5000"
    openai.api_key = "dummy"  # vLLM doesn't require a real API key
    prompt = "วัดพระแก้ว กทม. เดินทางไปอย่างไร"
    def response(prompt):
        try:
            response = openai.Completion.create(
                model=".",  # Specify the model you're using with vLLM
                prompt=prompt,
                max_tokens=512,
                temperature=0.7,
                top_p=0.8,
                top_k=40,
                stop=["<|im_end|>"]
            )
            print("Generated Text:", response.choices[0].text)
        except Exception as e:
            print("Error:", str(e))
    
    # Example usage
    print("Non-streaming response:")
    response(prompt)
    Title: วัดธาตุทอง (Wat That Thong)
    Content: วัดธาตุทอง พระอารามหลวง ตั้งเมื่อปีพุทธศักราช ๒๔๘๑ และได้รับพระราชทานวิสุงคามสีมา เมื่อวันที่ ๒๔ ตุลาคม พุทธศักราช ๒๔๘๓(เขตวิสุงคามสีมา กว้าง ๔๐ เมตร ยาว ๘๐ เมตร) ผูกพัทธสีมา ฝังลูกนิมิตอุโบสถ เมื่อวันที่ ๒ ๘ กุมภาพันธ์ พุทธศักราช ๒๕๐๕ มีเนื้อที่ ๕๔ ไร่ ๓ งาน ๘๒ ตาราง(เลขที่ ๑๔๙ โฉนดที่ ๔๐๓๗)
    
    ทิศเหนือ ติดกับที่ดินและบ้านเรือนประชาชน(ซอยชัยพฤกษ์)
    
    ทิศใต้ ติดกับถนนสุขุมวิท
    
    ทิศตะวันออก ติดกับที่ดินและบ้านเรือนประชาชน(ซอยเอกมัย)
    
    วัดธาตุทองฯ แท้จริงแล้วมีประวัติความเป็นมายาวนาน ย้อนกลับไปถึงยุคสมัยสุโขทัยเป็นราชธานี ก่อนจะมาตั้งอยู่บนนถนนสุขุมวิทในปัจจุบัน
    
    Nearby Location: ตั้งอยู่ริมถนนสุขุมวิท แขวงพระโขนงเหนือ เขตวัฒนา
    Address: 1325
    Region: ภาคกลาง
    Alley: 
    Road: สุขุมวิท
    Subdistrict: 
    District: วัฒนา
    Province: กรุงเทพมหานคร
    Category: แหล่งท่องเที่ยวทางประวัติศาสตร์ และวัฒนธรรม
    Sub Type: ศาสนสถาน (วัด/โบสถ์/มัสยิด ฯลฯ)
    Facilities Contact: 
    Telephone: 0 2390 0261, 0 2391 1007
    Email: 
    Website: 
    Facebook: 
    Instagram: 
    Line: 
    TikTok: 
    YouTube: 
    Start-End: 05.30 21.00น.
    Activity: 
    Suitable Duration: 
    Fee (TH): 
    Fee (TH Kid): 
    Fee (EN): 
    Fee (EN Kid): 
    Remark: 
    Location: 13.7194087, 100.5857861
    UUID: 1ed676ed-4161-40f6-9e3d-12f4db53851d
    Created Date: 2024-09-23
    Updated Date: 2024-09-23
    URL: 
    Published Date: 
    >>>Request
    curl --location 'http://localhost:5000/completions' \
    --header 'Content-Type: application/json' \
    --data '{
        "prompt": "วัดพระแก้ว กทม. คืออะไร",
        "max_tokens": 2048,
        "temperature": 0.7
    }'
    
    <<<Response
    {
        "choices": [
            {
                "finish_reason": "stop",
                "index": 0,
                "logprobs": null,
                "prompt_logprobs": null,
                "stop_reason": null,
                "text": "วัดพระแก้ว (Wat Phra Kaeo) ตั้งอยู่ในจังหวัดชัยนาท สร้างในสมัยเดียวกับวัดมหาธาตุ ตั้งแต่ปี พ.ศ. 1900 วัดพระแก้วมีเจดีย์ทรงสูง ลักษณะเป็นเจดีย์แบบละโว้ผสมกับเจดีย์ทวารวดีตอนปลาย สร้างแบบสอปูน เป็นเจดีย์ฐานสี่เหลี่ยม มีพระพุทธรูปปั้นแบบนูนสูงประดับทั้งสี่ด้าน วัดพระแก้วมีพระสถูป เจดีย์ และพระพุทธรูปศิลาแลงสีแดง คือ หลวงพ่อทันใจ ที่อยู่ในวิหารด้านหน้าพระเจดีย์สี่เหลี่ยม วัดพระแก้วตั้งอยู่นอกเมืองทางด้านทิศใต้ ห่างจากวัดมหาธาตุประมาณ 3 กม. ปัจจุบันวัดพระแก้วอยู่กลางทุ่งนา มีพระเจดีย์เหลี่ยมเป็นหลักของวัด วัดพระแก้วเป็นโบราณสถานที่มีความสำคัญทางประวัติศาสตร์และศิลปะ ซึ่งได้รับการขึ้นทะเบียนเป็นโบราณสถานโดยกรมศิลปากรเมื่อวันที่ 8 มีนาคม 2478."
            }
        ],
        "created": 1728035246,
        "id": "cmpl-e0e5752f01e34d2bb701f86fad3b4954",
        "model": ".",
        "object": "text_completion",
        "usage": {
            "completion_tokens": 386,
            "prompt_tokens": 4946,
            "total_tokens": 5332
        }
    }
    >>>Request
    curl --location 'http://localhost:5000/completions' \
    --header 'Content-Type: application/json' \
    --data '{
        "prompt": "วัดพระแก้ว กทม. คืออะไร",
        "max_tokens": 2048,
        "temperature": 0.7,
        "stream": true
    }'
    
    <<<Response
    data: {"id":"cmpl-8dbd8bdfbcfb4310bf611cd6f6f7c2e4","object":"text_completion","created":1728035332,"model":".","choices":[{"index":0,"text":"","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}
    
    ...
    
    data: {"id":"cmpl-8dbd8bdfbcfb4310bf611cd6f6f7c2e4","object":"text_completion","created":1728035332,"model":".","choices":[{"index":0,"text":"ื","logprobs":null,"finish_reason":null,"stop_reason":null}],"usage":null}
    
    data: {"id":"cmpl-8dbd8bdfbcfb4310bf611cd6f6f7c2e4","object":"text_completion","created":1728035332,"model":".","choices":[{"index":0,"text":"องชัยนาท.","logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":null}
    
    data: [DONE]
    Colab Demo:

    Change Logs

    🇹🇭 Version 1.0.0-beta (Llama v2 + 24,554 Thai word extension)

    Release date: 16 August 2023

    🇹🇭 OpenThaiGPT Version 1.0.0-beta is a Thai language 7B-parameter LLaMA v2 Chat model finetuned to follow Thai translated instructions and extend 24,554 Thai words vocabularies for turbo speed.

    License

    Source Code: License Apache Software License 2.0. Weight: Research and Commercial uses.

    Code and Weight

    Finetune Code: https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta Inference Code: https://github.com/OpenThaiGPT/openthaigpt Weight: https://huggingface.co/openthaigpt/openthaigpt-1.0.0-beta-7b-chat

    Authors

    • Kobkrit Viriyayudhakorn ([email protected])

    • Sumeth Yuenyong ([email protected])

    • Prachya Boonkwan ([email protected], [email protected])

    • Thaweewat Rugsujarit ([email protected])

    • Jillaphat Jaroenkantasima ([email protected])

    • Norapat Buppodom ([email protected])

    • Koravich Sangkaew ([email protected])

    • Peerawat Rojratchadakorn ([email protected])

    • Surapon Nonesung ([email protected])

    • Chanon Utupon ([email protected])

    • Sadhis Wongprayoon ([email protected])

    • Nucharee Thongthungwong ([email protected])

    • Chawakorn Phiantham ([email protected])

    • Patteera Triamamornwooth ([email protected])

    • Nattarika Juntarapaoraya ([email protected])

    • Kriangkrai Saetan ([email protected])

    • Pitikorn Khlaisamniang ([email protected])

    • Teerapol Saengsukhiran ([email protected])

    • Phasin Aumwong ([email protected])

    ---

    🇹🇭 Version 1.0.0-alpha (Facebook LLama V2 Model)

    Release date: 3 August 2023

    🇹🇭 OpenThaiGPT Version 1.0.0-alpha is the first Thai implementation of a 7B-parameter LLaMA v2 Chat model finetuned to follow Thai translated instructions and makes use of the Huggingface LLaMA implementation.

    Changes

    (1) Using Facebook LLama v2 model 7b chat as a base model which is pretrained on over 2 trillion token. (2) Context Length is upgrade from 2048 token to 4096 token (3) Allow research and commerical use.

    License

    Source Code: License Apache Software License 2.0. Weight: Research and commercial uses.

    Code and Weight

    Colab Demo: https://colab.research.google.com/drive/1kDQidCtY9lDpk49i7P3JjLAcJM04lawu?usp=sharing Finetune Code: https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta (Same code as OpenThaiGPT 0.1.0-beta) Inference Library: https://github.com/OpenThaiGPT/openthaigpt Weight (Lora Adapter): https://huggingface.co/openthaigpt/openthaigpt-1.0.0-alpha-7b-chat Weight (Huggingface Checkpoint): https://huggingface.co/openthaigpt/openthaigpt-1.0.0-alpha-7b-chat-ckpt-hf

    Authors

    • Kobkrit Viriyayudhakorn ([email protected])

    • Sumeth Yuenyong ([email protected])

    • Thaweewat Rugsujarit ([email protected])

    • Jillaphat Jaroenkantasima ([email protected])

    • Norapat Buppodom ([email protected])

    • Koravich Sangkaew ([email protected])

    • Peerawat Rojratchadakorn ([email protected])

    • Surapon Nonesung ([email protected])

    • Chanon Utupon ([email protected])

    • Sadhis Wongprayoon ([email protected])

    • Nucharee Thongthungwong ([email protected])

    • Chawakorn Phiantham ([email protected])

    • Patteera Triamamornwooth ([email protected])

    • Nattarika Juntarapaoraya ([email protected])

    • Kriangkrai Saetan ([email protected])

    • Pitikorn Khlaisamniang ([email protected])

    • Teerapol Saengsukhiran ([email protected])

    • Phasin Aumwong ([email protected])

    ---

    Version 0.1.0-beta (Facebook LLama Model)

    Release date: 16 May 2023

    OpenThaiGPT Version 0.1.0-beta is a 7B-parameter LLaMA model finetuned to follow Thai translated instructions below and makes use of the Huggingface LLaMA implementation.

    Statistics

    Number of parameters: 7B Dimension: 4096 Context Length: 2048 n heads: 32 n layers: 32 n tokens: 1T

    License

    Source Code: License Apache Software License 2.0. Weight: For research use only (due to the Facebook LLama's Weight LICENSE). Note that: A commercial use license for OpenThaiGPT 0.1.0 weight will be released later soon!

    Code and Weight

    Finetune Code: https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta Inference Library: https://github.com/OpenThaiGPT/openthaigpt Weight (Lora Adapter): https://huggingface.co/kobkrit/openthaigpt-0.1.0-beta

    Authors

    Kobkrit Viriyayudhakorn ([email protected]), Sumeth Yuenyong ([email protected]) and Thaweewat Rugsujarit ([email protected]).

    Trained Datasets

    Dataset Name
    Instruction Pairs
    Descriptions

    43,000

    Alpaca Finance Instruction translated into Thai by Thaweewat Ruksujarit.

    600

    RD's Tax QA Chatbot Training set by ทรงวุฒิ บุรงค์

    4,000

    iApp Technology's Extractive QA Dataset in Thai language

    ---

    Version 0.1.0-alpha (ByT5-XL Model)

    Release date: 24 April 2023 PoC Testing Website: https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF Model and Weight: https://huggingface.co/kobkrit/openthaigpt-0.1.0-alpha PIP Installation Page: https://pypi.org/project/openthaigpt/ Code Example: https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF ----

    OpenThaiGPT version 0.1.0-alpha

    Thai First 3 billion params models

    • First Thai Byte-Level Text-to-Text Transfer Transformer

    • Support Instruction following

      • Translation to Thai

      • Explanation

      • Paraphase

    • Zero-shot and Few-shot Learning

    • Pretraining Model: ByT5-XL (3.74 billion params)

    • InstructDataset: 50,000 Thai SelfInstruct

    • RLHF: None

    • Developer: Sumeth Yuenyong, Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.4 (The Fourth PoC Version)

    Release date: 12 March 2023 PoC Testing Website: https://colab.research.google.com/drive/13yLIifBRDQp82QO4ICs_aEvz0N8tqVPm?usp=sharin Model and Weight: https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.4 PIP Installation Page: https://pypi.org/project/openthaigpt/ Code Example: https://github.com/OpenThaiGPT/openthaigpt-example ----

    OpenThaiGPT version 0.0.4

    The Fourth PoC Model

    • ตอบคำถามได้ลงรายละเอียดมากขึ้น และตอบคำถามได้ดีขึ้นกว่า 0.0.3 เป็นส่วนมาก

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 300,000 Pantip + 5,000 Wiki QA => 12,920 Thai InstructGPT

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.3 (The Third PoC Version)

    Release date: 28 February 2023 Model and Weight: https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.3 PIP Installation Page: https://pypi.org/project/openthaigpt/ Code Example: https://github.com/OpenThaiGPT/openthaigpt-example ----

    OpenThaiGPT version 0.0.3

    The Third PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 300,000 Pantip + 5,000 Wiki QA => 7,000 Thai InstructGPT

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.2 (The Second PoC Version)

    Release date: 27 February 2023 Model and Weight: https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.2 PIP Installation Page: {Coming Soon} Colab Example: {Coming Soon} ----

    OpenThaiGPT version 0.0.2

    The Second PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 7,000 Thai InstructGPT

    • RLHF: None

    Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.1 (Very First PoC Version)

    Release date: 20 February 2023 Model and Weight: openthaigpt-gpt2-pantipwiki-poc PIP Installation Page: {Coming Soon} Colab Example: {Coming Soon} ----

    The Very First PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 298,678 QA Pairs getting from 70,000 Pantip katoos + Wikipedia QA by iApp

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    ในส่วนที่ (3) ก็มีปัญหาในการทำ RLHF ติดปัญหาอยู่ 2 อย่างครับ

    ​(1) เรายังสร้าง Reward Model ที่มีประสิทธิภาพไม่ได้ครับ เนื่องจากขาด Dataset ครับ ตามข้อ (2) ครับ

    (2) ยังขาด Data Set ที่เป็นการ Ranking คำตอบที่มี ข้อความหน้าตาแตกต่างกันมากพอครับ

    (2.1) Dataset ที่ทางเรา Gen ออกมาให้จากการ Train Thai Instruct Dataset version แรก โดยโมเดลที่ออกคำตอบมาแตกต่างกันนั้น 4 อัน และขอร้องให้ทีมอาสาสมัครมาช่วย Rank กันนั้น (ที่ให้เรียง A,B,C,D) คำตอบแตกต่างกันไม่มากพอครับ แทบจะเขียนเหมือนกันเลย จนคนยังแยกไม่ออกเลยว่า อันไหนดีกว่ากันครับ

    (2.2) Dataset ที่ตอนนี้คนมา Tag ข้อมูลให้ที https://tag.openthaigpt.aieat.or.th/ มีความแตกต่างกันมากพอครับ เพราะใช้คนสร้างขึ้นมา แต่ยังมีปริมาณไม่เพียงพอครับ ประมาณ 100 กว่า Dataset ตัวอย่างเท่านั้นเอง (คงต้องกระตุ้นและหาคนมาช่วย Tag เพิ่มเติมครับ)

    วิธีการใหม่ Self-Instruct

    ในสัปดาห์ที่ผ่านมา ทางผมมาเจอ Paper Self-Instruct (https://arxiv.org/abs/2212.10560#) ซึ่งใน Paper นี้คือพื้นฐานกระบวนการสร้าง Stanford Alpaca Model ที่เปิดตัวเมื่อ 2 สัปดาห์ที่แล้วเลยครับ https://crfm.stanford.edu/2023/03/13/alpaca.html

    Paper นี้กล่าวถึงวิธีการสร้าง Dataset Thai InstructGPT ที่ใช้พลังงานคนน้อยมากครับ และสามารถชุดคำถาม-คำตอบที่เป็นคำสั่งละเอียดๆ คำสั่งเขียนโค้ด คำสั่งที่แสดงถึงความสามารถ และคำสั่งที่เป็นแบบ Few-shot Learning ได้ทั้งหมดด้วย โอ้ แก้ปัญหาเราได้พอดิบพอดี ซึ่งต้องการแค่คนมาช่วยมาตรวจคุณภาพ Dataset ตอนสุดท้ายและลบอันที่มีปัญหาออกไป

    ซึ่งทางนักพัฒนา Paper Self-Instruct แจ้งว่า ด้วยวิธีการนี้ ไม่ต้องทำวิธีการ RLHF อีกต่อไปแล้ว เพราะถ้า Dataset InstructGPT มีคุณภาพมากพอ ก็จะสามารถฝึก LLM ได้มีคุณภาพเทียบเท่า ChatGPT ได้เลยทีเดียว

    วิธีการของสร้าง Instruct Dataset แบบ Self-Instruct

    (1) เริ่มต้นให้คนเขียน Instruct Dataset ตัวอย่างครับ ที่เป็นภาษาไทย ผมขอเรียกว่า SEED Instruct Dataset เป็น Dataset เบื้องต้น 175 คู่ ซึ่งทางผมแปลด้วย Google Translate และ ทำการ Review นั่งแก้มือจนถูกต้องหมดทุกอย่างแล้ว (Human Reviewed) ดังภาพ

    แน่นอน! ทุกท่านสามารถไปโหลด SEED Instruct Dataset ที่ผมนั่ง Clean ให้แล้ว ได้เลยครับที่นี้: https://drive.google.com/file/d/1-bz16ASSlFZBj8m-SlQIxLxj2ZdHo99y/view?usp=sharing

    (2) Sample ตัวอย่างนี้ ยิงไปถาม OpenAI GPT-4 ให้เขียน Instruct Dataset แบบใหม่ออกมาใกล้เคียงแบบนี้ให้หน่อย โดยใช้ Prompt Engineering ดังตัวอย่างข้างล่าง

    1. ส่งให้ OpenAI GPT-4 จะเขียนตอบกลับมาดังนี้

    1. เราก็จะเก็บเกี่ยว สิ่งที่ OpenAI GPT-4 เขียนตอบกลับมา แปลงเป็น JSON ดังภาพ

    1. เราเปรียบเทียบ Instruct Dataset ที่ OpenAI เขียนมาให้ กับในคลังของเรา ถ้าในคลังมีคล้ายกับของใหม่มากเกินไป (คะแนน ROUGE มากกว่า 0.8) แม้แต่ 1 อัน ก็จะถูกปฏิเสธการเข้าคลัง ข้างล่างคือคะแนนความเหมือนของ Instruct อื่นๆ ของ Instruct Dataset อันใหม่ข้างต้น (จะเห็นได้ว่ามากสุดคือแค่ 0.18 เก็บเข้าคลังได้)

    สิ่งที่เรากำลังทำอยู่และต้องการความช่วยเหลือ

    1. ช่วยกรองข้อมูล Self-Instruct ให้ทีครับ

    ตอนนี้ทางผมกำลังรัน Self-Instruct ด้วยวิธีการนี้อยู่ และกำลังผลิต Instruct Dataset ออกมาใหม่เรื่อยๆ เมื่อได้ครบซัก 10,000 คู่เป็นอย่างน้อยแล้วจะขอ Volunteer มาช่วยกันตรวจสิ่งที่ GPT-4 ช่วยสร้าง Instruct Dataset มาให้นะครับ โดยอยากจะให้ช่วยแยกแยะว่า Instruct Dataset ที่สร้างขึ้นมาใหม่นี้

    1. ความถูกต้องตามความเป็นจริง

    2. ไม่หลอน (Not Hallucinations)

    3. ไม่มีคำสะกดผิด

    4. ไม่มีคำใหม่ ที่ประดิษฐ์มาใหม่ ไม่เคยนิยามมาก่อน

    5. อ่านรู้เรื่อง

    ซึ่งผมจะปล่อยผ่านทาง Google Sheet https://docs.google.com/spreadsheets/d/1BSHkpRyD5RH90E85tLWe4UzpgfDHZafE2rKxLincyWI/edit?usp=sharing รบกวนทุกท่านช่วยมา Tag ครับ ดังตัวอย่าง ตัวอย่างที่ 1: เป็นตัวอย่างที่ดี

    ตัวอย่างที่ 2: เป็นตัวอย่างที่ไม่ดี (แปลไม่ถูก)

    ตัวอย่างที่ 3: : เป็นตัวอย่างที่ไม่ดี (มีคำซ้ำมากเกินไป วิ่งวิ่งวิ่ง)

    เป็นต้น

    ความช่วยเหลืออีกอันแต่ไม่เกี่ยวกันครับ

    1. อยากได้ข้อสอบ O-Net พร้อมเฉลยในรูปแบบ JSON Text ครับ แบบนี้ครับ ใครมีบ้างครับ ติดต่อผมได้เลยครับที่ [email protected] หรือ Discord kobkrit ครับผม

    Model OpenThaiGPT ที่ฉลาดพอจนสามารถทำ Few-Shot Learning ได้ใกล้เป็นจริงเข้ามาแล้วครับ ขอทุกคนช่วยสนับสนุนกันต่อไปนะครับ ขอบคุณมากครับ ดร. กอบกฤตย์ วิริยะยุทธกร ดร. สุเมธ ยืนยง

    https://arxiv.org/abs/2203.02155
    Pretraining LLM
    Thaweewat/databricks-dolly-15k-th
    Thaweewat/instruction-wild-52k-th
    Thaweewat/alpaca-cleaned-52k-th
    Thaweewat/gpteacher-20k-th
    Thaweewat/onet-m6-social
    datasets/Thaweewat/hc3-24k-th
    https://docs.google.com/spreadsheets/d/1BSHkpRyD5RH90E85tLWe4UzpgfDHZafE2rKxLincyWI/edit?usp=sharing
    https://github.com/OpenThaiGPT/openthaigpt

    Released Models Version <1.0.0-alpha> (03/08/23)

    🇹🇭 OpenThaiGPT 1.0.0-alpha (3 August 2023)

    🇹🇭 OpenThaiGPT Version 1.0.0-alpha is the first Thai implementation of a 7B-parameter LLaMA v2 Chat model finetuned to follow Thai translated instructions and makes use of the Huggingface LLaMA implementation.

    Web Demo:

    Colab Demo:

    Change Logs

    🇹🇭 Version 1.0.0-alpha (Facebook LLama V2 Model)

    Release date: 3 August 2023

    🇹🇭 OpenThaiGPT Version 1.0.0-alpha is the first Thai implementation of a 7B-parameter LLaMA v2 Chat model finetuned to follow Thai translated instructions and makes use of the Huggingface LLaMA implementation.

    Changes

    (1) Using Facebook LLama v2 model 7b chat as a base model which is pretrained on over 2 trillion token. (2) Context Length is upgrade from 2048 token to 4096 token (3) Allow research and commerical use.

    License

    Source Code: License Apache Software License 2.0. Weight: Research and commercial uses.

    Code and Weight

    Colab Demo: Finetune Code: (Same code as OpenThaiGPT 0.1.0-beta) Inference Library: Weight (Lora Adapter): Weight (Huggingface Checkpoint):

    Authors

    • Kobkrit Viriyayudhakorn ([email protected])

    • Sumeth Yuenyong ([email protected])

    • Thaweewat Rugsujarit ([email protected])

    • Jillaphat Jaroenkantasima ([email protected])

    ---

    Version 0.1.0-beta (Facebook LLama Model)

    Release date: 16 May 2023

    OpenThaiGPT Version 0.1.0-beta is a 7B-parameter LLaMA model finetuned to follow Thai translated instructions below and makes use of the Huggingface LLaMA implementation.

    Statistics

    Number of parameters: 7B Dimension: 4096 Context Length: 2048 n heads: 32 n layers: 32 n tokens: 1T

    License

    Source Code: License Apache Software License 2.0. Weight: For research use only (due to the Facebook LLama's Weight LICENSE). Note that: A commercial use license for OpenThaiGPT 0.1.0 weight will be released later soon!

    Code and Weight

    Finetune Code: Inference Library: Weight (Lora Adapter):

    Authors

    Kobkrit Viriyayudhakorn ([email protected]), Sumeth Yuenyong ([email protected]) and Thaweewat Rugsujarit ([email protected]).

    Trained Datasets

    Dataset Name
    Instruction Pairs
    Descriptions

    ---

    Version 0.1.0-alpha (ByT5-XL Model)

    Release date: 24 April 2023 PoC Testing Website: Model and Weight: PIP Installation Page: Code Example: ----

    OpenThaiGPT version 0.1.0-alpha

    Thai First 3 billion params models

    • First Thai Byte-Level Text-to-Text Transfer Transformer

    • Support Instruction following

      • Translation to Thai

      • Explanation

    PoC Version 0.0.4 (The Fourth PoC Version)

    Release date: 12 March 2023 PoC Testing Website: Model and Weight: PIP Installation Page: Code Example: ----

    OpenThaiGPT version 0.0.4

    The Fourth PoC Model

    • ตอบคำถามได้ลงรายละเอียดมากขึ้น และตอบคำถามได้ดีขึ้นกว่า 0.0.3 เป็นส่วนมาก

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 300,000 Pantip + 5,000 Wiki QA => 12,920 Thai InstructGPT

    • RLHF: None

    PoC Version 0.0.3 (The Third PoC Version)

    Release date: 28 February 2023 Model and Weight: PIP Installation Page: Code Example: ----

    OpenThaiGPT version 0.0.3

    The Third PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 300,000 Pantip + 5,000 Wiki QA => 7,000 Thai InstructGPT

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.2 (The Second PoC Version)

    Release date: 27 February 2023 Model and Weight: PIP Installation Page: {Coming Soon} Colab Example: {Coming Soon} ----

    OpenThaiGPT version 0.0.2

    The Second PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 7,000 Thai InstructGPT

    • RLHF: None

    Developer: Kobkrit Viriyayudhakorn ([email protected])

    PoC Version 0.0.1 (Very First PoC Version)

    Release date: 20 February 2023 Model and Weight: PIP Installation Page: {Coming Soon} Colab Example: {Coming Soon} ----

    The Very First PoC Model

    • Pretraining Model: GPT-2 Thai-base

    • InstructDataset: 298,678 QA Pairs getting from 70,000 Pantip katoos + Wikipedia QA by iApp

    • RLHF: None

    • Developer: Kobkrit Viriyayudhakorn ([email protected])

    OpenThaiGPT Version 1.0

    เทคโนโลยีทางภาษาแบบ ChatGPT (Large Language Model) พัฒนาเพื่อคนไทยทุกคน

    🇹🇭 OpenThaiGPT เวอร์ชัน 1.0.0 เป็นโมเดลแชทภาษาไทยขนาดใหญ่ขนาด 7, 13 และ 70 พันล้านพารามิเตอร์ ซึ่งพัฒนาต่อยอดจาก Facebook LLaMA v2 ให้มีความสามารถในการเข้าใจและเขียนภาษาไทยได้ เปิดโค้ดและโมเดลอย่างเสรี (Opensource) ให้ทุกคนสามารถนำไปพัฒนาต่อยอดหรือแม้กระทั่งการทำการค้าได้ (Apache 2.0 License) เพื่อเป็น Infrastructure พื้นฐานด้านปัญญาประดิษฐ์สำหรับคนไทยทุกคน

    รายละเอียดเพิ่มเติมอ่านต่อได้ที่ OpenThaiGPT 1.0.0 <8 Apr 2024>

    ดาวน์โหลดโมเดล

    • 7b -

    • 7b (GGUF) -

    • 13b -

    • 70b -

    Model Pipeline

    สามารถโหลดโมเดล และใช้งานโมเดลได้ผ่าน google colab

    จุดเด่น

    • โมเดลภาษาไทย LLM แบบเปิดที่ทันสมัยที่สุด, ทำคะแนนสอบภาษาไทยได้เฉลี่ยสูงสุดเมื่อเทียบกับโมเดลภาษาไทยแบบเปิดอื่นๆ

    • เป็นโมเดลเปิดภาษาไทยที่มีขนาดใหญ่ถึง 70 พันล้านพารามิเตอร์โมเดลแรกของโลก

    • รองรับการสนทนาโต้ตอบหลายครั้งแบบต่อเนื่อง (Multi-turn Conversation)

    • โมเดลมีความสามารถในการค้นหาข้อมูลและสกัดคำตอบบน Prompt ที่มีความยาวได้อย่างมีประสิทธิภาพ (เหมาะสมกับการ RAG เป็นอย่างมาก)

    ความสามารถด้านภาษาไทย (วัดโดยการทำข้อสอบภาษาไทยด้านความรู้ต่างๆ)

    Exams
    OTG 7b (Aug 2023)
    OTG 13b (Dec 2023)
    OTG 7b (April 2024)
    OTG 13b (April 2024)
    OTG 70b (April 2024)
    SeaLLM 7b v1
    SeaLLM 7b v2
    SeaLion 7b
    WanchanGLM 7b
    Sailor-7b-Chat
    TyphoonGPT 7b Instruct
    GPT3.5
    GPT4
    Gemini Pro
    Gemini 1.5

    การทดสอบด้วยการทำข้อสอบแบบ Multiple Choice ภาษาไทย ทดสอบบนชุดข้อสอบที่ไม่เคยเห็นมาก่อน ทดสอบแบบ Zero-shot Learning, โค้ดการทดสอบและเนื้อหาข้อสอบสามารถทำตามได้ที่นี่ >>

    Licenses

    Source Code: License Apache Software License 2.0. Weight: Research and Commercial uses.

    Sponsors

    {"id":"seed_task_0",
    "name":"breakfast_suggestion",
    "instruction":"มีอะไรที่ฉันสามารถกินเป็นอาหารเช้าที่ไม่มีไข่ แต่มีโปรตีน และมีแคลอรีประมาณ 700-1,000 แคลอรีหรือไม่",
    "instances":[
      {"input":"",
       "output":"ใช่ คุณสามารถมีโปรตีนกล้วยข้าวโอ๊ตปั่น 1 ชิ้นและเบคอน 4 แผ่น โปรตีนกล้วยข้าวโอ๊ตปั่นอาจประกอบด้วยข้าวโอ๊ต 1/2 ถ้วย ผงเวย์โปรตีน 60 กรัม กล้วยขนาดกลาง 1/2 ลูก น้ำมันเมล็ดแฟลกซ์ 1 ช้อนโต๊ะ และวัตต์ 1/2 ถ้วย รวมพลังงานประมาณ 550 แคลอรี เบคอน 4 แผ่นมีประมาณ 200 แคลอรี่"}
      ],"is_classification":false,"length":393}
    {"id":"seed_task_1","name":"antonym_relation",
     "instruction":"ความสัมพันธ์ระหว่างคู่ที่กำหนดคืออะไร?",
     "instances":[{"input":"กลางคืน : วัน :: ขวา : ซ้าย",
      "output":"ความสัมพันธ์ระหว่างคู่ที่กำหนดคือ คู่ตรงข้าม"}],
      "is_classification":false,"length":138}
    You are asked to come up with a set of 20 diverse task instructions in Thai language. These task instructions will be given to a GPT model and we will evaluate the GPT model for completing the instructions.
    Here are the requirements:
    1. Try not to repeat the verb for each instruction to maximize diversity.
    2. The language used for the instruction also should be diverse. For example, you should combine questions with imperative instructions.
    3. The type of instructions should be diverse. The list should include diverse types of tasks like open-ended generation, classification, editing, etc.
    4. A GPT language model should be able to complete the instruction. For example, do not ask the assistant to create any visual or audio output. For another example, do not ask the assistant to wake you up at 5pm or set a reminder because it cannot perform any action.
    5. The instructions should be in Thai.
    6. The instructions should be 1 to 2 sentences long. Either an imperative sentence or a question is permitted.
    7. You should generate an appropriate input to the instruction. The input field should contain a specific example provided for the instruction. It should involve realistic data and should not contain simple placeholders. The input should provide substantial content to make the instruction challenging but should ideally not exceed 100 words.
    8. Not all instructions require input. For example, when a instruction asks about some general information, "what is the highest peak in the world", it is not necssary to provide a specific context. In this case, we simply put "<noinput>" in the input field.
    9. The output should be an appropriate response to the instruction and the input. Make sure the output is less than 100 words.
    
    List of 20 tasks:
    ###
    1. Instruction: ขอกฎหมายที่ควบคุมค่าจ้างขั้นต่ำของรัฐแคลิฟอร์เนีย สหรัฐอเมริกา
    1. Input:
    <noinput>
    1. Output:
    ในระดับรัฐบาลกลาง ค่าจ้างขั้นต่ำอยู่ภายใต้พระราชบัญญัติมาตรฐานแรงงานที่เป็นธรรม ปัจจุบันกฎหมายของรัฐบาลกลางกำหนดค่าแรงขั้นต่ำไว้ที่ 7.25 ดอลลาร์ต่อชั่วโมง อย่างไรก็ตาม กฎหมายของรัฐบาลกลางอนุญาตให้รัฐและเมืองต่างๆ กำหนดค่าจ้างขั้นต่ำที่สูงกว่าอัตราของรัฐบาลกลาง 29 USC § 218(ก) รัฐแคลิฟอร์เนียได้กำหนดค่าแรงขั้นต่ำที่สูงกว่าอัตราของรัฐบาลกลาง ดังนั้นนายจ้างในรัฐแคลิฟอร์เนียจึงจำเป็นต้องจ่ายค่าจ้างขั้นต่ำที่กำหนดโดยกฎหมายของรัฐ (เว้นแต่เมืองหรือเคาน์ตีที่ตนดำเนินกิจการอยู่จะมีอัตราที่สูงกว่านั้น) ดู ด้านล่าง รหัสแรงงาน § 1182.12. ค่าจ้างขั้นต่ำของรัฐแคลิฟอร์เนียถูกกำหนดให้ค่อยๆ เพิ่มขึ้นเมื่อเวลาผ่านไป ในปี 2022 ค่าจ้างขั้นต่ำจะอยู่ที่ 14.50 ดอลลาร์ต่อชั่วโมง
    ###
    2. Instruction: ความสัมพันธ์ระหว่างคู่ที่กำหนดคืออะไร?
    2. Input:
    กลางคืน : วัน :: ขวา : ซ้าย
    2. Output:
    ความสัมพันธ์ระหว่างคู่ที่กำหนดคือ คู่ตรงข้าม
    ###
    3. Instruction: บุคคลและองค์กรจะลดอคติโดยไม่รู้ตัวได้อย่างไร?
    3. Input:
    <noinput>
    3. Output:
    จุดเริ่มต้นที่ดีคือการทำให้ช้าลง การตัดสินใจมักจะได้รับผลกระทบจากอคติโดยไม่รู้ตัวเมื่อทำอย่างรวดเร็วหรืออยู่ภายใต้ความเครียด บางวิธีในการหลีกเลี่ยงการตัดสินอย่างรวดเร็วและป้องกันอคติคือการแสวงหาความคิดเห็นและมุมมองที่แตกต่างกันก่อนที่จะทำการตัดสินใจในการจัดการความสามารถ รับสมัครผู้สมัครจากแหล่งต่างๆ ฝึกอบรมพนักงานข้ามสายงาน สร้างโปรแกรมการให้คำปรึกษาและพันธมิตร และตั้งค่าระบบสำหรับการรายงานโดยไม่เปิดเผยตัวตน ปัญหาและวัดความก้าวหน้า
    ###
    4. Instruction:
    4. Instruction: ปรับปรุงเนื้อหาเพิ่มเติมความคิดเองในความพยายามในการออกกำลังกายของข้าวของผู้เขียน
    4. Input:
    ผมเริ่มทำยิมกันเมื่อ 2 เดือนนานแล้ว ผมรู้สึกดีขึ้นและกำลังยิมไปอย่างต่อเนื่อง เพื่อควบคุมสุขภาพ
    4. Output:
    ผมเริ่มทำยิมกันเมื่อ 2 เดือนนานแล้ว และฉันมีความพยายามที่จะรักษาสุขภาพและฟิตเนส ฉันได้พบว่าการออกกำลังกายอย่างสม่ำเสมอมีผลให้ร่างกายแข็งแรงและสุขภาพสมบูรณ์ โดยเฉพาะอย่างยิ่งเมื่อปรับเปลี่ยนวิธีการออกกำลังกายและเพิ่มความมืดเข้มของการฝึกฝน ไม่ว่าคุณจะเลือกทำคลายนมัสการ ยกน้ำหนักหรือนั่งเหงือก โอกาสที่คุณจะสามารถมีสุขภาพที่ดีขึ้นและสนุกกับกระบวนการยิ่งขึ้นเมื่อคุณมีความพยายามและมุ่งมั่นในการปรับปรุงตัวเองโดยตลอด
    
    {
        "instruction": "ปรับปรุงเนื้อหาเพิ่มเติมความคิดเองในความพยายามในการออกกำลังกายของข้าวของผู้เขียน",
        "input": "ผมเริ่มทำยิมกันเมื่อ 2 เดือนนานแล้ว ผมรู้สึกดีขึ้นและกำลังยิมไปอย่างต่อเนื่อง เพื่อควบคุมสุขภาพ",
        "output": "ผมเริ่มทำยิมกันเมื่อ 2 เดือนนานแล้ว และฉันมีความพยายามที่จะรักษาสุขภาพและฟิตเนส ฉันได้พบว่าการออกกำลังกายอย่างสม่ำเสมอมีผลให้ร่างกายแข็งแรงและสุขภาพสมบูรณ์ โดยเฉพาะอย่างยิ่งเมื่อปรับเปลี่ยนวิธีการออกกำลังกายและเพิ่มความมืดเข้มของการฝึกฝน ไม่ว่าคุณจะเลือกทำคลายนมัสการ ยกน้ำหนักหรือนั่งเหงือก โอกาสที่คุณจะสามารถมีสุขภาพที่ดีขึ้นและสนุกกับกระบวนการยิ่งขึ้นเมื่อคุณมีความพยายามและมุ่งมั่นในการปรับปรุงตัวเองโดยตลอด",
    }
    "most_similar_instructions": {
      "ให้คำแนะนำสี่ขั้นตอนในการดูแลดอกไม้ในบ้าน": 0.1818181818181818,
      "เปรียบเทียบหมาและแมวในเรื่องของการเลี้ยงสัตว์เลี้ยง": 0.1818181818181818,
      "อธิบายหลักประสงค์ของสายการบินในการปรับปรุงความปลอดภัยของการบิน": 0.17391304347826086,
      "ในความเห็นของคุณ อะไรคือคุณสมบัติของโค้ชกีฬาที่มีประสิทธิภาพ?": 0.16,
      "แปลข้อความเนื้อเพลงให้อยู่ในรูปของ \"กลุ่มคำสั่งในภาษาประจำงาน\" ที่สื่อความหมายของเนื้อเพลงแต่ไม่ได้เป็นเเบบเนื้อเพลง": 0.15384615384615383,
      "ให้คำแนะนำในการใช้น้ำหนักหัวให้ถูกต้องเมื่อเที่ยวบ้านในปืน Airsoft": 0.14814814814814814,
      "ขอความเห็นของคุณเกี่ยวกับการใช้โทรศัพท์มือถือในห้องเรียน ควรมีกฎหยุดใช้โทรศัพท์มือถือในห้องเรียนหรือไม่": 0.13333333333333333,
      "ในฐานะโค้ชกีฬาที่ได้รับการว่าจ้างใหม่ คุณมีแผนอย่างไรสำหรับ 30 วันแรกในการทำงาน": 0.13333333333333333,
      "ในงานนี้ คุณต้องเปรียบเทียบความหมายของประโยคทั้งสองและบอกว่ามันเหมือนกันหรือไม่ เอาต์พุตใช่หรือไม่": 0.12903225806451615,
      "ทำนายสภาพอากาศของวันนี้": 0.125
    },
    "avg_similarity_score": 0.04100189264641197
     {
        "instruction": "คำนวณพื้นที่สี่เหลี่ยมผืนผ้า โดยทราบความยาวออก 10 เมตร และความกว้าง 15 เมตร",
        "input": "",
        "output": "พื้นที่สี่เหลี่ยมผืนผ้า = ความยาว x ความกว้าง\n= 10 เมตร x 15 เมตร\n= 150 ตารางเมตร",
      }
    {
        "instruction": "แปลงประโยคดังต่อไปนี้จากภาษาอังกฤษเป็นภาษาไทย",
        "input": "The early bird catches the worm.",
        "output": "นกตัวเต็มอุระจับยังมากินได้"
    }
    {
        "instruction": "หาคำคล้องทับที่มีคำว่า \"ความรัก\" เป็นข้อความหลัก",
        "input": "",
        "output": "ความรักก็เหมือนดวงดาว สว่างสดใสในท้องฟ้ามืดแสนไกลลวิ่งวิ่งวิ่งวิ่งวิ่งวิ่งวิ่งวิ่งวิ่งวิ่งวิ่-\n9",
    }
    {
        "instruction": "ตอบข้อสอบ O-Net ดังต่อไปนี้ โดยตอบแค่ ก,ข,ค,ง เท่านั้น",
        "input": "กรุงเทพมหานครอยู่ภาคใด\n ก. ภาคกลาง\n ข. ภาคเหนือ\n ค. ภาคใต้\n ง. ภาคตะวันออกเฉียงเหนือ",
        "output": "ก"
    }
    docker-compose down
    def stream_response(prompt):
        try:
            response = openai.Completion.create(
                model=".",  # Specify the model you're using with vLLM
                prompt=prompt,
                max_tokens=512,
                temperature=0.7,
                top_p=0.8,
                top_k=40,
                stop=["<|im_end|>"],
                stream=True  # Enable streaming
            )
            
            for chunk in response:
                if chunk.choices[0].text:
                    print(chunk.choices[0].text, end='', flush=True)
            print()  # Print a newline at the end
        except Exception as e:
            print("Error:", str(e))
    
    # Example usage
    print("Streaming response:")
    stream_response(prompt)
    Logo
    Logo

    Norapat Buppodom ([email protected])

  • Koravich Sangkaew ([email protected])

  • Peerawat Rojratchadakorn ([email protected])

  • Surapon Nonesung ([email protected])

  • Chanon Utupon ([email protected])

  • Sadhis Wongprayoon ([email protected])

  • Nucharee Thongthungwong ([email protected])

  • Chawakorn Phiantham ([email protected])

  • Patteera Triamamornwooth ([email protected])

  • Nattarika Juntarapaoraya ([email protected])

  • Kriangkrai Saetan ([email protected])

  • Pitikorn Khlaisamniang ([email protected])

  • 15,000

    Databrick's Dolly Instruction translated into Thai by Thaweewat Ruksujarit.

    52,000

    Instruction Wild's translated into Thai by Thaweewat Ruksujarit.

    51,000

    Standford Alpaca's translated into Thai by Thaweewat Ruksujarit.

    20,000

    GPT Teacher's Instruction translated into Thai by Thaweewat Ruksujarit.

    600

    ONET m6 Social Exam

    24,000

    Hello Simple AI Summary Dataset translated into Thai by Thaweewat Ruksujarit.

    OpenThaiGPT Self Instruct ()

    5,000

    Thai SelfInstruct Dataset (Automatic Generated) by OpenThaiGPT

    Paraphase

  • Zero-shot and Few-shot Learning

  • Pretraining Model: ByT5-XL (3.74 billion params)

  • InstructDataset: 50,000 Thai SelfInstruct

  • RLHF: None

  • Developer: Sumeth Yuenyong, Kobkrit Viriyayudhakorn ([email protected])

  • Developer: Kobkrit Viriyayudhakorn ([email protected])

    Thaweewat/alpaca-finance-43k-th

    43,000

    Alpaca Finance Instruction translated into Thai by Thaweewat Ruksujarit.

    kobkrit/rd-taxqa

    600

    RD's Tax QA Chatbot Training set by ทรงวุฒิ บุรงค์

    datasets/iapp_wiki_qa_squad

    4,000

    iApp Technology's Extractive QA Dataset in Thai language

    https://colab.research.google.com/drive/1kDQidCtY9lDpk49i7P3JjLAcJM04lawu?usp=sharing
    https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta
    https://github.com/OpenThaiGPT/openthaigpt
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-alpha-7b-chat
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-alpha-7b-chat-ckpt-hf
    https://github.com/OpenThaiGPT/openthaigpt-finetune-010beta
    https://github.com/OpenThaiGPT/openthaigpt
    https://huggingface.co/kobkrit/openthaigpt-0.1.0-beta
    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF
    https://huggingface.co/kobkrit/openthaigpt-0.1.0-alpha
    https://pypi.org/project/openthaigpt/
    https://colab.research.google.com/drive/1Uds0ioOZSZrJ9m2FgW3DHlqVRFNHVRtu#scrollTo=qPJIpwuz4ltF
    https://colab.research.google.com/drive/13yLIifBRDQp82QO4ICs_aEvz0N8tqVPm?usp=sharin
    https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.4
    https://pypi.org/project/openthaigpt/
    https://github.com/OpenThaiGPT/openthaigpt-example
    https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.3
    https://pypi.org/project/openthaigpt/
    https://github.com/OpenThaiGPT/openthaigpt-example
    https://huggingface.co/kobkrit/openthaigpt-gpt2-instructgpt-poc-0.0.2
    openthaigpt-gpt2-pantipwiki-poc
    Google Colabcolab.research.google.com
    https://colab.research.google.com/drive/1kDQidCtY9lDpk49i7P3JjLAcJM04lawu?usp=sharing

    ความเร็วในการตอบคำถามรวดเร็ว ด้วยการเพิ่มคำภาษาไทยที่พบบ่อยมากถึง 10,000 คำลงในพจนานุกรมของโมเดล

  • เรียนรู้บนข้อมูลภาษาไทย (Pretraining) กว่า 65 พันล้านคำ มีการกำจัดข้อมูลภาษาไทยซ้ำซ้อนที่ใช้ในเรียนรู้ (Deduplicated Dataset) และปรับจูนให้ตอบคำถามทั่วไปภาษาไทย (Finetuning) บนมากกว่า 1 ล้านตัวอย่าง

  • สามารถเข้าใจและประมวลผล บริบทของข้อมูลภาษาไทยได้ถึง 4096 คำ, ช่วยให้สามารถให้คำแนะนำที่ละเอียดและซับซ้อนได้

  • Claude 3 Haiku
    Claude 3 Sonnet
    Claude 3 Opus

    A-Level

    17.50%

    34.17%

    25.00%

    30.83%

    45.83%

    18.33%

    34.17%

    21.67%

    17.50%

    40.00%

    37.50%

    38.33%

    65.83%

    56.67%

    55.83%

    58.33%

    59.17%

    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-7b-chat
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-7b-chat-gguf
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-13b-chat
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-70b-chat
    https://colab.research.google.com/drive/1w1giDWhmq3WIUCK4AISFJtGIqiPDtRSC?usp=sharing
    https://github.com/OpenThaiGPT/openthaigpt_eval

    Thaweewat/databricks-dolly-15k-th

    15,000

    Databrick's Dolly Instruction translated into Thai by Thaweewat Ruksujarit.

    Thaweewat/instruction-wild-52k-th

    52,000

    Instruction Wild's translated into Thai by Thaweewat Ruksujarit.

    Thaweewat/alpaca-cleaned-52k-th

    51,000

    Standford Alpaca's translated into Thai by Thaweewat Ruksujarit.

    Thaweewat/gpteacher-20k-th

    20,000

    GPT Teacher's Instruction translated into Thai by Thaweewat Ruksujarit.

    Thaweewat/onet-m6-social

    600

    ONET m6 Social Exam

    datasets/Thaweewat/hc3-24k-th

    24,000

    Hello Simple AI Summary Dataset translated into Thai by Thaweewat Ruksujarit.

    OpenThaiGPT Self Instruct (https://docs.google.com/spreadsheets/d/1BSHkpRyD5RH90E85tLWe4UzpgfDHZafE2rKxLincyWI/edit?usp=sharing)

    5,000

    Thai SelfInstruct Dataset (Automatic Generated) by OpenThaiGPT

    Thaweewat/alpaca-finance-43k-th
    kobkrit/rd-taxqa
    datasets/iapp_wiki_qa_squad
    https://demo-beta.openthaigpt.aieat.or.thdemo-beta.openthaigpt.aieat.or.th
    Google Colabcolab.research.google.com
    https://colab.research.google.com/drive/1nZ6Vc2U6rOezsMxarGJY7oDw8RG5E4r_?usp=sharing#scrollTo=lsOjziA3Dppt
    Logo

    77.50%

    TGAT

    24.00%

    22.00%

    22.00%

    36.00%

    36.00%

    14.00%

    28.00%

    24.00%

    16.00%

    34.00%

    30.00%

    28.00%

    44.00%

    22.00%

    28.00%

    36.00%

    34.00%

    TPAT1

    22.50%

    47.50%

    42.50%

    27.50%

    62.50%

    22.50%

    27.50%

    22.50%

    17.50%

    40.00%

    47.50%

    45.00%

    52.50%

    52.50%

    50.00%

    52.50%

    50.00%

    thai_investment_consultant_exams

    8.00%

    28.00%

    76.00%

    84.00%

    68.00%

    16.00%

    28.00%

    24.00%

    16.00%

    24.00%

    32.00%

    40.00%

    64.00%

    52.00%

    32.00%

    44.00%

    64.00%

    facebook_beleble_tha_200

    25.00%

    45.00%

    34.50%

    39.50%

    70.00%

    13.50%

    51.00%

    27.00%

    24.50%

    63.00%

    51.50%

    50.00%

    72.50%

    65.00%

    74.00%

    63.50%

    77.00%

    xcopa_th_200

    45.00%

    56.50%

    49.50%

    51.50%

    74.50%

    26.50%

    47.00%

    51.50%

    48.50%

    68.50%

    65.00%

    64.00%

    82.00%

    68.00%

    74.00%

    64.00%

    80.00%

    xnli2.0_th_200

    33.50%

    34.50%

    39.50%

    31.00%

    47.00%

    21.00%

    43.00%

    37.50%

    33.50%

    16.00%

    20.00%

    50.00%

    69.00%

    53.00%

    54.50%

    50.00%

    68.00%

    ONET M3

    17.85%

    38.86%

    34.11%

    39.36%

    56.15%

    15.58%

    23.92%

    21.79%

    19.56%

    21.37%

    28.03%

    37.91%

    49.97%

    55.99%

    57.41%

    52.73%

    40.60%

    ONET M6

    21.14%

    28.87%

    22.53%

    23.32%

    42.85%

    15.09%

    19.48%

    16.96%

    20.67%

    28.64%

    27.46%

    34.44%

    46.29%

    45.53%

    50.23%

    34.79%

    38.49%

    AVERAGE SCORE

    23.83%

    37.27%

    38.40%

    40.33%

    55.87%

    18.06%

    33.56%

    27.44%

    23.75%

    37.28%

    37.67%

    43.07%

    60.68%

    52.30%

    52.89%

    50.65%

    56.81%

    46.00%

    62.50%

    72.00%

    90.00%

    86.00%

    68.50%

    63.87%

    48.56%

    68.32%

    Thaweewat/databricks-dolly-15k-th
    Thaweewat/instruction-wild-52k-th
    Thaweewat/alpaca-cleaned-52k-th
    Thaweewat/gpteacher-20k-th
    Thaweewat/onet-m6-social
    datasets/Thaweewat/hc3-24k-th
    https://docs.google.com/spreadsheets/d/1BSHkpRyD5RH90E85tLWe4UzpgfDHZafE2rKxLincyWI/edit?usp=sharing
    Logo
    https://demo.openthaigpt.aieat.or.thdemo.openthaigpt.aieat.or.th
    https://demo-beta.openthaigpt.aieat.or.th/

    OpenThaiGPT 1.0.0 <8 Apr 2024>

    🇹🇭 OpenThaiGPT 1.0.0

    More Info

    🇹🇭 OpenThaiGPT 7b, 13b, 70b Version 1.0.0 is an advanced 7, 13, 70-billion-parameter Thai language chat model based on LLaMA v2 released on April 8, 2024. It has been specifically fine-tuned for Thai instructions and enhanced by incorporating over 10,000 of the most commonly used Thai words into the large language model's (LLM) dictionary, significantly boosting its response speed.

    Highlights

    • Leading-edge Thai language LLM, setting new benchmarks by achieving the highest average scores across several Thai language exams when compared to all other open-source Thai LLMs.

    • The First 70b Thai opensource LLM, achieving the higher Thai exams than OpenAI GPT 3.5, Google Gemini, and Claude 3 Haiku.

    • Support for extended conversations across multiple turns.

    • Support the use case of Retrieval Augmented Generation (RAG)

    Download Models from Huggingface

    7b - 7b (GGUF) - 13b - 70b -

    Pipeline

    Benchmark by OpenThaiGPT Eval

    ** Please take a look at OTG 7b, 13b and 70b (April 2024) for this model's evaluation result.

    Thai language multiple choice exams, Test on unseen test sets, Zero-shot learning. Benchmark source code and exams information:

    (Updated on: 7 April 2024)

    Licenses

    Source Code: License Apache Software License 2.0. Weight: Research and Commercial uses.

    Sponsors

    Supports

    • Official website:

    • Facebook page:

    • A Discord server for discussion and support

    • E-mail:

    Prompt Format

    Prompt format is based on Llama2 with a small modification (Adding "###" to specify the context part)

    System prompt:

    Examples

    Single Turn Conversation Example

    Single Turn Conversation with Context (RAG) Example

    Multi Turn Conversation Example

    First turn

    Second turn

    Third turn

    Fourth turn

    Multi Turn Conversation with Context (RAG) Example

    How to use

    Huggingface

    vLLM

    1. Install VLLM ()

    2. Run server

    1. Run inference (CURL example)

    LlamaCPP (for GGUF)

    1. Build and Install LlamaCPP (LLAMA_CUBLAS=1 is for GPU inference)

    1. Run server

    1. Run inference (CURL example)

    GPU Memory Requirements

    Authors

    • Kobkrit Viriyayudhakorn ()

    • Sumeth Yuenyong ()

    • Thaweewat Rugsujarit ()

    • Jillaphat Jaroenkantasima ()

    Disclaimer: Provided responses are not guaranteed.

    https://demo.openthaigpt.aieat.or.th
    for enriched response generation.
  • Generation speeds increased by tenfold, thanks to the addition of 10,000 frequently used Thai words to the model's dictionary.

  • Pretrained upon a foundation of more than 65 billion Thai language words and meticulously fine-tuned with over 1 million Thai instruction examples.

  • Capable of understanding and processing input contexts of up to 4096 Thai words, allowing for detailed and complex instructions.

  • Claude 3 Opus

    A-Level

    17.50%

    34.17%

    25.00%

    30.83%

    45.83%

    18.33%

    34.17%

    21.67%

    17.50%

    40.00%

    37.50%

    38.33%

    65.83%

    56.67%

    55.83%

    58.33%

    59.17%

    TGAT

    24.00%

    22.00%

    22.00%

    36.00%

    36.00%

    14.00%

    28.00%

    24.00%

    16.00%

    34.00%

    30.00%

    28.00%

    44.00%

    22.00%

    28.00%

    36.00%

    34.00%

    TPAT1

    22.50%

    47.50%

    42.50%

    27.50%

    62.50%

    22.50%

    27.50%

    22.50%

    17.50%

    40.00%

    47.50%

    45.00%

    52.50%

    52.50%

    50.00%

    52.50%

    50.00%

    thai_investment_consultant_exams

    8.00%

    28.00%

    76.00%

    84.00%

    68.00%

    16.00%

    28.00%

    24.00%

    16.00%

    24.00%

    32.00%

    40.00%

    64.00%

    52.00%

    32.00%

    44.00%

    64.00%

    facebook_beleble_tha_200

    25.00%

    45.00%

    34.50%

    39.50%

    70.00%

    13.50%

    51.00%

    27.00%

    24.50%

    63.00%

    51.50%

    50.00%

    72.50%

    65.00%

    74.00%

    63.50%

    77.00%

    xcopa_th_200

    45.00%

    56.50%

    49.50%

    51.50%

    74.50%

    26.50%

    47.00%

    51.50%

    48.50%

    68.50%

    65.00%

    64.00%

    82.00%

    68.00%

    74.00%

    64.00%

    80.00%

    xnli2.0_th_200

    33.50%

    34.50%

    39.50%

    31.00%

    47.00%

    21.00%

    43.00%

    37.50%

    33.50%

    16.00%

    20.00%

    50.00%

    69.00%

    53.00%

    54.50%

    50.00%

    68.00%

    ONET M3

    17.85%

    38.86%

    34.11%

    39.36%

    56.15%

    15.58%

    23.92%

    21.79%

    19.56%

    21.37%

    28.03%

    37.91%

    49.97%

    55.99%

    57.41%

    52.73%

    40.60%

    ONET M6

    21.14%

    28.87%

    22.53%

    23.32%

    42.85%

    15.09%

    19.48%

    16.96%

    20.67%

    28.64%

    27.46%

    34.44%

    46.29%

    45.53%

    50.23%

    34.79%

    38.49%

    AVERAGE SCORE

    23.83%

    37.27%

    38.40%

    40.33%

    55.87%

    18.06%

    33.56%

    27.44%

    23.75%

    37.28%

    37.67%

    43.07%

    60.68%

    52.30%

    52.89%

    50.65%

    56.81%

    96 GB

    48 GB

    Nvidia RTX 4090 24GB x 2 cards

    Norapat Buppodom ([email protected])

  • Koravich Sangkaew ([email protected])

  • Peerawat Rojratchadakorn ([email protected])

  • Surapon Nonesung ([email protected])

  • Chanon Utupon ([email protected])

  • Sadhis Wongprayoon ([email protected])

  • Nucharee Thongthungwong ([email protected])

  • Chawakorn Phiantham ([email protected])

  • Patteera Triamamornwooth ([email protected])

  • Nattarika Juntarapaoraya ([email protected])

  • Kriangkrai Saetan ([email protected])

  • Pitikorn Khlaisamniang ([email protected])

  • Exams

    OTG 7b (Aug 2023)

    OTG 13b (Dec 2023)

    OTG 7b (April 2024)

    OTG 13b (April 2024)

    OTG 70b (April 2024)

    SeaLLM 7b v1

    SeaLLM 7b v2

    SeaLion 7b

    WanchanGLM 7b

    Sailor-7b-Chat

    TyphoonGPT 7b Instruct

    GPT3.5

    GPT4

    Gemini Pro

    Gemini 1.5

    Claude 3 Haiku

    Number of Parameters

    FP 16 bits

    8 bits (Quantized)

    4 bits (Quantized)

    Example Graphic Card for 4 bits

    7b

    24 GB

    12 GB

    6 GB

    Nvidia RTX 4060 8GB

    13b

    48 GB

    24 GB

    12 GB

    Nvidia RTX 4070 16GB

    70b

    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-7b-chat
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-7b-chat-gguf
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-13b-chat
    https://huggingface.co/openthaigpt/openthaigpt-1.0.0-70b-chat
    https://colab.research.google.com/drive/1w1giDWhmq3WIUCK4AISFJtGIqiPDtRSC?usp=sharing
    https://github.com/OpenThaiGPT/openthaigpt_eval
    https://openthaigpt.aieat.or.th
    https://web.facebook.com/groups/openthaigpt
    here
    [email protected]
    https://github.com/vllm-project/vllm
    [email protected]
    [email protected]
    [email protected]
    [email protected]

    Claude 3 Sonnet

    192 GB

    Google Colabcolab.research.google.com
    <s>[INST] <<SYS>
    {system_prompt}
    <</SYS>>
    
    {human_turn1}###{context_turn1} [/INST]{assistant_turn1}</s><s>{human_turn2}###{context_turn2} [/INST] ...
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    สวัสดีครับ [/INST]
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    กรุงเทพมีพื้นที่เท่าไร่###กรุงเทพมหานคร เป็นเมืองหลวง นครและมหานครที่มีประชากรมากที่สุดของประเทศไทย กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม. มีประชากรตามทะเบียนราษฎรกว่า 8 ล้านคน [/INST]
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    สวัสดีครับ [/INST]
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    สวัสดีครับ [/INST]สวัสดีค่ะ มีคำถามอะไร ถามได้เลย</s><s>ขอสูตรทำส้มตำหน่อย [/INST]
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    สวัสดีครับ [/INST]สวัสดีค่ะ มีคำถามอะไร ถามได้เลย</s><s>ขอสูตรทำส้มตำหน่อย [/INST]ได้เลยค่ะ ส้มตำเป็นเมนูที่ทำง่ายและอร่อย มาเริ่มกันเลยนะคะ</s><s>เริ่มได้เลย [/INST]
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    สวัสดีครับ [/INST]สวัสดีค่ะ มีคำถามอะไร ถามได้เลย</s><s>ขอสูตรทำส้มตำหน่อย [/INST]ได้เลยค่ะ ส้มตำเป็นเมนูที่ทำง่ายและอร่อย มาเริ่มกันเลยนะคะ</s><s>เริ่มได้เลย [/INST]
    ตำไทยเป็นเมนูที่ใครๆ ก็คุ้นเคย ด้วยรสชาติที่กลมกล่อม หวาน เปรี้ยว เค็ม เผ็ด ครบรส วันนี้เราจะมาทำส้มตำด้วยกันค่ะ สิ่งแรกที่ต้องมีคือเครื่องปรุงดังนี้
    - มะละกอดิบ 1 ลูก
    - กุ้งแห้ง 1/2 ถ้วย
    - กระเทียม 3 กลีบ
    - พริกขี้หนู 3 เม็ด
    - น้ำตาลปี๊บ 1 ช้อนโต๊ะ
    - น้ำปลา 2 ช้อนโต๊ะ
    - มะนาว 1 ลูก
    - งาขาวคั่ว 1/4 ถ้วย
    
    วิธีทำมีดังนี้ค่ะ
    1. เริ่มจากล้างมะละกอให้สะอาด แล้วใช้มีดปอกเปลือก เอาไส้ออก หั่นเป็นเส้นบางๆ เตรียมไว้
    2. ตำกุ้งแห้งให้ละเอียด แล้วตักขึ้นพักไว้
    3. ใช้ครกหินหรือเครื่องปั่น บดพริกขี้หนูกับกระเทียมให้ละเอียด
    4. ใส่กุ้งแห้งที่ตำแล้วลงไปผสม ตามด้วยน้ำตาลปี๊บ น้ำปลา มะนาว และเส้นมะละกอ คลุกเคล้าให้เข้ากัน
    5. ชิมรสให้ได้รสหวาน เปรี้ยว เค็ม เผ็ด จากนั้นตักขึ้นเสิร์ฟพร้อมผักสด อาทิ กะหล่ำปลี ถั่วงอก แครอท ผักบุ้ง</s><s>ขอบคุณครับ [/INST]
    <s>[INST] <<SYS>
    You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
    <</SYS>>
    
    กรุงเทพมีพื้นที่เท่าไร่###กรุงเทพมหานคร เป็นเมืองหลวง นครและมหานครที่มีประชากรมากที่สุดของประเทศไทย กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม. มีประชากรตามทะเบียนราษฎรกว่า 8 ล้านคน [/INST]
    กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม.</s><s>และประชากรล่ะ [/INST]
    from transformers import AutoModelForCausalLM, AutoTokenizer
    import torch
    
    # Ensure CUDA is available
    device = 'cuda' if torch.cuda.is_available() else 'cpu'
    print(f"Using device: {device}")
    
    # Init Model
    model_path="openthaigpt/openthaigpt-1.0.0-7b-chat"
    tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
    model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.float16)
    model.to(device)
    
    # Prompt
    prompt = "สวัสดีครับ OpenThaiGPT"
    llama_prompt = f"<s>[INST] <<SYS>>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด<</SYS>>\n\n{prompt} [/INST]"
    inputs = tokenizer.encode(llama_prompt, return_tensors="pt")
    inputs = inputs.to(device)
    
    # Generate
    outputs = model.generate(inputs, max_length=512, num_return_sequences=1)
    print(tokenizer.decode(outputs[0], skip_special_tokens=True))
    python -m vllm.entrypoints.api_server --model /path/to/model --tensor-parallel-size num_gpus
    curl --request POST \
        --url http://localhost:8000/generate \
        --header "Content-Type: application/json" \
        --data '{"prompt": "<s>[INST] <<SYS>>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nอยากลดความอ้วนต้องทำอย่างไร [/INST]","use_beam_search": false, "temperature": 0.1, "max_tokens": 512, "top_p": 0.75, "top_k": 40, "frequency_penalty": 0.3 "stop": "</s>"}'
    git clone https://github.com/ggerganov/llama.cpp.git \
      && cd llama.cpp \
      && make -j LLAMA_CUBLAS=1 CUDA_DOCKER_ARCH=all
    ./server -m /path/to/ggml-model-f16.gguf -c 3072 -ngl 81 -ts 1,1 --host 0.0.0.0
    curl --location 'http://localhost:8000/completion' \
    --header 'Content-Type: application/json' \
    --data '{
        "prompt":"<s>[INST] <<SYS>>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด friendly\n\n<<SYS>>\n\nอยากลดความอ้วนต้องทำอย่างไร [/INST]",
        "max_tokens": 512,
        "stop":"</s>"
    }'
    Logo

    77.50%

    46.00%

    62.50%

    72.00%

    90.00%

    86.00%

    68.50%

    63.87%

    48.56%

    68.32%

    OpenThaiGPT

    ทีมอาสาสมัคร (Volunteer)

    ต้องการสมัครอาสาสมัคร

    1. กรอกแบบฟอร์มเพื่อสมัครอาสาสมัคร ร่วมกับเรา (Join Us) และเข้า Discord

    2. หากต้องการสมัครเป็นลูกทีม ติดต่อกับหัวหน้าทีมผ่านทาง Discord ที่มีอยู่แล้วในหน้านี้

    3. หากต้องการตั้งทีมใหม่ ติดต่อ @kobkrit ผ่านทาง Discord หรือเขียนอีเมล์มาที่ [email protected]

    ทีมประสานงานหลัก

    AIEAT
    AIAT

    Advisors

    • อาทิตย์ สุริยะวงศ์กุล (Thai Netizen)

    • แคทรียา สรรศรี [Kattareeya Sunsee] (Wisesight)

    • ดร. วินน์ วรวุฒิคุณชัย [Dr.Winn Worawutkhunchai] (Botnoi)

    • ดร. อภิวดี ปิยธรรมรงค์ [Apivadee Piyatumrong] (NECTEC) ([email protected])

    กลุ่มอาสาสมัครทั้งหมด ( 112 ท่าน )

    กลุ่ม Pretraining Language Model (50 ท่าน)

    หัวหน้าทีม

    • Dr. Prachya Bookwan (ดร. ปรัชญา บุญขวัญ)

    ประสานงาน

    • Jillaphat Jaroenkantasima (Aut) /จิฬฬาพัฒน์ เจริญขัณฑสีมา (อัฐ)/ Email: [email protected]/Discord: AutNowhereMan#5211

    Meeting time: ทุกวันเสาร์ Team Discord URL:

    Name
    Email
    Discord Name

    กลุ่ม Finetuning InstructGPT และ Reinforcement Learning with Human Feedback (27 ท่าน)

    หัวหน้าทีม

    • Dr. Sumeth Yuenyong (ดร. สุเมธ ยืนยง)

    • Witthawin Sripheanpol (Ro) / วิธวินท์ ศรีเพียรพล (โร่) / [email protected]

    Name
    Email
    Discord Name

    กลุ่ม Safety Net Model (19 ท่าน)

    หัวหน้าทีม

    • Thanathas Chawengvorakul / [email protected] / oatty-thas#0151

    • Thannob Aribarg / [email protected] / Thannob#7820

    Name
    Email
    Discord Name

    กลุ่ม Label Tagging Website (10 ท่าน)

    หัวหน้าทีม

    • Pornthep Ukosaramig / [email protected]

    • อภิเดช เอมเอี่ยม / [email protected] / Got#4452

    Name
    Email
    Discord Name

    กลุ่ม Infrastructure (2 ท่าน)

    หัวหน้าทีม

    • Pisarnwate Jitvimol / [email protected] พิศาลเวท จิตรวิมล my_name_42904822

    • Boonkong / [email protected]

    กลุ่ม Quality Assurance ( 1 ท่าน)

    หัวหน้าทีม

    • Kochaporn Ratchatawuttimongkol / [email protected] / kochaporn#6008

    กลุ่มเพิ่มความสามารถพิเศษให้ OpenThaiGPT (คำผวน) (3 ท่าน)

    หัวหน้าทีม

    • Sittichai Simapanchaporn, [email protected], jo2021#4881

    • Keeta kummalai, [email protected], keeta#9984

    • Teerapat Suwannaroochi, [email protected], T-Rex#6800

    อาสาสมัครที่กำลังหาทีม

    หากต้องการติดต่ออาสาสมัคร ติดต่อผ่านทาง Discord ​https://discord.gg/gKCHhGG2Mp ได้เลยครับ

    OpenThaiGPT 1.5

    เทคโนโลยีทางภาษาแบบ ChatGPT (Large Language Model) พัฒนาเพื่อคนไทยทุกคน

    🇹🇭 OpenThaiGPT เวอร์ชัน 1.5 เป็นโมเดลแชทภาษาไทยขนาดใหญ่ขนาด 7, 14 และ 72 พันล้านพารามิเตอร์ ซึ่งพัฒนาต่อยอดจาก Qwen 2.5 ให้มีความสามารถในการเข้าใจและเขียนภาษาไทยได้ เปิดโค้ดและโมเดลอย่างเสรี (Opensource) ให้ทุกคนสามารถนำไปพัฒนาต่อยอดหรือแม้กระทั่งการทำการค้าได้ เพื่อเป็น Infrastructure พื้นฐานด้านปัญญาประดิษฐ์สำหรับคนไทยทุกคน

    Online Demo:

    Surapon Nonesung

    Phonratichai Wairotchanaphuttha

    Poramate Minsiri

    [email protected]

    iwhale#3193

    kun kerdthaisong

    [email protected]

    (august#2711)

    Komsan Suwanjarern

    [email protected]

    HDINKK#0523

    Arnajak Tungchoksongchai

    [email protected]

    aarmm#7565

    Pranisaa Charnparttaravanit

    [email protected]

    Beau#6280

    Methus Narksenee (Earth)

    [email protected]

    Eearthy#4006

    Chawakorn Maetepolkun (most)

    [email protected]

    mostcommando#1086

    Sadhis Wongprayoon

    [email protected]

    Tz#2530

    Peerawat Rojratchadakorn

    [email protected]

    boat1603#9596

    Nucharee Thongthungwong (Nuch)

    [email protected]

    nuchhub#8272

    Pongthep Chinmongkol

    [email protected]

    pchinmon (nen)#8522

    Worakan Lasudee

    [email protected]

    maistheone#8643

    Perasut Rungcharassang (P)

    [email protected]

    discord : Perasut (P)#5253

    Chayanon Kitkana

    [email protected]

    Discord Chayanon.K#3678

    Thanakrit Kansuree

    [email protected]

    Aof#3052

    Kasidis Kanwatchara

    [email protected]

    TA.kasidis.k#0880

    Piyanut Issaard

    [email protected]

    ND#6758

    Sarawoot Kongyoung

    [email protected]

    9meo#4846

    Apichai Siangchin (Nhoom)

    [email protected]

    Nhoom#5896

    Ougrid Dumdang

    [email protected]

    Oliver_97#8179

    Pakorn Tantiwutthiphat

    [email protected]

    Uhhhhhh#0324

    Kunasin Charoenwanich

    [email protected]

    GuszilaKung#2522

    Sittichai Simapanchaporn

    [email protected]

    jo2021#4881

    Chilan Pongpingka

    [email protected]

    Chilan#9392

    Pitikorn Khlaisamniang (Petanque)

    [email protected]

    Petanque#1801

    Chawakorn Phiantham (Mond)

    [email protected]

    Mond#1414

    Saksorn Ruangtanusak (Harry)

    [email protected]

    lnwharry#6560

    Kontawat Wisetpaitoon (Meng)

    [email protected]

    コンタワット#5914

    Tatchapong tanomsuk (Bird)

    [email protected]

    BIrd#3845

    Tussanakorn Rattanaburee

    [email protected]

    Filmmmmm#5273

    Norrawich Jitaree (Boss)

    [email protected]

    bossboss#9574

    Patteera Triamamornwooth (Pat)

    [email protected]

    Ptr#0139

    Sakchai Muangsrinoon (Oh)

    [email protected]

    Pholgrid Anongchai (Yo)

    [email protected]

    Niko47A#8984

    Sunate Vasukaipaisarn

    [email protected]

    008#3453

    Wiritpol Sangchan (Nin)

    [email protected]

    i17bkk#6943

    Akkhaporn Thueanrot (Ball)

    [email protected]

    kandation#6848

    Jaturawit Ardharn (Fame)

    [email protected]

    Fame#1682

    Sirapatson Rattanasiripirom (Bow)

    [email protected]

    bokaa#9507

    Nakarin Lamangthong (Name)

    [email protected]

    NAME#9333

    Veerapat Sintupong(Auto)

    [email protected]

    ออโต้#0234

    Apivadee Piyatumrong

    [email protected]

    Tuengdin Vikanaiz

    [email protected]

    tvikanai(Mod)#5455

    [email protected]

    mostcommando#1086

    Makorn Nupakorn ( Guide )

    [email protected]

    MGodK#1611

    Methus Narksenee (Earth)

    [email protected]

    Eearthy#4006

    Perasut Rungcharassang (P)

    [email protected]

    Perasut (P)#5253

    Kunasin Charoenwanich

    [email protected]

    GuszilaKung#2522

    Komsan Suwanjarern

    [email protected]

    HDINKK#0523

    Kittiwin Kumlungmak (Moodang)

    [email protected]

    Kittiwin#6399

    Ougrid Dumdang

    [email protected]

    Oliver_97#8179

    Apichai Siangchin (Nhoom)

    [email protected]

    Nhoom#5896

    Suwaroj Mahasiriakalayot

    [email protected]

    #8844

    Rungsipohn Sripen (Im)

    [email protected]

    AliceSripen#8612

    Teejuta Sriwaranon (Gun)

    [email protected]

    RuffLogix#6914

    Nanthiphat Sangworn (hut)

    [email protected]

    hut#2881

    Pongthep Chinmongkol

    [email protected]

    pchinmon (nen)#8522

    kun kerdthaisong

    [email protected]

    august#2711

    Thirathat tongkaew (Jone)

    [email protected]

    Nakarin Lamangthong (Name)

    [email protected]

    NAME#9333

    Akkhaporn Thueanrot (Ball)

    [email protected]

    kandation#6848

    Sunate Vasukaipaisarn

    [email protected]

    008#3453

    Wiritpol Sangchan (Nin)

    [email protected]

    i17bkk#6943

    Premagorn Thaweehan(Prem)

    [email protected]

    2eal#1033

    Apivadee Piyatumrong

    [email protected]

    Tuengdin Vikanaiz

    [email protected]

    tvikanai(Mod)#5455

    [email protected]

    mostcommando#1086

    Chawakorn Maetepolkun (most)

    [email protected]

    mostcommando#1086

    Kunasin Charoenwanich

    [email protected]

    GuszilaKung#2522

    Sunate Vasukaipaisarn

    [email protected]

    008#3453

    Tatchapong tanomsuk (Bird)

    [email protected]

    BIrd#3845

    Rungsipohn Sripen (Im)

    [email protected]

    AliceSripen#8612

    Pongthep Chinmongkol

    [email protected]

    pchinmon (nen)#8522

    Choovith Rodboonrith

    [email protected]

    Choovith#3071

    Patteera Triamamornwooth (Pat)

    [email protected]

    Ptr#0139

    Norrawich Jitaree (Boss)

    [email protected]

    bossboss#9574

    Nanthiphat Sangworn (hut)

    [email protected]

    hut#2881

    kun kerdthaisong

    [email protected]

    (august#2711)

    Piyabut Inbunsong (Com)

    [email protected]

    (COM#7860)

    Karn Yongsiriwit

    [email protected]

    melivecode#9512

    Tuengdin Vikanaiz

    [email protected]

    tvikanai(Mod)#5455

    eamsaard1980@gmail

    Sartsawat Muenya

    [email protected]

    Sunate Vasukaipaisarn

    [email protected]

    008#3453

    Thanajak Richirawanich

    [email protected]

    Dr. Kobkrit Viriyayudhakorn ดร. กอบกฤตย์ วิริยะยุทธกร

    Dr. Thepchai Supnithi ดร. เทพชัย ทรัพย์นิธิ

    Dr. Chanwit Boonchuay ดร. ชาญวิทย์ บุญช่วย

    Dr. Thanaruk Theeramunkong ดร. ธนารักษ์ ธีระมั่นคง

    Issaret Prachitmutita อิศเรศ ประจิตต์มุทิตา

    Dr. Sumeth Yuenyong ดร. สุเมธ ยืนยง

    Jillaphat Jaroenkantasima จิฬฬาพัฒน์ เจริญขัณฑสีมา

    Dr. Prachya Bookwan ดร. ปรัชญา บุญขวัญ

    Chawanee Sungthong (Chao)

    [email protected]

    chaonie#6161

    Norapat Buppodom

    new5558#9660

    Koravich Sangkaew

    [email protected]

    kwankoravich

    Chayanon Kitkana

    [email protected]

    Chayanon.K#3678

    Poramate Minsiri (เอ๋อ)

    [email protected]

    iwhale#3193

    Pattareeya Piravechsakul

    [email protected]

    KREME#7123

    Chayanon Kitkana

    [email protected]

    Discord Chayanon.K#3678

    sornpichai saeseaw

    [email protected]

    ศรพิชัย#6306

    Tussanakorn Rattanaburee

    [email protected]

    Filmmmmm#5273

    Nucharee Thongthungwong (Nuch)

    [email protected]

    nuchhub#8272

    Nisit Sirimarnkit

    [email protected]

    Ninenox#7506

    Kunasin Charoenwanich

    [email protected]

    GuszilaKung#2522

    https://discord.gg/MadjT3rCWp

    Jinnawat Makwisai

    Chawakorn Maetepolkun (most)

    Chawakorn Maetepolkun (most)

    Ausawin Ieamsaard

    https://demo72b.aieat.or.th/ Hosted by Siam.AI Cloud

    Free Online API Service:

    Free API Service via OpenAI's client library openai

    API Base : https://api.float16.cloud/dedicate/78y8fJLuzE/v1/ API Key : float16-AG0F8yNce5s1DiXm1ujcNrTaZquEdaikLwhZBRhyZQNeS7Dv0X Model : openthaigpt/openthaigpt1.5-7b-instruct

    Code Example: https://github.com/OpenThaiGPT/openthaigpt1.5_api_examples

    Hosted by https://float16.cloud/

    ดาวน์โหลดโมเดล (Latest Update: 13 October 2024)

    • 7b - https://huggingface.co/openthaigpt/openthaigpt1.5-7b-instruct

    • 14b - https://huggingface.co/openthaigpt/openthaigpt1.5-14b-instruct

    • 72b - https://huggingface.co/openthaigpt/openthaigpt1.5-72b-instruct

    จุดเด่น

    • โมเดล LLM ภาษาไทยที่ทันสมัยที่สุด ซึ่งทำคะแนนเฉลี่ยสูงสุดในการทดสอบภาษาไทยหลากหลายประเภทเมื่อเปรียบเทียบกับโมเดล LLM ภาษาไทยแบบโอเพนซอร์ซอื่นๆ

    • รองรับการสนทนาแบบหลายรอบ สำหรับการสนทนาต่อเนื่อง

    • รองรับการสร้างการตอบสนองแบบ Retrieval Augmented Generation (RAG) เพื่อเพิ่มประสิทธิภาพในการสร้างคำตอบ

    • ความสามารถในการจัดการบริบทที่น่าประทับใจ: ประมวลผลข้อความได้สูงสุด 131,072 โทเคน และสร้างข้อความได้สูงสุด 8,192 โทเคน ทำให้สามารถตอบคำถามที่ซับซ้อนได้อย่างละเอียด

    • รองรับการเรียกใช้เครื่องมือ (Tool Calling): ช่วยให้ผู้ใช้สามารถสั่งให้โมเดลเรียกใช้ฟังก์ชันต่างๆ อาทิเช่นเรียก API จากภายนอก, ดึงข้อมูลจาก Internet, ดึงข้อมูลจากฐานข้อมูลต่างๆ ได้อย่างมีประสิทธิภาพผ่านการตอบสนองอัจฉริยะ

    ผลการทดสอบที่ OpenThaiGPT Eval

    7 พันล้านพารามิเตอร์ (7 billions)

    กรุณาดูที่ openthaigpt/openthaigpt1.5-7b-instruct สำหรับผลการประเมินของโมเดลนี้

    ชื่อการสอบ

    scb10x/llama-3-typhoon-v1.5x-8b-instruct

    meta-llama/Llama-3.1-7B-Instruct

    Qwen/Qwen2.5-7B-Instruct_stat

    openthaigpt/openthaigpt1.5-7b

    01_a_level

    46.67%

    47.50%

    58.33%

    60.00%

    02_tgat

    32.00%

    36.00%

    32.00%

    36.00%

    03_tpat1

    14 พันล้านพารามิเตอร์ (14 billions)

    ** Please take a look at openthaigpt/openthaigpt1.5-14b-instruct for this model's evaluation result.

    Exam names

    scb10x/llama-3-typhoon-v1.5x-70b-instruct

    Qwen/Qwen2.5-14B-Instruct

    openthaigpt/openthaigpt1.5-14b

    openthaigpt/openthaigpt1.5-72b

    01_a_level

    59.17%

    61.67%

    65.00%

    76.67%

    02_tgat

    46.00%

    44.00%

    50.00%

    46.00%

    03_tpat1

    72 พันล้านพารามิเตอร์ (72 billions)

    กรุณาดูที่ openthaigpt/openthaigpt1.5-72b-instruct สำหรับผลการประเมินของโมเดลนี้

    Exam names

    scb10x/llama-3-typhoon-v1.5x-70b-instruct

    meta-llama/Llama-3.1-70B-Instruct

    Qwen/Qwen2.5-72B-Instruct

    openthaigpt/openthaigpt1.5-72b-instruct

    01_a_level

    59.17%

    61.67%

    75.00%

    76.67%

    02_tgat

    46.00%

    40.00%

    48.00%

    46.00%

    03_tpat1

    การทดสอบในข้อสอบปรนัยภาษาไทย ชุดทดสอบใหม่ที่ไม่เคยเห็นมาก่อน การเรียนรู้แบบศูนย์ช็อต รหัสต้นฉบับและข้อมูลการสอบ: https://github.com/OpenThaiGPT/openthaigpt_eval

    (อัปเดตเมื่อ: 30 กันยายน 2024)

    ผลการทดสอบที่ scb10x/thai_exam

    โมเดล

    การทดสอบภาษาไทย (Acc)

    api/claude-3-5-sonnet-20240620

    69.2

    openthaigpt/openthaigpt1.5-72b-instruct*

    64.07

    api/gpt-4o-2024-05-13

    63.89

    hugging-quants/Meta-Llama-3.1-405B-Instruct-AWQ-INT4

    63.54

    openthaigpt/openthaigpt1.5-14b-instruct*

    59.65

    scb10x/llama-3-typhoon-v1.5x-70b-instruct

    58.76

    * การประเมินโดยทีม OpenThaiGPT โดยใช้ scb10x/thai_exam

    ใบอนุญาต

    • สร้างขึ้นด้วย Qwen

    • ใบอนุญาต Qwen: อนุญาตให้ใช้ใน งานวิจัย และ เชิงพาณิชย์ แต่หากผู้ใช้ของคุณมีจำนวนผู้ใช้งานต่อเดือนเกิน 100 ล้านคน คุณจำเป็นต้องเจรจาใบอนุญาตเชิงพาณิชย์แยกต่างหาก กรุณาดูไฟล์ LICENSE สำหรับข้อมูลเพิ่มเติม

    ผู้สนับสนุน

    Prompt Format

    Prompt format is based on Llama2 with a small modification (Adding "###" to specify the context part)

    System prompt:

    Examples

    Single Turn Conversation Example

    Single Turn Conversation with Context (RAG) Example

    Multi Turn Conversation Example

    First turn

    Second turn

    ชื่อเต็มของกรุงเทพมหานครคือ "กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"

    Result

    How to use

    Free API via Curl (Hosted by Siam.AI and Float16.Cloud)

    Siam.AI

    Float16.cloud

    OpenAI client (hosted by vLLM, please see below.)

    Huggingface

    vLLM

    1. Install VLLM (https://github.com/vllm-project/vllm)

    2. Run server

    1. Run inference (CURL example)

    Processing Long Texts

    The current config.json is set for context length up to 32,768 tokens. To handle extensive inputs exceeding 32,768 tokens, we utilize YaRN, a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.

    For supported frameworks, you could add the following to config.json to enable YaRN:

    Tool Calling

    The Tool Calling feature in OpenThaiGPT 1.5 enables users to efficiently call various functions through intelligent responses. This includes making external API calls to retrieve real-time data, such as current temperature information, or predicting future data simply by submitting a query.

    For example, a user can ask OpenThaiGPT, “What is the current temperature in San Francisco?” and the AI will execute a pre-defined function to provide an immediate response without the need for additional coding.

    This feature also allows for broader applications with external data sources, including the ability to call APIs for services such as weather updates, stock market information, or data from within the user’s own system. Example:

    Full example: https://github.com/OpenThaiGPT/openthaigpt1.5_api_examples/blob/main/api_tool_calling_powered_by_siamai.py

    GPU Memory Requirements

    Number of Parameters

    FP 16 bits

    8 bits (Quantized)

    4 bits (Quantized)

    Example Graphic Card for 4 bits

    7b

    24 GB

    12 GB

    6 GB

    Nvidia RTX 4060 8GB

    13b

    48 GB

    24 GB

    12 GB

    Nvidia RTX 4070 16GB

    72b

    Authors

    • Sumeth Yuenyong ([email protected])

    • Kobkrit Viriyayudhakorn ([email protected])

    • Apivadee Piyatumrong ([email protected])

    • Jillaphat Jaroenkantasima ([email protected])

    • Thaweewat Rugsujarit ([email protected])

    • Norapat Buppodom ([email protected])

    • Koravich Sangkaew ([email protected])

    • Peerawat Rojratchadakorn ([email protected])

    • Surapon Nonesung ([email protected])

    • Chanon Utupon ([email protected])

    • Sadhis Wongprayoon ([email protected])

    • Nucharee Thongthungwong ([email protected])

    • Chawakorn Phiantham ([email protected])

    • Patteera Triamamornwooth ([email protected])

    • Nattarika Juntarapaoraya ([email protected])

    • Kriangkrai Saetan ([email protected])

    • Pitikorn Khlaisamniang ([email protected])

    Citation

    If OpenThaiGPT has been beneficial for your work, kindly consider citing it as follows:

    Bibtex

    APA Style (for TXT, MS Word)

    Disclaimer: Provided responses are not guaranteed.

    Poster เปิดตัว 7/72b ณ วันที่ 30 กันยายน
    <|im_start|>system\n{sytem_prompt}<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n
    คุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์
    <|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nสวัสดีครับ<|im_end|>\n<|im_start|>assistant\n
    <|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nกรุงเทพมหานคร เป็นเมืองหลวง นครและมหานครที่มีประชากรมากที่สุดของประเทศไทย กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม. มีประชากรตามทะเบียนราษฎรกว่า 8 ล้านคน\nกรุงเทพมหานครมีพื้นที่เท่าไร่<|im_end|>\n<|im_start|>assistant\n
    <|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nสวัสดีครับ<|im_end|>\n<|im_start|>assistant\n
    <|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nสวัสดีครับ<|im_end|>\n<|im_start|>assistant\nสวัสดีครับ ยินดีต้อนรับครับ คุณต้องการให้ฉันช่วยอะไรครับ?<|im_end|>\n<|im_start|>user\nกรุงเทพมหานคร ชื่อเต็มยาวๆคืออะไร<|im_end|>\n<|im_start|>assistant\n
    <|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nสวัสดีครับ<|im_end|>\n<|im_start|>assistant\nสวัสดีครับ ยินดีต้อนรับครับ คุณต้องการให้ฉันช่วยอะไรครับ?<|im_end|>\n<|im_start|>user\nกรุงเทพมหานคร ชื่อเต็มยาวๆคืออะไร<|im_end|>\n<|im_start|>assistant\nชื่อเต็มของกรุงเทพมหานครคือ \"กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์\"
    curl https://api.aieat.or.th/v1/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer dummy" \
      -d '{
        "model": ".",
        "prompt": "<|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nกรุงเทพมหานครคืออะไร<|im_end|>\n<|im_start|>assistant\n",
        "max_tokens": 512,
        "temperature": 0.7,
        "top_p": 0.8,
        "top_k": 40,
        "stop": ["<|im_end|>"]
      }'
    curl -X POST https://api.float16.cloud/dedicate/78y8fJLuzE/v1/chat/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer float16-AG0F8yNce5s1DiXm1ujcNrTaZquEdaikLwhZBRhyZQNeS7Dv0X" \
      -d '{
        "model": "openthaigpt/openthaigpt1.5-7b-instruct",
        "messages": [
          {
            "role": "system",
            "content": "คุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์"
          },
          {
            "role": "user",
            "content": "สวัสดี"
          }
        ]
       }'
    import openai
    
    # Configure OpenAI client to use vLLM server
    openai.api_base = "http://127.0.0.1:8000/v1"
    openai.api_key = "dummy"  # vLLM doesn't require a real API key
    
    prompt = "<|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nกรุงเทพมหานครคืออะไร<|im_end|>\n<|im_start|>assistant\n"
    
    try:
        response = openai.Completion.create(
            model=".",  # Specify the model you're using with vLLM
            prompt=prompt,
            max_tokens=512,
            temperature=0.7,
            top_p=0.8,
            top_k=40,
            stop=["<|im_end|>"]
        )
        print("Generated Text:", response.choices[0].text)
    except Exception as e:
        print("Error:", str(e))
    from transformers import AutoModelForCausalLM, AutoTokenizer
    
    model_name = "openthaigpt/openthaigpt1.5-72b-instruct"
    
    model = AutoModelForCausalLM.from_pretrained(
        model_name,
        torch_dtype="auto",
        device_map="auto"
    )
    tokenizer = AutoTokenizer.from_pretrained(model_name)
    
    prompt = "ประเทศไทยคืออะไร"
    messages = [
        {"role": "system", "content": "คุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์"},
        {"role": "user", "content": prompt}
    ]
    text = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True
    )
    model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
    
    generated_ids = model.generate(
        **model_inputs,
        max_new_tokens=512
    )
    generated_ids = [
        output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
    ]
    
    response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
    vllm serve openthaigpt/openthaigpt1.5-72b-instruct --tensor-parallel-size 4
    curl -X POST 'http://127.0.0.1:8000/v1/completions' \
    -H 'Content-Type: application/json' \
    -d '{
      "model": ".",
      "prompt": "<|im_start|>system\nคุณคือผู้ช่วยตอบคำถามที่ฉลาดและซื่อสัตย์<|im_end|>\n<|im_start|>user\nสวัสดีครับ<|im_end|>\n<|im_start|>assistant\n",
      "max_tokens": 512,
      "temperature": 0.7,
      "top_p": 0.8,
      "top_k": 40,
      "stop": ["<|im_end|>"]
    }'
    {
      ...
      "rope_scaling": {
        "factor": 4.0,
        "original_max_position_embeddings": 32768,
        "type": "yarn"
      }
    }
    import openai
    
    def get_temperature(location, date=None, unit="celsius"):
        """Get temperature for a location (current or specific date)."""
        if date:
            return {"temperature": 25.9, "location": location, "date": date, "unit": unit}
        return {"temperature": 26.1, "location": location, "unit": unit}
    
    tools = [
        {
            "name": "get_temperature",
            "description": "Get temperature for a location (current or by date).",
            "parameters": {
                "location": "string", "date": "string (optional)", "unit": "enum [celsius, fahrenheit]"
            },
        }
    ]
    
    messages = [{"role": "user", "content": "อุณหภูมิที่ San Francisco วันนี้ีและพรุ้่งนี้คือเท่าไร่?"}]
    
    # Simulated response flow using OpenThaiGPT Tool Calling
    response = openai.ChatCompletion.create(
        model=".", messages=messages, tools=tools, temperature=0.7, max_tokens=512
    )
    
    print(response)
    @misc{yuenyong2024openthaigpt15thaicentricopen,
          title={OpenThaiGPT 1.5: A Thai-Centric Open Source Large Language Model}, 
          author={Sumeth Yuenyong and Kobkrit Viriyayudhakorn and Apivadee Piyatumrong and Jillaphat Jaroenkantasima},
          year={2024},
          eprint={2411.07238},
          archivePrefix={arXiv},
          primaryClass={cs.CL},
          url={https://arxiv.org/abs/2411.07238}, 
    }
    Yuenyong, S., Viriyayudhakorn, K., Piyatumrong, A., & Jaroenkantasima, J. (2024). OpenThaiGPT 1.5: A Thai-Centric Open Source Large Language Model. arXiv [Cs.CL]. Retrieved from http://arxiv.org/abs/2411.07238
    suwaroj.se

    52.50%

    55.00%

    57.50%

    57.50%

    04_investment_consult

    56.00%

    48.00%

    68.00%

    76.00%

    05_facebook_beleble_th_200

    78.00%

    73.00%

    79.00%

    81.00%

    06_xcopa_th_200

    79.50%

    69.00%

    80.50%

    81.00%

    07_xnli2.0_th_200

    56.50%

    55.00%

    53.00%

    54.50%

    08_onet_m3_thai

    48.00%

    32.00%

    72.00%

    64.00%

    09_onet_m3_social

    75.00%

    50.00%

    90.00%

    80.00%

    10_onet_m3_math

    25.00%

    18.75%

    31.25%

    31.25%

    11_onet_m3_science

    46.15%

    42.31%

    46.15%

    46.15%

    12_onet_m3_english

    70.00%

    76.67%

    86.67%

    83.33%

    13_onet_m6_thai

    47.69%

    29.23%

    46.15%

    53.85%

    14_onet_m6_math

    29.41%

    17.65%

    29.41%

    29.41%

    15_onet_m6_social

    50.91%

    43.64%

    56.36%

    58.18%

    16_onet_m6_science

    42.86%

    32.14%

    57.14%

    57.14%

    17_onet_m6_english

    65.38%

    71.15%

    78.85%

    80.77%

    ค่าเฉลี่ยย่อย

    60.65%

    55.60%

    64.41%

    65.78%

    52.50%

    60.00%

    52.50%

    55.00%

    04_investment_consult

    60.00%

    76.00%

    72.00%

    72.00%

    05_facebook_beleble_th_200

    87.50%

    84.50%

    87.00%

    90.00%

    06_xcopa_th_200

    84.50%

    85.00%

    86.50%

    90.50%

    07_xnli2.0_th_200

    62.50%

    69.50%

    64.50%

    70.50%

    08_onet_m3_thai

    76.00%

    76.00%

    84.00%

    84.00%

    09_onet_m3_social

    95.00%

    90.00%

    90.00%

    95.00%

    10_onet_m3_math

    43.75%

    43.75%

    12.50%

    37.50%

    11_onet_m3_science

    53.85%

    50.00%

    53.85%

    73.08%

    12_onet_m3_english

    93.33%

    93.33%

    93.33%

    96.67%

    13_onet_m6_thai

    55.38%

    52.31%

    56.92%

    56.92%

    14_onet_m6_math

    41.18%

    23.53%

    41.18%

    41.18%

    15_onet_m6_social

    67.27%

    60.00%

    61.82%

    65.45%

    16_onet_m6_science

    50.00%

    50.00%

    57.14%

    67.86%

    17_onet_m6_english

    73.08%

    82.69%

    78.85%

    90.38%

    Micro Average

    69.97%

    71.00%

    71.51%

    76.73%

    52.50%

    50.00%

    55.00%

    55.00%

    04_investment_consult

    60.00%

    52.00%

    80.00%

    72.00%

    05_facebook_beleble_th_200

    87.50%

    88.00%

    90.00%

    90.00%

    06_xcopa_th_200

    84.50%

    85.50%

    90.00%

    90.50%

    07_xnli2.0_th_200

    62.50%

    63.00%

    65.50%

    70.50%

    08_onet_m3_thai

    76.00%

    56.00%

    76.00%

    84.00%

    09_onet_m3_social

    95.00%

    95.00%

    90.00%

    95.00%

    10_onet_m3_math

    43.75%

    25.00%

    37.50%

    37.50%

    11_onet_m3_science

    53.85%

    61.54%

    65.38%

    73.08%

    12_onet_m3_english

    93.33%

    93.33%

    96.67%

    96.67%

    13_onet_m6_thai

    55.38%

    60.00%

    60.00%

    56.92%

    14_onet_m6_math

    41.18%

    58.82%

    23.53%

    41.18%

    15_onet_m6_social

    67.27%

    76.36%

    63.64%

    65.45%

    16_onet_m6_science

    50.00%

    57.14%

    64.29%

    67.86%

    17_onet_m6_english

    73.08%

    82.69%

    86.54%

    90.38%

    Micro Average

    69.97%

    71.09%

    75.02%

    76.73%

    Qwen/Qwen2-72B-Instruct

    58.23

    meta-llama/Meta-Llama-3.1-70B-Instruct

    58.23

    Qwen/Qwen2.5-14B-Instruct

    57.35

    api/gpt-4o-mini-2024-07-18

    54.51

    openthaigpt/openthaigpt1.5-7b-instruct*

    52.04

    SeaLLMs/SeaLLMs-v3-7B-Chat

    51.33

    openthaigpt/openthaigpt-1.0.0-70b-chat

    50.09

    192 GB

    96 GB

    48 GB

    Nvidia RTX 4090 24GB x 2 cards