Text Generation
Transformers
Safetensors
English
llama
Generated from Trainer
trl
sft
conversational
text-generation-inference
Instructions to use argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1") model = AutoModelForCausalLM.from_pretrained("argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1
- SGLang
How to use argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1 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 "argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1" \ --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": "argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1", "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 "argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1" \ --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": "argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1 with Docker Model Runner:
docker model run hf.co/argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1
Download sft.slurm from argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1/resolve/main/sft.slurm
- Command line
-
hf download hf://argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1/sft.slurm
-
curl -L -o sft.slurm https://huggingface.co/argilla/Llama-3.2-1B-Instruct-APIGen-FC-v0.1/resolve/main/sft.slurm
1.18 kB
| #!/bin/bash | |
| #SBATCH --job-name=apigen-fine-tune | |
| #SBATCH --partition=hopper-prod | |
| #SBATCH --qos=normal | |
| #SBATCH --nodes=1 | |
| #SBATCH --ntasks-per-node=1 | |
| #SBATCH --gpus-per-node=8 | |
| #SBATCH --output=./logs/%x-%j.out | |
| #SBATCH --err=./logs/%x-%j.err | |
| #SBATCH --time=02-00:00:00 | |
| set -ex | |
| module load cuda/12.1 | |
| source .venv/bin/activate | |
| srun --nodes=1 --ntasks=1 --export=ALL,ACCELERATE_LOG_LEVEL=info accelerate launch --config_file examples/accelerate_configs/deepspeed_zero3.yaml examples/scripts/sft.py \ | |
| --run_name=Llama-3.2-1B-Instruct-APIGen-FC-v0.1 \ | |
| --model_name_or_path="meta-llama/Llama-3.2-1B-Instruct" \ | |
| --dataset_name="plaguss/apigen-synth-trl" \ | |
| --report_to="wandb" \ | |
| --learning_rate=5.0e-06 \ | |
| --lr_scheduler_type="cosine" \ | |
| --per_device_train_batch_size=6 \ | |
| --per_device_eval_batch_size=6 \ | |
| --do_eval \ | |
| --eval_strategy="steps" \ | |
| --gradient_accumulation_steps=2 \ | |
| --output_dir="data/Llama-3.2-1B-Instruct-APIGen-FC-v0.1" \ | |
| --logging_steps=5 \ | |
| --eval_steps=50 \ | |
| --num_train_epochs=2 \ | |
| --max_steps=-1 \ | |
| --warmup_steps=50 \ | |
| --max_seq_length=2048 \ | |
| --push_to_hub \ | |
| --gradient_checkpointing \ | |
| --bf16 | |