Markdown
π Welcome! This repository is a comprehensive toolkit for working with Large Language Models (LLMs). It covers a wide range of tasks from pre-training and fine-tuning to reinforcement learning and question answering. Whether you're a beginner learning the ropes or an experienced researcher, you'll find valuable code and resources here.
- Advanced Fine-tuning: Explore various fine-tuning techniques, including:
- PEFT (Parameter-Efficient Fine-Tuning):
peft_train.pyfor efficient adaptation of large models. - LoRA (Low-Rank Adaptation):
torch_train_lora.pyfor memory-friendly fine-tuning. - T5-Specific Tuning: A dedicated module for fine-tuning T5 models.
- PEFT (Parameter-Efficient Fine-Tuning):
- Pre-training Capabilities: Scripts and utilities to pre-train your own LLMs from scratch.
- Includes data preprocessing (
preprocess_data.py,preprocess_tokenizer.py) and model training (train.py).
- Includes data preprocessing (
- Reinforcement Learning: Implement cutting-edge RL algorithms for LLM alignment.
- GRPO (Generative Retrospective Policy Optimization):
GRPO_train.pyfor training with RL.
- GRPO (Generative Retrospective Policy Optimization):
- Interactive Chat: A
chat_demo.pyto test and interact with your trained models. - Comprehensive Documentation: Includes detailed notes (
notes/), andreadme.mdfiles in various modules to guide you through the process. - Question Answering: A dedicated module for exploring QA applications with LLMs.
The repository is organized into several modules, each focusing on a specific aspect of the LLM lifecycle:
To get started with this project, you'll need to have Python and PyTorch installed.
-
Clone the repository:
git clone [https://github.com/phbst/LLM.git](https://github.com/phbst/LLM.git) cd LLM -
Install dependencies: It is recommended to create a virtual environment.
pip install -r requirements.txt
(Note: You may need to create a
requirements.txtfile based on the imports in the Python scripts.) -
Explore the modules: Each module has its own
readme.mdwith more specific instructions. Start with the module that interests you the most!
While detailed instructions are available within each module, here are some general examples of how to run the scripts:
-
Fine-tuning with PEFT:
python Finetuning_T5/peft_train.py --config config/t5_config.json
-
Pre-training a new model:
python pretrain/train.py --data_path data/my_dataset.txt --model_config config/model_config.json
-
Training with Reinforcement Learning:
python RL/GRPO_train.py --model my_finetuned_model --reward_fn my_reward_function
-
Chat with your model:
python pretrain/chat_demo.py --model_path pretrain/model/
Contributions are welcome! If you have any suggestions, bug reports, or want to add new features, please open an issue or submit a pull request.
This project is open-sourced under the MIT License. See the LICENSE file for more details.
This README was generated with the help of an AI assistant.