Qwen2
Qwen2 is a multilingual LLM family (dense and MoE) from 0.5B to 72B with GQA, RoPE, sliding-window/full attention mixes and long context (up to 131K tokens documented upstream).
Adapted for this playbook from the 🤗 Transformers documentation by Hugging Face. Official page: https://huggingface.co/docs/transformers/model_doc/qwen2. Images © Hugging Face (
documentation-images) unless noted. This is not a substitute for the upstream docs — verify against the current version.Covers Hugging Face pages: model_doc/qwen2
Quick usage​
from transformers import pipeline
pipe = pipeline(task="text-generation", model="Qwen/Qwen2-1.5B-Instruct")
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me about the Qwen2 model family."},
]
out = pipe(messages, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.95)
print(out[0]["generated_text"][-1]["content"])
Collection: Qwen2.
Discussion
Comments​
Share feedback or questions about this page. No account required.
Loading comments…