Instructions to use diegobit/llama-3-8b-ita-4k-orpo-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use diegobit/llama-3-8b-ita-4k-orpo-v3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="diegobit/llama-3-8b-ita-4k-orpo-v3") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("diegobit/llama-3-8b-ita-4k-orpo-v3") model = AutoModelForMultimodalLM.from_pretrained("diegobit/llama-3-8b-ita-4k-orpo-v3") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use diegobit/llama-3-8b-ita-4k-orpo-v3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "diegobit/llama-3-8b-ita-4k-orpo-v3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diegobit/llama-3-8b-ita-4k-orpo-v3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/diegobit/llama-3-8b-ita-4k-orpo-v3
- SGLang
How to use diegobit/llama-3-8b-ita-4k-orpo-v3 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "diegobit/llama-3-8b-ita-4k-orpo-v3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diegobit/llama-3-8b-ita-4k-orpo-v3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "diegobit/llama-3-8b-ita-4k-orpo-v3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "diegobit/llama-3-8b-ita-4k-orpo-v3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use diegobit/llama-3-8b-ita-4k-orpo-v3 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for diegobit/llama-3-8b-ita-4k-orpo-v3 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for diegobit/llama-3-8b-ita-4k-orpo-v3 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for diegobit/llama-3-8b-ita-4k-orpo-v3 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="diegobit/llama-3-8b-ita-4k-orpo-v3", max_seq_length=2048, ) - Docker Model Runner
How to use diegobit/llama-3-8b-ita-4k-orpo-v3 with Docker Model Runner:
docker model run hf.co/diegobit/llama-3-8b-ita-4k-orpo-v3
Model Card for Model ID
This is llama-3-8b ORPO finetuning for the italian language over a concatenation of two datasets:
The other two differences with diegobit/llama-3-8b-Instruct-bnb-4bit-ita-orpo are:
- the starting model, not instruct,
astronomer/Llama-3-8B-Special-Tokens-Adjustedinstead ofunsloth/llama-3-8b-Instruct-bnb-4bit - no loading in 4bits
- given the increased need of GPU memory, the sequence max length used for finetuning is 4096
Model Details
Model Description
- Developed by: Diego Giorgini
- Funded by: AI Technologies SRL - www.aitechnologies.it
- Language(s) (NLP): Italian
- License: llama3
- Finetuned from model: astronomer/Llama-3-8B-Special-Tokens-Adjusted
Training Details
Environment
unsloth: 2024.5
torch: 2.2
Training Data
mii-community/ultrafeedback-preferences-translated-itais a selection of 55k rows of the ultrafeedback dataset, translated into italian with argotranslate.efederici/alpaca-vs-alpaca-orpo-dpo: The Alpaca vs. Alpaca dataset is a curated blend of the Alpaca dataset and the Alpaca GPT-4 dataset, both available on HuggingFace Datasets. It uses the standard GPT dataset as the 'rejected' answer, steering the model towards the GPT-4 answer, which is considered as the 'chosen' one.
Training Procedure
Preprocessing [optional]
No preprocessing has been performed, except for formatting with the llama3 chat_template from unsloth:
tokenizer = get_chat_template(tokenizer, chat_template = "llama-3")
Training Hyperparameters
Training regime: bf16
Model loading parameters:
max_seq_length = 4096
dtype = None
load_in_4bit = False
- PEFT parameters:
r = 64
lora_alpha = 64
lora_dropout = 0
bias = "none"
random_state = 3407
use_rslora = False
loftq_config = None
- ORPOConfig parameters:
max_length = 4096
max_prompt_length = max_seq_length//2
max_completion_length = max_seq_length//2
warmup_ratio = 0.1
weight_decay = 0.01
per_device_train_batch_size = 1
gradient_accumulation_steps = 16
learning_rate=8e-6
beta = 0.1
optim = "paged_adamw_8bit"
lr_scheduler_type = "linear"
num_train_epochs = 1
Speeds, Sizes, Times
19h on an A100-40GB
Model Card Contact
- Downloads last month
- 2