hathibelagal/clean_latin
Viewer • Updated • 45k • 7
How to use hathibelagal/llama-3.2-latin with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="hathibelagal/llama-3.2-latin") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("hathibelagal/llama-3.2-latin")
model = AutoModelForCausalLM.from_pretrained("hathibelagal/llama-3.2-latin")How to use hathibelagal/llama-3.2-latin with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "hathibelagal/llama-3.2-latin"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "hathibelagal/llama-3.2-latin",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/hathibelagal/llama-3.2-latin
How to use hathibelagal/llama-3.2-latin with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "hathibelagal/llama-3.2-latin" \
--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": "hathibelagal/llama-3.2-latin",
"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 "hathibelagal/llama-3.2-latin" \
--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": "hathibelagal/llama-3.2-latin",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use hathibelagal/llama-3.2-latin with Docker Model Runner:
docker model run hf.co/hathibelagal/llama-3.2-latin
hathibelagal/llama-3.2-latin is a finetuned version of the LLaMA-3.2-3B model, optimized for generating and understanding Latin text across various historical periods, from ancient to modern Neo-Latin.
At this point, it generates content with accurate use of tenses (e.g., pluperfect, subjunctive), cases, and complex structures (e.g., concessive, temporal clauses).
Intended Use
Ethical Considerations
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
repo_id = "hathibelagal/llama-3.2-latin"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForCausalLM.from_pretrained(
repo_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = "Libellus vere aureus"
inputs = tokenizer.encode(prompt, return_tensors="pt")
inputs = inputs.to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=100,
do_sample=True,
top_p=0.9,
temperature=0.6,
repetition_penalty=1.2
)
print(tokenizer.batch_decode(
outputs, skip_special_tokens=True)[0])