{"id":28138917,"url":"https://github.com/albedim/nlp-face-tuning","last_synced_at":"2025-05-14T17:18:30.838Z","repository":{"id":286780743,"uuid":"962273075","full_name":"albedim/nlp-face-tuning","owner":"albedim","description":"Simple repository to get started with fine-tuning and ML models. You can download pre-trained models, fine-tune and test them very easily","archived":false,"fork":false,"pushed_at":"2025-04-30T12:17:46.000Z","size":325,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T13:48:47.470Z","etag":null,"topics":["ai","fine-tuning","machine-learning","ml-models"],"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/albedim.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-07T23:03:09.000Z","updated_at":"2025-04-30T12:19:56.000Z","dependencies_parsed_at":"2025-04-08T10:35:41.515Z","dependency_job_id":"53f31d50-f7e9-4b6c-aaf3-d3c952469c24","html_url":"https://github.com/albedim/nlp-face-tuning","commit_stats":null,"previous_names":["albedim/nlp-md","albedim/nlp-face-tuning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albedim%2Fnlp-face-tuning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albedim%2Fnlp-face-tuning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albedim%2Fnlp-face-tuning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albedim%2Fnlp-face-tuning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albedim","download_url":"https://codeload.github.com/albedim/nlp-face-tuning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190412,"owners_count":22029639,"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":["ai","fine-tuning","machine-learning","ml-models"],"created_at":"2025-05-14T17:15:27.099Z","updated_at":"2025-05-14T17:18:30.832Z","avatar_url":"https://github.com/albedim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# !!! DISCLAIMER !!!\nThe repository is still under development, so in case of errors, it is recommended to report them in the issues section, hoping that someone will come and make a pull request.\nThe training part is currently very rough: some important parameters for training are not entered for each training session in the command line when the file is launched, but are instead set statically in the code.\nExperiment, if there are parameters that need to be set before each training and therefore need to be defined when starting the training from the command line, please create an issue and pull request, thanks.\n\n## Install dependencies:\n```bash \npip install -r requirements.txt\n```\n# !!! This repository allows the launch and training of a model using the GPU, it is necessary to download CUDA 12.6 !!!\nLink to install CUDA:\nhttps://developer.nvidia.com/cuda-12-6-0-download-archive\n\n\n## Install the pre-trained model:\nNOTE:\nThe model can be changed but it is not recommended as it has only been tested with gemma-2-2b-it:\n```bash\nhuggingface-cli download google/gemma-2-2b-it  --local-dir ./models/base/gemma-2-2b-it\n```\n\n---------------------------------------------------------------\n\n## Dataset:\nProvide a txt format file in the /dataset folder with the name \"raw_dataset.txt\", it should contain examples of responses (After each response it should go to a new line) and run dataset_generator.py.\nA file will be generated inside the /dataset folder called \"fine_tune_dataset.jsonl\", which will be the one to use for training.\n\n## Training\nThe model can be fine-tuned using this command:\n```bash\npython fine_tune.py \u003cmodel_path\u003e \u003cfine_tuned_model_name\u003e \u003cdataset_name\u003e \u003cepochs\u003e\n```\n1. \u003c model_path \u003e\nEX: If you want to train the default downloaded model ((gemma-2-2b-it)) and ALL the steps written previously have been executed:\nFor \u003cmodel_path\u003e enter: models/base/gemma-2-2b-it\n2. \u003c fine_tuned_model_name \u003e\nEnter the name to give to the model after fine-tuning, it will be saved in the following path:\nmodels/finetuned/*\n3. \u003c dataset_name \u003e\nProvide the name of the dataset to use, namely the one generated previously (fine_tune_dataset.jsonl)\n4. \u003c epochs \u003e\nNumber of epochs to use in training (int)\n\n### After each training, in the path of the fine-tuned model (models/finetuned/{MODEL_NAME}) you will find a file called benchmarks.png, it is a graph that shows the trend of the loss as a function of the interactions.\n\n## How to run models:\nIn order to run a model, you can use this command:\n```bash\npython run_model.py \u003cmodel_path\u003e [max_tokens]\n```\n1. \u003c model_path \u003e\nAll the downloaded models are located in models/base/*.\u003cbr\u003e\nES: If you want to run a pre-trained model ((gemma-2-2b-it)) and ALL the steps written previously have been executed:\nFor \u003cmodel_path\u003e enter models/base/gemma-2-2b-it\u003cbr\u003e\nES: If you want to run a fine-tuned model and ALL the steps written previously have been executed:\nFor \u003cmodel_path\u003e enter models/finetuned/{MODEL_NAME}\n2. \u003c max_tokens \u003e\nParameter that determines the maximum length of tokens that can be generated by a model's responses\n\n### The model will be launched and will respond to the prompts in the following file \"test/questions.txt\"\n### The responses are saved respectively\n1. \"test/base/%Y-%m-%d_%H-%M-%S.json\" if launching a base model.\n2. \"test/finetuned/%Y-%m-%d_%H-%M-%S.json\" if launching a fine-tuned model.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbedim%2Fnlp-face-tuning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbedim%2Fnlp-face-tuning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbedim%2Fnlp-face-tuning/lists"}