legacy-datasets/mc4
Updated • 2.37k • 153
How to use thiagolaitz/opt-125m-pt-finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="thiagolaitz/opt-125m-pt-finetuned") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("thiagolaitz/opt-125m-pt-finetuned")
model = AutoModelForCausalLM.from_pretrained("thiagolaitz/opt-125m-pt-finetuned")How to use thiagolaitz/opt-125m-pt-finetuned with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "thiagolaitz/opt-125m-pt-finetuned"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "thiagolaitz/opt-125m-pt-finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/thiagolaitz/opt-125m-pt-finetuned
How to use thiagolaitz/opt-125m-pt-finetuned with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "thiagolaitz/opt-125m-pt-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": "thiagolaitz/opt-125m-pt-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 "thiagolaitz/opt-125m-pt-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": "thiagolaitz/opt-125m-pt-finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use thiagolaitz/opt-125m-pt-finetuned with Docker Model Runner:
docker model run hf.co/thiagolaitz/opt-125m-pt-finetuned
This model is a Portuguese fine-tuned version of the facebook/opt-125m. It has undergone additional causal language modeling pre-training with a context size of 512, using an extra 300 million tokens in Portuguese (sampled from mc4). The Wandb report is publicly available at here. The code for training using Colab pro (A100 - 40GB) can be found here. The total cost for training this model was R$17.40 or $3.37 USD (as of March 2023).
Deterministic use:
from transformers import pipeline
generator = pipeline('text-generation', model="thiagolaitz/opt-125m-pt-finetuned", max_length=30)
generator("Eles brincaram o dia inteiro sob o sol quente, mas")
# Output: Eles brincaram o dia inteiro sob o sol quente, mas não se deixaram levar pelo sol.
Top-k sampling:
from transformers import pipeline
generator = pipeline('text-generation', model="thiagolaitz/opt-125m-pt-finetuned", do_sample=True, max_length=30)
generator("Eles brincaram o dia inteiro sob o sol quente, mas")