legacy-datasets/mc4
Updated • 2.03k • 153
How to use Mirelle/opt-125M-pt-br-finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Mirelle/opt-125M-pt-br-finetuned") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Mirelle/opt-125M-pt-br-finetuned")
model = AutoModelForCausalLM.from_pretrained("Mirelle/opt-125M-pt-br-finetuned")How to use Mirelle/opt-125M-pt-br-finetuned with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Mirelle/opt-125M-pt-br-finetuned"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Mirelle/opt-125M-pt-br-finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Mirelle/opt-125M-pt-br-finetuned
How to use Mirelle/opt-125M-pt-br-finetuned with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Mirelle/opt-125M-pt-br-finetuned" \
--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": "Mirelle/opt-125M-pt-br-finetuned",
"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 "Mirelle/opt-125M-pt-br-finetuned" \
--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": "Mirelle/opt-125M-pt-br-finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Mirelle/opt-125M-pt-br-finetuned with Docker Model Runner:
docker model run hf.co/Mirelle/opt-125M-pt-br-finetuned
Fine-tuning the OPT-125M model on a reduced corpus of mc4-Portuguese with approximately 300M tokens.
With an A100 with 40GB of RAM, the training took around 3 hours
Perplexity: 9.4
from transformers import pipeline
generator = pipeline('text-generation', model='Mirelle/opt-125M-pt-br-finetuned', max_length=100, do_sample=True)
generator("Em uma bela manhã de")