Wrapper of many OS libraries to finetune LLMs and run them in inference mode efficiently.
Project description
giotto-llm
Overview
This repo is a wrapper of many open source packages that are needed to fine-tune LLMs and run them in inference mode effectively.
Important: See the Makefile for useful commands.
Documentation
The online documentation con be found at https://giotto-ai.github.io/giotto-llm/index.html
Setup
Environmental variables
The following environmental variables needs to be set (update credential path below):
GOOGLE_APPLICATION_CREDENTIALS=$HOME/.gloud/giotto-research-admin.json
export MLFLOW_TRACKING_URI=http://cluster-manager:5051
export PATH=$HOME/.local/bin:$PATH
Gitlab ssh-key
Generate key with ssh-keygen, and add to gitlab.
Install and download packages, download data and model
make
Finetune models on multi-gpu
Example of QwenVL-based model:
torchrun --nproc-per-node=gpu -m llm_prompts.finetuning -d re_arc_400x5 --model_id Qwen/Qwen2-VL-2B-Instruct --wrapper QwenVL -o qwenvl --batch_size 1 --gradient_accumulation_steps 16 --quantization 8bit-4 --neftune_noise_alpha 10.0 --num_train_epochs 15 --learning_rate 2e-4
Example of Molmo-based model:
torchrun --nproc-per-node=gpu -m llm_prompts.finetuning -d re_arc_400x5 --model_id allenai/MolmoE-1B-0924 --wrapper Molmo -o molmo --batch_size 1 --gradient_accumulation_steps 16 --quantization 8bit-4 --neftune_noise_alpha 10.0 --num_train_epochs 15 --learning_rate 2e-4
Example of Llama-based models:
torchrun --nproc-per-node=gpu -m llm_prompts.finetuning -d re_arc_400x5 --model_id meta-llama/Llama-3.2-1B-Instruct --wrapper CausalLM -o llama --batch_size 1 --gradient_accumulation_steps 16 --quantization 8bit-4 --neftune_noise_alpha 10.0 --num_train_epochs 15 --learning_rate 2e-4
Example of Qwen-based models:
torchrun --nproc-per-node=gpu -m llm_prompts.finetuning -d re_arc_400x5 --model_id Qwen/Qwen2.5-0.5B --wrapper CausalLM -o qwen --batch_size 1 --gradient_accumulation_steps 16 --quantization 8bit-4 --neftune_noise_alpha 10.0 --num_train_epochs 15 --learning_rate 2e-4
See full list of currently tested models in ./models/.
Validate fine-tuned models
The validation script is single gpu for now, and requires a config entry in ./llm_prompts/validation/__main__.py.
# Only single gpu support for now
CUDA_VISIBLE_DEVICES=0 python -m llm_prompts.validation --dataset_type evaluation --finetuned_model_id <MODEL-ID> --max_num_tasks 400
where <MODEL-ID> is a fine-tuned model defined in the config.
Info
See
- ARC technical guide: specs
--- CPU only ---
4 CPU Cores
30 Gigabytes of RAM
or
--- P100 GPU ---
1 Nvidia Tesla P100 GPI
4 CPU cores
29 Gigabytes of RAM
or
--- T4 2x GPU ---
2 Nvidia Tesla T4 GPUs
4 CPU cores
29 Gigabytes of RAM
- Awesome ARC: lots of information
- Lots of data: millions of synthetically generated tasks
- Unsloth: fine-tune LLMs. Also with quantization.
- Fine-tuning example: how to fine-tune and quantize a LLM model from HugginFace
Notes
- The current version of this repository is using version
4.43.2of thetransformerpackage, which is different from version4.42.3in the Kaggle environemnt. - The current version of this repository is using version
1.7.1of thepolarspackage, which is different from version1.1.0in the Kaggle environemnt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file giotto_llm-0.0.1.tar.gz.
File metadata
- Download URL: giotto_llm-0.0.1.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61eaabcad6cd094128751c31f1d93b6b3128877647b4c1506f149e474868b098
|
|
| MD5 |
7858ad55e9ae4f4038ffe632ee8c611f
|
|
| BLAKE2b-256 |
9362f7a5d1b2fd7bd66128ed01c8dfb50a6dcd37c667f7d36f23fb3c8cdb1fa7
|
Provenance
The following attestation bundles were made for giotto_llm-0.0.1.tar.gz:
Publisher:
python-publish.yml on giotto-ai/giotto-llm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
giotto_llm-0.0.1.tar.gz -
Subject digest:
61eaabcad6cd094128751c31f1d93b6b3128877647b4c1506f149e474868b098 - Sigstore transparency entry: 151052652
- Sigstore integration time:
-
Permalink:
giotto-ai/giotto-llm@3f2f43ff319380e6319534341447dac7b0306200 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/giotto-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3f2f43ff319380e6319534341447dac7b0306200 -
Trigger Event:
release
-
Statement type:
File details
Details for the file giotto_llm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: giotto_llm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fcd0c16c45ccc30f5351fa14ddabb568b896d8290976d0ace2b43e628f4da28
|
|
| MD5 |
1e117f1921091bdf0dc31b533ed76529
|
|
| BLAKE2b-256 |
af45f595c15ad1c888cf1a7ff2e4266dce1b7a78124a225cffba8d068e581c07
|
Provenance
The following attestation bundles were made for giotto_llm-0.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on giotto-ai/giotto-llm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
giotto_llm-0.0.1-py3-none-any.whl -
Subject digest:
3fcd0c16c45ccc30f5351fa14ddabb568b896d8290976d0ace2b43e628f4da28 - Sigstore transparency entry: 151052654
- Sigstore integration time:
-
Permalink:
giotto-ai/giotto-llm@3f2f43ff319380e6319534341447dac7b0306200 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/giotto-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3f2f43ff319380e6319534341447dac7b0306200 -
Trigger Event:
release
-
Statement type: