A flexible framework for training, fine-tuning, and evaluating large language models (LLMs) on a variety of datasets, supporting both HuggingFace models and custom PyTorch models.
pip install -r requirements.txt
datasets library.from tokenizer import get_tokenizer
tokenizer = get_tokenizer("RWKV/RWKV7-Goose-World2.8-0.1B-HF")
TextDataset to create a dataset from your files.SFTDataset for chat-style or reasoning data.StreamingTextDataset or StreamingSFTDataset for large datasets.AutoModelForCausalLM.GPT2 (models.GPT2) or implement your own.Config object with your model, dataset, and hyperparameters.PreTrain, KDL, GRPOTrainer) or create your own.from trainer import PreTrain, Config
trainer = PreTrain(run_name="my_run", cfg=configuration)
trainer.fit()
gpu_ids in your config and launching with torch.multiprocessing.To implement a new training objective, subclass Trainer and override the compute_loss(self, batch) method:
class MyCustomTrainer(Trainer):
def compute_loss(self, batch):
# Your custom loss logic here
return loss
TextDataset and PreTrain.SFTDataset and PreTrain.KDL trainer with a teacher model.GRPOTrainer with a custom reward function.models/ directory.trainer/custom_trainers/.create_dataset.py and parse_files.py.MIT License
A flexible framework for training, fine-tuning, and evaluating large language models (LLMs) on a variety of datasets, supporting both HuggingFace models and custom PyTorch models.
pip install -r requirements.txt
datasets library.from tokenizer import get_tokenizer
tokenizer = get_tokenizer("RWKV/RWKV7-Goose-World2.8-0.1B-HF")
TextDataset to create a dataset from your files.SFTDataset for chat-style or reasoning data.StreamingTextDataset or StreamingSFTDataset for large datasets.AutoModelForCausalLM.GPT2 (models.GPT2) or implement your own.Config object with your model, dataset, and hyperparameters.PreTrain, KDL, GRPOTrainer) or create your own.from trainer import PreTrain, Config
trainer = PreTrain(run_name="my_run", cfg=configuration)
trainer.fit()
gpu_ids in your config and launching with torch.multiprocessing.To implement a new training objective, subclass Trainer and override the compute_loss(self, batch) method:
class MyCustomTrainer(Trainer):
def compute_loss(self, batch):
# Your custom loss logic here
return loss
TextDataset and PreTrain.SFTDataset and PreTrain.KDL trainer with a teacher model.GRPOTrainer with a custom reward function.models/ directory.trainer/custom_trainers/.create_dataset.py and parse_files.py.MIT License