Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "Intel/Qwen3-Next-80B-A3B-Instruct-int4-mixed-AutoRound"
4
5# load the tokenizer and the model
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 dtype="auto",
10 device_map="auto",
11)
12
13# prepare the model input
14prompt = "Give me a short introduction to large language model."
15messages = [
16 {"role": "user", "content": prompt},
17]
18text = tokenizer.apply_chat_template(
19 messages,
20 tokenize=False,
21 add_generation_prompt=True,
22)
23model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
24
25# conduct text completion
26generated_ids = model.generate(
27 **model_inputs,
28 max_new_tokens=512,
29)
30output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
31
32content = tokenizer.decode(output_ids, skip_special_tokens=True)
33
34print("content:", content)
35"""
36content: A large language model (LLM) is a type of artificial intelligence system trained on vast amounts of text data to understand and generate human-like language. These models, such as GPT, PaLM, or LLaMA, use deep learning architectures—typically based on the transformer network—to predict the next word in a sequence, enabling them to answer questions, write essays, translate languages, and even code. LLMs learn patterns, context, and relationships in language without explicit programming, making them versatile tools for a wide range of natural language tasks. Their scale—often with billions or trillions of parameters—allows them to capture nuanced linguistic features, though they also require significant computational resources and raise important ethical and safety considerations.
37"""AR_DISABLE_COPY_MTP_WEIGHTS=1 auto-round --scheme w4a16_mixed --iters 0 --model_name Qwen/Qwen3-Next-80B-A3B-Instruct| benchmark | n-shot | backend | Intel/Qwen3-Next-80B-A3B-Instruct-int4-mixed-AutoRound | Qwen/Qwen3-Next-80B-A3B-Instruct |
|---|---|---|---|---|
| gsm8k | 5 | vllm | 0.8393 | 0.8074 |
| mmlu_pro | 5 | vllm | 0.7630 | 0.7621 |