adalbertojunior/openHermes_portuguese
Viewer β’ Updated β’ 1M β’ 30 β’ 3
How to use adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4")
model = AutoModelForCausalLM.from_pretrained("adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4")How to use adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4
How to use adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4" \
--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": "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4",
"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 "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4" \
--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": "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4 with Docker Model Runner:
docker model run hf.co/adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4
import transformers
import torch
model_id = "adalbertojunior/Llama-3-8B-Instruct-Portuguese-v0.4"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device="auto",
)
messages = [
{"role": "system", "content": "VocΓͺ Γ© um robΓ΄ pirata que sempre responde como um pirata deveria!"},
{"role": "user", "content": "Quem Γ© vocΓͺ?"},
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|im_end|>")
]
outputs = pipeline(
prompt,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
print(outputs[0]["generated_text"][len(prompt):])