Instructions to use SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct") model = AutoModelForCausalLM.from_pretrained("SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct") 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
- vLLM
How to use SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct
- SGLang
How to use SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct 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 "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct" \ --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": "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct", "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 "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct" \ --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": "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct with Docker Model Runner:
docker model run hf.co/SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct
Mistral-7B-v0.1-Italian-LAPT-instruct
The Mistral-7B-v0.1-Adapted collection of large language models (LLMs), is a collection of adapted generative models in 7B (text in/text out), adapted models from Mistral-7B-Base-v0.1.
Mistral-v0.1-Italian-LAPT-instruct is a continually trained and instruction tuned Mistral model.
Model developer: SapienzaNLP, ISTI-CNR, ILC-CNR
Model Architecture: Mistral-7B-v0.1-Adapted is an auto-regressive language model that uses an optimized transformer architecture.
Data used for the adaptation
The Mistral-7B-v0.1-Adapted models are trained on a collection of Italian and English data extracted from CulturaX. The data are extracted to be skewed toward Italian language with a ration of one over four. Extracting the first 9B tokens from Italian part of CulturaX and the first 3B tokens from English part of CulturaX.
Data used for the instruction tuning (SFT)
The data used in the instruction following training procedure:
| Dataset | Language | Instances |
|---|---|---|
| TÜLU-v3 | EN | 940,000 |
| LIMA | IT/EN | 2,000 |
| WildChat-IT | IT | 5,000 |
| TowerBlocks-v0.2 | IT/EN | 7,276 |
| GPT-4o-ITA-Instruct | IT | 15,000 |
| Aya | IT | 700 |
The model is trained for two epoches in the aforementioned data.
Evaluation
Adapted models are evaluated on ITA-Bench.
| Model | MMLU (5-shots) | ARC-C (5-shots) | Hellaswag (0-shots) | IFEval (inst_level) |
|---|---|---|---|---|
| Llama-3.1-SAVA | 56.9 | 42.3 | 58.1 | 62.3 |
| Llama-3.1-LAPT | 58.5 | 47.9 | 62.4 | 67.3 |
| Mistral-0.1-SAVA | 51.5 | 41.6 | 57.5 | 61.7 |
| Mistral-0.1-LAPT | 52.9 | 39.9 | 58.4 | 60.0 |
| Llama-3.1-Original | 47.4 | 43.1 | 57.9 | 66.8 |
| Mistral-0.1-Original | 41.6 | 38.9 | 50.0 | 42.2 |
Use with Transformers
You can run conversational inference using the Transformers pipeline abstraction or by leveraging the Auto classes with the generate() function.
Make sure to update your transformers installation via pip install --upgrade transformers.
import transformers
import torch
model_id = "SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
generator = pipeline(
"text-generation",
model=model_name,
device_map="auto",
dtype=torch.bfloat16
)
conversations.append([
{"role": "system", "content": "Sei un assistente utile, rispondi in modo conciso e coerente."},
{"role": "user", "content": "Cosa si può fare in una bella giornata di sole?"},
])
chat_samples = tokenizer.apply_chat_template(conversations, tokenize=False)
# get number of prompt tokens
prompt_tokens_number = len(tokenizer(chat_samples)["input_ids"])
outputs = generator(
conversations,
max_new_tokens=2048,
eos_token_id=[
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>"),
],
)
Code: https://github.com/SapienzaNLP/sava
Aknowledgement
Thanks to Leonardo Colosi (colosi@diag.uniroma1.it) for helping in instruction tuning phase.
We acknowledge ISCRA for awarding this project access to the LEONARDO supercomputer, owned by the EuroHPC Joint Undertaking, hosted by CINECA (Italy).
Citation
If you use any part of this work, please consider citing the paper as follows:
@misc{moroni2025optimizingllmsitalianreducing,
title={Optimizing LLMs for Italian: Reducing Token Fertility and Enhancing Efficiency Through Vocabulary Adaptation},
author={Luca Moroni and Giovanni Puccetti and Pere-Lluis Huguet Cabot and Andrei Stefan Bejgu and Edoardo Barba and Alessio Miaschi and Felice Dell'Orletta and Andrea Esuli and Roberto Navigli},
year={2025},
eprint={2504.17025},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.17025},
}
- Downloads last month
- 29
docker model run hf.co/SemanticAlignment/Mistral-v0.1-Italian-LAPT-instruct