Text Generation
Transformers
Safetensors
Spanish
Portuguese
English
llama
sft
latam
latam-gpt
conversational
text-generation-inference
Instructions to use manucif/latamgpt-1b-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use manucif/latamgpt-1b-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="manucif/latamgpt-1b-sft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("manucif/latamgpt-1b-sft") model = AutoModelForCausalLM.from_pretrained("manucif/latamgpt-1b-sft", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use manucif/latamgpt-1b-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "manucif/latamgpt-1b-sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "manucif/latamgpt-1b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/manucif/latamgpt-1b-sft
- SGLang
How to use manucif/latamgpt-1b-sft with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "manucif/latamgpt-1b-sft" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "manucif/latamgpt-1b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "manucif/latamgpt-1b-sft" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "manucif/latamgpt-1b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use manucif/latamgpt-1b-sft with Docker Model Runner:
docker model run hf.co/manucif/latamgpt-1b-sft
latamgpt-1b-sft
Full supervised fine-tune of meta-llama/Llama-3.2-1B on a Latin American instruction mixture, with sequence packing and assistant-only loss masking.
Training data
| Dataset | Role |
|---|---|
latam-gpt/wikipedia-qa-iberoamerica-clean |
Iberoamerican QA |
latam-gpt/tulu-3-sft-mixture-no-identity-clean |
General SFT mixture |
latam-gpt/sft-mcqa-unified-clean |
Multiple-choice QA |
latam-gpt/self-identity-v3-clean |
Self-identity |
latam-gpt/copuchatV2-clean |
Chilean conversational |
After tokenization with the Llama 3 chat template and FFD packing at 4096 tokens (99.16% packing efficiency), the training set is 175,995 packed sequences (~721M tokens) with 119,573 validation examples.
Training setup
- Base model:
meta-llama/Llama-3.2-1B - Method: Full fine-tune (no LoRA)
- Sequence length: 4096, packed with assistant-only loss masking
- Epochs: 2
- Learning rate: 1e-5 (cosine, 3% warmup)
- Batch: 8 per device × 8 grad accumulation × 2 GPUs = 128 effective
- Precision: bf16 + DeepSpeed ZeRO-2 + gradient checkpointing + Flash Attention 2
- Hardware: 2× H100 80GB
- Wall time: ~7.5h
Results
| Metric | Value |
|---|---|
train_loss |
0.8579 |
eval_loss |
0.8910 |
epoch |
2.0 |
train_samples |
175,995 |
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("latam-gpt/latamgpt-1b-sft")
model = AutoModelForCausalLM.from_pretrained("latam-gpt/latamgpt-1b-sft", torch_dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "¿Cuál es la capital de Chile?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=256, do_sample=True, temperature=0.7)
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
License
Inherits the Llama 3.2 Community License from the base model.
- Downloads last month
- 476
Model tree for manucif/latamgpt-1b-sft
Base model
meta-llama/Llama-3.2-1B