Text Generation
Transformers
Safetensors
Portuguese
qwen3
text-generation-inference
conversational
Eval Results (legacy)
Instructions to use Polygl0t/Tucano2-qwen-1.5B-Think with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Polygl0t/Tucano2-qwen-1.5B-Think with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Polygl0t/Tucano2-qwen-1.5B-Think") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Polygl0t/Tucano2-qwen-1.5B-Think") model = AutoModelForCausalLM.from_pretrained("Polygl0t/Tucano2-qwen-1.5B-Think", 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Polygl0t/Tucano2-qwen-1.5B-Think with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Polygl0t/Tucano2-qwen-1.5B-Think" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Polygl0t/Tucano2-qwen-1.5B-Think", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Polygl0t/Tucano2-qwen-1.5B-Think
- SGLang
How to use Polygl0t/Tucano2-qwen-1.5B-Think 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 "Polygl0t/Tucano2-qwen-1.5B-Think" \ --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": "Polygl0t/Tucano2-qwen-1.5B-Think", "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 "Polygl0t/Tucano2-qwen-1.5B-Think" \ --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": "Polygl0t/Tucano2-qwen-1.5B-Think", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Polygl0t/Tucano2-qwen-1.5B-Think with Docker Model Runner:
docker model run hf.co/Polygl0t/Tucano2-qwen-1.5B-Think
Upload training_config_apo.yaml with huggingface_hub
Browse files- training_config_apo.yaml +98 -0
training_config_apo.yaml
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Directory settings
|
| 2 |
+
checkpoint_dir: "/polyglot/portuguese/checkpoints/models/Tucano2-qwen-1.5B-Think"
|
| 3 |
+
train_dataset_dir:
|
| 4 |
+
# Total: 13,649 samples (x5 epochs)
|
| 5 |
+
# Harmfull samples (with reasoning): 4,008 samples
|
| 6 |
+
- /polyglot/portuguese/gigaverbo-v2-dpo/harmfull-reasoning
|
| 7 |
+
# Harmless samples (with reasoning): 9,641 samples
|
| 8 |
+
- /polyglot/portuguese/gigaverbo-v2-dpo/harmless-reasoning
|
| 9 |
+
val_dataset_dir: null
|
| 10 |
+
dataset_type: "jsonl"
|
| 11 |
+
cache_dir: "/lustre/mlnvme/data/polyglot/.cache"
|
| 12 |
+
|
| 13 |
+
# Data loading settings
|
| 14 |
+
pin_memory: true
|
| 15 |
+
num_workers_for_dataloader: 16
|
| 16 |
+
shuffle_dataset: true
|
| 17 |
+
mask_eos_token: false
|
| 18 |
+
mask_pad_token: false
|
| 19 |
+
|
| 20 |
+
# Model architecture settings
|
| 21 |
+
vocab_size: 49152
|
| 22 |
+
num_hidden_layers: 28
|
| 23 |
+
num_attention_heads: 16
|
| 24 |
+
num_key_value_heads: 8
|
| 25 |
+
head_dim: 128
|
| 26 |
+
hidden_size: 2048
|
| 27 |
+
intermediate_size: 6144
|
| 28 |
+
max_position_embeddings: 4096
|
| 29 |
+
tie_word_embeddings: true
|
| 30 |
+
hidden_act: "silu"
|
| 31 |
+
output_hidden_states: false
|
| 32 |
+
attn_implementation: "flash_attention_2"
|
| 33 |
+
use_cache: false
|
| 34 |
+
no_rope_layer_interval: null
|
| 35 |
+
rope_theta: 1000000.0
|
| 36 |
+
rope_scale_factor: null
|
| 37 |
+
rms_norm_eps: 0.000001
|
| 38 |
+
|
| 39 |
+
# Training settings
|
| 40 |
+
total_batch_size: 524288
|
| 41 |
+
micro_batch_size: 4
|
| 42 |
+
gradient_accumulation_steps: 4
|
| 43 |
+
eval_micro_batch_size: null
|
| 44 |
+
num_train_epochs: 5
|
| 45 |
+
warmup_ratio: 0.1
|
| 46 |
+
max_learning_rate: 0.000005
|
| 47 |
+
min_learning_rate: 0.0
|
| 48 |
+
muon_learning_rate: null
|
| 49 |
+
weight_decay: 0.0
|
| 50 |
+
beta1: 0.9
|
| 51 |
+
beta2: 0.95
|
| 52 |
+
eps: 0.00000001
|
| 53 |
+
lr_decay_type: "cosine"
|
| 54 |
+
use_sqrt: false
|
| 55 |
+
lr_decay_iters_coef: 1.
|
| 56 |
+
seed: 42
|
| 57 |
+
max_steps: 535
|
| 58 |
+
max_grad_norm: 1.0
|
| 59 |
+
|
| 60 |
+
# APO settings
|
| 61 |
+
loss_type: "apo_zero"
|
| 62 |
+
dpo_beta: 0.5
|
| 63 |
+
precompute_ref_log_probs: true
|
| 64 |
+
truncation_mode: "keep_end"
|
| 65 |
+
|
| 66 |
+
# Precision and optimization settings
|
| 67 |
+
torch_compile: false
|
| 68 |
+
mat_mul_precision: "highest"
|
| 69 |
+
tf32: true
|
| 70 |
+
bf16: true
|
| 71 |
+
gradient_checkpointing: true
|
| 72 |
+
use_liger_kernel: false
|
| 73 |
+
static_graph: false
|
| 74 |
+
|
| 75 |
+
# Hub settings
|
| 76 |
+
push_to_hub: false
|
| 77 |
+
hub_token: null
|
| 78 |
+
hub_model_id: null
|
| 79 |
+
|
| 80 |
+
# Tokenizer and Reference model
|
| 81 |
+
tokenizer_name_or_path: "/polyglot/portuguese/checkpoints/models/Tucano2-qwen-1.5B-Think-SFT"
|
| 82 |
+
chat_template_path: null
|
| 83 |
+
reference_model: "/polyglot/portuguese/checkpoints/models/Tucano2-qwen-1.5B-Think-SFT"
|
| 84 |
+
continual_pretraining: true
|
| 85 |
+
|
| 86 |
+
# Checkpoint settings
|
| 87 |
+
resume_from_checkpoint: null
|
| 88 |
+
checkpointing_steps: 1000
|
| 89 |
+
begin_new_stage: true
|
| 90 |
+
stage_name: "single_cosine"
|
| 91 |
+
|
| 92 |
+
# Miscellaneous settings
|
| 93 |
+
sanity_check: false
|
| 94 |
+
sanity_check_num_samples: 100000
|
| 95 |
+
wandb_token: null
|
| 96 |
+
wandb_id: "tucano2-qwen-1.5b-think-apo"
|
| 97 |
+
wandb_project: "Polyglot"
|
| 98 |
+
wandb_desc: "Developing LLMs for low-resource languages"
|