初始化项目,由ModelHub XC社区提供模型
Model: manucif/latamgpt-1b-sft Source: Original Platform
This commit is contained in:
76
README.md
Normal file
76
README.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
license: llama3.2
|
||||
base_model: meta-llama/Llama-3.2-1B
|
||||
language:
|
||||
- es
|
||||
- pt
|
||||
- en
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
tags:
|
||||
- sft
|
||||
- latam
|
||||
- llama
|
||||
- latam-gpt
|
||||
datasets:
|
||||
- latam-gpt/wikipedia-qa-iberoamerica-clean
|
||||
- latam-gpt/tulu-3-sft-mixture-no-identity-clean
|
||||
- latam-gpt/sft-mcqa-unified-clean
|
||||
- latam-gpt/self-identity-v3-clean
|
||||
- latam-gpt/copuchatV2-clean
|
||||
---
|
||||
|
||||
# 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
|
||||
|
||||
```python
|
||||
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](https://www.llama.com/llama3_2/license/) from the base model.
|
||||
Reference in New Issue
Block a user