This project adapts large language models to domain-specific tasks, leveraging parameter-efficient techniques (LoRA/QLoRA), cloud deployment, and workflow orchestration.
This repository contains code for fine-tuning large language models (LLMs) on custom datasets, handling cloud orchestration, and uploading final models to Hugging Face Hub.
This project aims to fine-tune large language models (LLMs) efficiently for domain-specific tasks, enabling easy deployment via cloud orchestration and interactive demo applications. It demonstrates advanced techniques like parameter-efficient fine-tuning (LoRA/QLoRA) and streamlined workflow automation.
demo_app/app.py to launch the demosrc/model/: Core model training, evaluation, and upload scripts. configs/train_config.yaml: Configuration file for training hyperparameters and paths. models/llm-finetuned/: Output directory where trained model checkpoints and tokenizer files are saved. upload_model.py: Script to upload saved model files to Hugging Face Hub. src/eval/: Evaluation scripts for the trained models.Create and activate your Python environment:
conda create -n llm-finetuning python=3.10 -y
conda activate llm-finetuning
Install required dependencies:
pip install -r requirements.txt
Configure configs/train_config.yaml according to your data paths and training parameters.
Run model training with:
python src/model/train.py
This will:
models/llm-finetuned/.After training completes, upload your model files with:
python upload_model.py
Ensure your upload_model.py points to the correct local folder and Hugging Face repository:
from huggingface_hub import HfApi
api = HfApi() api.upload_folder( repo_id="your-hf-username/your-model-repo", folder_path="models/llm-finetuned", path_in_repo="", repo_type="model" ) print("Upload completed")
This project also includes a Streamlit app for easy demonstration and testing of the fine-tuned model.
Install Streamlit if not installed:
pip install streamlit
Run the app:
streamlit run src/demo_app/app.py
Open the local URL provided by Streamlit in your browser to interact with the model.
To commit and push changes safely when collaborating or syncing with remote:
git add .
git commit -m "Describe your changes"
git pull --rebase
Resolve conflicts if any, then: git push
For stuck rebase issues, clear the rebase state with: For Git Bash or WSL rm -rf .git/rebase-merge
Or in PowerShell Remove-Item -Recurse -Force .git\rebase-merge
If Git complains about index.lock, delete the lock file:
rm -f .git/index.lock
Or in PowerShell:
Remove-Item .git\index.lock
Always commit or stash changes before pulling:
git add .
git commit -m "Save progress"
git pull --rebase
For questions or issues, open an issue in this repository or reach out via email: workwitheesha@gmail.com
checkpoint-1/optimizer.pt 996 MBcheckpoint-2/optimizer.pt 996 MBcheckpoint-3/optimizer.pt 996 MBcheckpoint-1/model.safetensors 498 MBcheckpoint-2/model.safetensors 498 MBcheckpoint-3/model.safetensors 498 MBmodel.safetensors 498 MBcheckpoint-1/rng_state.pth 14.5 kBcheckpoint-2/rng_state.pth 14.5 kBcheckpoint-3/rng_state.pth 14.5 kBcheckpoint-1/training_args.bin 5.7 kBcheckpoint-2/training_args.bin 5.7 kBcheckpoint-3/training_args.bin 5.7 kBtraining_args.bin 5.7 kBcheckpoint-1/scheduler.pt 1.5 kBcheckpoint-2/scheduler.pt 1.5 kBcheckpoint-3/scheduler.pt 1.5 kB