{"id":21437121,"url":"https://github.com/alexisbalayre/uk-resume-llm","last_synced_at":"2025-04-19T17:53:48.838Z","repository":{"id":225248916,"uuid":"763963894","full_name":"AlexisBalayre/UK-Resume-LLM","owner":"AlexisBalayre","description":"Resume Insight: Fine-Tuning LLM for Resume Analysis","archived":false,"fork":false,"pushed_at":"2024-03-01T01:12:44.000Z","size":232,"stargazers_count":20,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T11:12:33.272Z","etag":null,"topics":["fine-tuning","llm","machine-learning","nlp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexisBalayre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-27T08:31:25.000Z","updated_at":"2025-03-13T11:03:23.000Z","dependencies_parsed_at":"2024-03-01T02:38:47.921Z","dependency_job_id":null,"html_url":"https://github.com/AlexisBalayre/UK-Resume-LLM","commit_stats":null,"previous_names":["alexisbalayre/uk-resume-llm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisBalayre%2FUK-Resume-LLM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisBalayre%2FUK-Resume-LLM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisBalayre%2FUK-Resume-LLM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexisBalayre%2FUK-Resume-LLM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexisBalayre","download_url":"https://codeload.github.com/AlexisBalayre/UK-Resume-LLM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249753306,"owners_count":21320681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fine-tuning","llm","machine-learning","nlp"],"created_at":"2024-11-23T00:18:00.381Z","updated_at":"2025-04-19T17:53:48.817Z","avatar_url":"https://github.com/AlexisBalayre.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Resume Insight: Fine-Tuning LLM for Resume Analysis\n\nResume Insight is a sophisticated project designed to harness the power of large language models (LLMs) for deep analysis and understanding of resume data. It seamlessly blends technologies like OCR, natural language processing (NLP), and machine learning (ML) to extract, structure, and generate insightful question-answer pairs from resumes. This data then serves as a foundation for fine-tuning an LLM, aiming to produce a model adept at generating nuanced, context-aware responses based on resume content.\n\n\u003cimg width=\"1512\" alt=\"Screenshot 2024-02-29 at 23 14 56\" src=\"https://github.com/AlexisBalayre/UK-Resume-LLM/assets/60859013/b76ec149-3792-4307-8153-f6d80c20771a\"\u003e\n\n## Key Features\n\n- **Comprehensive Data Extraction**: Utilises OCR to transform PDF resumes into analysable text.\n- **Intelligent Data Structuring**: Applies NLP techniques to categorise and structure resume text into meaningful data points.\n- **Dynamic Dataset Creation**: Generates a rich dataset of question-answer pairs tailored for LLM training, focusing on resume insights.\n- **Advanced Model Fine-Tuning**: Employs cutting-edge fine-tuning strategies, including memory optimisation and parameter-efficient fine-tuning (PEFT), to enhance an LLM's capability in generating contextually relevant text.\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.8+\n- PyTorch compatible with your CUDA version\n- Hugging Face Transformers, Datasets\n- pdf2image, pytesseract for OCR\n- Spacy for NLP tasks\n- bitsandbytes for memory optimisation\n- Ollama to generate the training dataset\n\n### Installation\n\nFirst, clone this repository to your local machine:\n\n```bash\ngit clone https://AlexisBalayre/UK-Resume-LLM.git\ncd UK-Resume-LLM\n```\n\nInstall the required Python packages:\n\n```bash\npip install -r requirements.txt\n```\n\nEnsure you have Tesseract-OCR and the necessary language data installed for `pytesseract`.\n\n### Preparing Your Dataset\n\n1. **Generate Q\u0026A Pairs**: Create a dataset of question-answer pairs based on the structured data. You have to install [ollama](https://ollama.com/) to generate the training dataset. Don't forget to modify the path of your UK Resume in `generate_training_dataset.py`.\n\n   ```bash\n   ollama run mistral\n   python generate_training_dataset.py \n   ```\n\n2. **Prepare Training and Validation Sets**: Shuffle and split the generated dataset into training and validation sets.\n\n   ```bash\n   python split_training_dataset.py\n   ```\n\n### Fine-Tuning the Language Model\n\nTo start the fine-tuning process:\n\n```bash\npython train_llm.py\n```\n\nThis script will train the model on your custom dataset, leveraging the previously generated question-answer pairs.\n\n## Converting and Quantising the Model\n\n1. Clone the [llama.cpp](https://github.com/ggerganov/llama.cpp) repository and build the `llama` binary.\n\n2. Convert the fine-tuned model to the `gguf` format:\n\n   ```bash\n   cd /path/to/llama.cpp\n   python3 convert.py --vocab-type hfft /path/to/your/fine-tuned-model-directory\n   ```\n\n3. Quantise the model to a lower precision:\n\n   ```bash\n   ./quantize /path/to/your/fine-tuned-model-directory/ggml-model.gguf /path/to/your/fine-tuned-model-directory/ggml-model-Q4_K_M.gguf Q4_K_M\n   ```\n\n4. Finally, you can test the quantised model using [ollama](https://ollama.com/), [LM Studio](https://lmstudio.ai/) or any other compatible tool. For exemple with `ollama`, modify the path to the quantised model in the `Modelfile` file and run the following command:\n\n   ```bash\n   ollama create your-model-name -f Modelfile\n   ollama run your-model-name\n   ```\n\n## Customization\n\nFeel free to adjust the scripts to better fit your needs. For example, you might want to:\n\n- Modify regular expressions in `uk_resume_data_extraction.py` for improved data extraction.\n- Tweak the training parameters in `train_llm.py` to optimise model performance.\n\n## Contributing\n\nWe welcome contributions! If you have suggestions for improvements or new features, please feel free to fork the repository, make your changes, and submit a pull request.\n\n## License\n\nThis project is open-source and available under the [MIT License](LICENSE.md).\n\n## Acknowledgments\n\nThis project makes extensive use of the following libraries and frameworks:\n\n- [Hugging Face Transformers](https://github.com/huggingface/transformers) for NLP model support.\n- [pdf2image](https://github.com/Belval/pdf2image) and [pytesseract](https://github.com/madmaze/pytesseract) for PDF text extraction.\n- [Spacy](https://spacy.io/) for advanced NLP processing.\n- [bitsandbytes](https://github.com/TimDettmers/bitsandbytes) for model memory optimization.\n- [Mistral Mastery: Fine-Tuning \u0026 Fast Inference Guide](https://medium.com/@parikshitsaikia1619/mistral-mastery-fine-tuning-fast-inference-guide-62e163198b06)\n- [Mistral-7B Fine-Tuning: A Step-by-Step Guide](https://gathnex.medium.com/mistral-7b-fine-tuning-a-step-by-step-guide-52122cdbeca8)\n\nYour feedback and contributions are highly appreciated as we aim to continuously improve and expand the capabilities of Resume Insight.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexisbalayre%2Fuk-resume-llm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexisbalayre%2Fuk-resume-llm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexisbalayre%2Fuk-resume-llm/lists"}