Italian LLMs
Collection
3 items • Updated
How to use ludocomito/Minerva-MoE-3x3B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ludocomito/Minerva-MoE-3x3B") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ludocomito/Minerva-MoE-3x3B")
model = AutoModelForCausalLM.from_pretrained("ludocomito/Minerva-MoE-3x3B")How to use ludocomito/Minerva-MoE-3x3B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ludocomito/Minerva-MoE-3x3B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ludocomito/Minerva-MoE-3x3B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ludocomito/Minerva-MoE-3x3B
How to use ludocomito/Minerva-MoE-3x3B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ludocomito/Minerva-MoE-3x3B" \
--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": "ludocomito/Minerva-MoE-3x3B",
"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 "ludocomito/Minerva-MoE-3x3B" \
--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": "ludocomito/Minerva-MoE-3x3B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ludocomito/Minerva-MoE-3x3B with Docker Model Runner:
docker model run hf.co/ludocomito/Minerva-MoE-3x3B
Minerva-MoE-3x3B is a Mixture of Experts (MoE) made with the following models using LazyMergekit:
base_model: sapienzanlp/Minerva-3B-base-v1.0
experts:
- source_model: sapienzanlp/Minerva-3B-base-v1.0
positive_prompts:
- "ciao"
- "chat"
- "parlare"
- source_model: DeepMount00/Minerva-3B-base-RAG
positive_prompts:
- "rispondi a domande"
- "cosa è"
- "chi è"
- "dove è"
- "come si"
- "spiegami"
- "definisci"
- source_model: FairMind/Minerva-3B-Instruct-v1.0
positive_prompts:
- "istruzione"
- "input"
- "risposta"
- "scrivi"
- "sequenza"
- "istruzioni"
dtype: bfloat16
!pip install -qU transformers bitsandbytes accelerate
from transformers import AutoTokenizer
import transformers
import torch
model = "ludocomito/Minerva-MoE-3x3B"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
)
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])