Download src/experts/code/train_lora.py from Shorx/DCA-01: direct link, hf CLI and curl.
- Browser
- Download file 557 Bytes
-
https://huggingface.co/Shorx/DCA-01/resolve/main/src/experts/code/train_lora.py
- Command line
-
hf download hf://Shorx/DCA-01/src/experts/code/train_lora.py
-
curl -L -o train_lora.py https://huggingface.co/Shorx/DCA-01/resolve/main/src/experts/code/train_lora.py
557 Bytes
| import sys | |
| sys.path.append("../common") | |
| from lora_trainer import LoRATrainer | |
| class CodeLoRATrainer(LoRATrainer): | |
| def __init__(self): | |
| super().__init__(module_id="code_expert", base_model="codellama/CodeLlama-7b-Instruct-hf", rank=16) | |
| def custom_loss(self, prediction, target): | |
| return "code_loss: syntax_validity + unit_test_pass_rate" | |
| if __name__ == "__main__": | |
| trainer = CodeLoRATrainer() | |
| report = trainer.train("../../audit_logs/dataset_code_failures.jsonl", "../../../models/code") | |
| print(f"Code LoRA ready: {report}") |