mchl-labs/stambecco_data_it
Viewer • Updated • 51.7k • 96 • 4
How to use walid-iguider/Minerva-3B-Instruct-v1.0 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="walid-iguider/Minerva-3B-Instruct-v1.0") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("walid-iguider/Minerva-3B-Instruct-v1.0")
model = AutoModelForCausalLM.from_pretrained("walid-iguider/Minerva-3B-Instruct-v1.0")How to use walid-iguider/Minerva-3B-Instruct-v1.0 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "walid-iguider/Minerva-3B-Instruct-v1.0"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "walid-iguider/Minerva-3B-Instruct-v1.0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/walid-iguider/Minerva-3B-Instruct-v1.0
How to use walid-iguider/Minerva-3B-Instruct-v1.0 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "walid-iguider/Minerva-3B-Instruct-v1.0" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "walid-iguider/Minerva-3B-Instruct-v1.0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "walid-iguider/Minerva-3B-Instruct-v1.0" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "walid-iguider/Minerva-3B-Instruct-v1.0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use walid-iguider/Minerva-3B-Instruct-v1.0 with Docker Model Runner:
docker model run hf.co/walid-iguider/Minerva-3B-Instruct-v1.0
Minerva-3B-Instruct-v1.0 is an instruction-tuned version of the Minerva-3B-base-v1.0 model, specifically fine-tuned for understanding and following instructions in Italian.
For a detailed comparison of model performance, check out the Leaderboard for Italian Language Models.
Here's a breakdown of the performance metrics:
| Model/metric | hellaswag_it acc_norm | arc_it acc_norm | m_mmlu_it 5-shot acc | Average |
|---|---|---|---|---|
| Minerva-3B-Instruct-v1.0 | 0.5197 | 0.3157 | 0.2631 | 0.366 |
| Minerva-3B-base-v1.0 | 0.5187 | 0.3045 | 0.2612 | 0.361 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
torch.random.manual_seed(0)
# Run text generation pipeline with our next model
prompt = """Di seguito è riportata un'istruzione che descrive un'attività, abbinata ad un input che fornisce
ulteriore informazione. Scrivi una risposta che soddisfi adeguatamente la richiesta.
### Istruzione:
Suggerisci un'attività serale romantica
### Input:
### Risposta:"""
model_id = "FairMind/Minerva-3B-Instruct-v1.0"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="cuda",
torch_dtype="auto",
trust_remote_code=True,
)
generation_args = {
"max_new_tokens": 500,
"return_full_text": False,
"temperature": 0.0,
"do_sample": False,
}
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
)
output = pipe(prompt, **generation_args)
print(output[0]['generated_text'])