Qwen is Alibaba Cloud's family of open-weight large language models, spanning sizes from under a billion parameters up to hundreds of billions, plus specialized coding and vision variants. It sits at roughly #13 in real-world usage share (about 5.2%), driven less by a flagship chat app and more by how often developers download and fine-tune its open weights. Qwen is best known for unusually strong bilingual Chinese/English performance and for serving as a popular base model that the open-source community builds custom fine-tunes on top of.
Qwen can be run locally through Ollama in one command, or called through the OpenAI-compatible transformers/DashScope APIs. Here's a local chat completion using the transformers library.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen2.5-7B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
messages = [{"role": "user", "content": "Explain what a REST API is in two sentences."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
The fastest path is running a quantized Qwen model locally with Ollama — no API key or account needed.
# 1. install Ollama from ollama.com, then pull and run Qwen2.5
ollama run qwen2.5
# 2. or install transformers to load weights directly from Hugging Face
pip install transformers accelerate
# 3. or use Alibaba Cloud's hosted DashScope API for the largest models
# sign up at dashscope.aliyun.com and get an API key