Text Generation
Transformers
Safetensors
English
llama
llama3.2
PyTorch
conversational
text-generation-inference
Instructions to use yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4") model = AutoModelForCausalLM.from_pretrained("yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4", 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 yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4
- SGLang
How to use yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4 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 "yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4" \ --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": "yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4", "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 "yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4" \ --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": "yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4 with Docker Model Runner:
docker model run hf.co/yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4
モデル情報
このモデルは「meta-llama/Llama-3.2-1B」をベースに、Instruction-Tuningを実施したモデルです
Ollamaにも公開しているため、こちらからご利用いただけます
https://ollama.com/Areku/Llama-3.2-1B-Instruct-QA-v4
https://ollama.com/Areku/Llama-3.2-1B-Instruct-QA-v4-q4km
下記の2種のライセンス要件を継承します
- Llama 3.2 Community License
- CC BY‑NC 4.0
データセット
訓練・検証データセット
- データソース: https://github.com/tatsu-lab/stanford_alpaca
- データ件数: 52,002件
- 言語: 英語
- データ形式:
- instruction: モデルが実行すべきタスクで、データセット内部にあるinstructionはそれぞれ一意 str型
- input: タスクのオプションのコンテキストまたは入力。データ件数のうち約40%に入力がある str型
- output: text-davinci-003によって生成された、instructionに対する答え str型
- ライセンス: CC BY NC 4.0
評価データセット
- データソース: https://huggingface.co/datasets/tatsu-lab/alpaca_eval/blob/main/alpaca_eval.json
- データ件数: 805件
- 言語: 英語
- データ形式:
- instruction: モデルが実行すべきタスクで、データセット内部にあるinstructionはそれぞれ一意 str型
- input: タスクのオプションのコンテキストまたは入力。データ件数のうち約40%に入力がある str型
- output: text-davinci-003によって生成された、instructionに対する答え str型
- ライセンス: CC BY NC 4.0
利用方法
import torch
from transformers import pipeline
model_id = "ArekuNoimar/Llama-3.2-1B-Instruct-QA-v4"
pipe = pipeline(
"text-generation",
model=model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
outputs = pipe(
messages,
max_new_tokens=2048,
temperature=0.7,
)
print(outputs[0]["generated_text"][-1])
モデル評価
ROUGE
BERTScore
BLEU
Perplexity
結果
語彙的擬似性(ROUGE, BLEU)
- n-gram重複度の高い応答生成能力を獲得
意味的擬似性(BERTScore)
- 公式Instructモデル(Llama-3.2-1B-Instruct)と比較し、僅差(0.1)で優位
言語モデリング能力(Perplexity)
- ベースモデル(Llama3.2-1B), 比較モデル(Llama3.2-1B-Instruct, Llama3.2-3B, Llama3.2-3B-Instruct, gemma-3-1b-it)と比較し、ファインチューニングモデル(Llama-3.2-1B-Instruct-QA-v4)の値が高く、言語モデルとしての予測性能が低下していることを確認
- 英語のQAタスクにおける指示追従性能特化により、汎用性が低下
- Downloads last month
- 4
Model tree for yasutoshi-lab/Llama-3.2-1B-Instruct-QA-v4
Base model
meta-llama/Llama-3.2-1B