สร้างโมเดลภาษาใหญ่จากศูนย์Building a Large Language Model from Scratch
สร้างโมเดล LLM ที่คล้าย ChatGPT ด้วย PyTorch ทีละขั้นตอน
Implementing a ChatGPT-like LLM in PyTorch step by step.
ไว้ทำอะไร
โปรเจ็กต์นี้ออกแบบมาเพื่อช่วยให้นักพัฒนาสามารถสร้างและเรียนรู้การพัฒนาโมเดลภาษาใหญ่ (LLM) ตั้งแต่ขั้นพื้นฐาน โดยเริ่มตั้งแต่อิมพลีเมนต์ฟังก์ชันการทำงาน LLM อย่างการทำ Pretraining และ Finetuning โมเดลที่มีอยู่แล้ว
ทำงานอย่างไร
โค้ดใน repository นี้แสดงให้เห็นถึงขั้นตอนตั้งแต่การเตรียมข้อมูล การสร้าง tokenizers ไปจนถึงการใช้งาน Attention Mechanisms ใน PyTorch หลังจากนั้นผู้ใช้สามารถใช้ฟังก์ชันที่มีเพื่อฝึกฝนโมเดลผ่านการเข้ารหัสข้อมูล และประยุกต์ระบบด้วยการทำ Finetuning โมเดลให้เหมาะสมกับชุดข้อมูลอื่นๆ โค้ดยังกล่าวถึงเทคนิคต่างๆ เช่น Multi-head Self-Attention
โครงสร้างโค้ด
- .github/workflows — การตั้งค่า CI
- ch01/README.md — แนะนำ LLMs
- ch02/01_main-chapter-code — การทำงานกับข้อมูลข้อความ
- ch03/01_main-chapter-code — การโค้ด Attention Mechanisms
- ch04/01_main-chapter-code — สร้างโมเดล GPT
- ch05/01_main-chapter-code — การฝึกซ้อมข้อมูลที่ไม่ได้ติดป้าย
- ch06/01_main-chapter-code — Finetuning สำหรับประเภทข้อความ
- requirements.txt — รายการ dependencies
- pyproject.toml — การตั้งค่าโปรเจ็กต์
เริ่มใช้งาน
git clone --depth 1 https://github.com/rasbt/LLMs-from-scratch.git
เหมาะกับงานแบบไหน
- การศึกษาและวิจัยเกี่ยวกับ LLM
- การสร้างโมเดลภาษาขั้นพื้นฐานสำหรับการทดลอง
ข้อควรรู้
- ไม่มีข้อมูลเกี่ยวกับ license
- พัฒนาบน PyTorch สำหรับ Python >= 3.10 และ < 3.15
What it is for
The project is designed to help developers build and learn how to develop large language models (LLMs) from scratch. It involves implementing key LLM functionalities like pretraining and finetuning existing models.
How it works
The code in this repository illustrates the steps from data preparation, building tokenizers, to employing Attention Mechanisms in PyTorch. Users can utilize provided functions to train models via encoding data and adapt the system by finetuning the model with different datasets. The code also discusses techniques such as Multi-head Self-Attention.
Code structure
- .github/workflows — CI setup
- ch01/README.md — Introduction to LLMs
- ch02/01_main-chapter-code — Working with text data
- ch03/01_main-chapter-code — Coding attention mechanisms
- ch04/01_main-chapter-code — Implementing a GPT model
- ch05/01_main-chapter-code — Pretraining on unlabeled data
- ch06/01_main-chapter-code — Finetuning for text classification
- requirements.txt — Dependencies list
- pyproject.toml — Project configuration
Getting started
git clone --depth 1 https://github.com/rasbt/LLMs-from-scratch.git
Good fit for
- Educational and research purposes on LLMs
- Building basic language models for experimentation
Things to know
- No license information available
- Developed using PyTorch for Python >= 3.10 and < 3.15
บทวิเคราะห์นี้สร้างจาก README และโค้ดของ repo โดย AI ของ Oneable — ตรวจสอบ license และเอกสารต้นทางก่อนนำไปใช้งานจริงThis breakdown was generated from the repository's README and code by Oneable's AI — check the license and upstream docs before using it in production.