Model Details
This model is an mixed int4 model with group_size 128 and symmetric quantization of zai-org/GLM-4.5 generated by intel/auto-round algorithm. Non expert layers are fallback to 8 bits. Please refer to Section Generate the model for more details. Please follow the license of the original model.
How To Use
vLLM usage
VLLM_WORKER_MULTIPROC_METHOD=spawn python -m vllm.entrypoints.openai.api_server --port 8001 --trust-remote-code --tensor-parallel-size 4 --gpu-memory-utilization 0.90 --model Intel/GLM-4.5-int4-mixed-AutoRound --enable-expert-parallel --max-model-len 32768 --max-seq-len-to-capture 32768
INT4 Inference
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_PATH = "Intel/GLM-4.5-int4-mixed-AutoRound"
messages = [{"role": "user", "content": "Give me a short introduction to large language model."}]
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
)
model = AutoModelForCausalLM.from_pretrained(
pretrained_model_name_or_path=MODEL_PATH,
torch_dtype=torch.bfloat16,
device_map="auto",
)
inputs = inputs.to(model.device)
inputs.pop("token_type_ids")
generated_ids = model.generate(**inputs, max_new_tokens=512, do_sample=False)
output_text = tokenizer.decode(generated_ids[0][inputs.input_ids.shape[1] :])
print(output_text)
"""
<think>Okay, the user asked for a short introduction to large language models. Let me start by recalling what I know. LLMs are a type of AI that processes and generates human-like text. They're built on deep learning, specifically transformer architectures. The user probably wants a concise overview without too much jargon.
First, I should define what an LLM is. Mention it's an AI system trained on vast amounts of text data. Highlight key capabilities like understanding and generating text. Maybe give examples of tasks they perform, such as translation or summarization.
Next, explain how they work. The transformer architecture is crucial here. Self-attention mechanisms help them handle context and relationships in text. Training involves pre-training on large datasets and then fine-tuning. But since the user wants a short intro, I shouldn't dive too deep into technical details.
Also, consider the user's possible background. They might be new to the topic, so avoid complex terms. Use analogies, like comparing LLMs to prediction engines. Emphasize their versatility in applications like chatbots or content creation.
I should mention popular models like GPT or BERT to give context. But keep it brief. The user might be curious about why LLMs are significant. Note their impact on AI advancements and real-world uses.
Check if there are common misconceptions. For instance, LLMs don't "understand" like humans but predict text based on patterns. Clarify that to set realistic expectations.
Finally, wrap up with their importance in modern AI. Ensure the explanation is clear, concise, and covers the basics without overwhelming the user. Avoid markdown, keep paragraphs short. Make sure it's accessible to someone without technical expertise.</think>Here's a concise introduction to Large Language Models (LLMs):
**Large Language Models (LLMs)** are a powerful type of artificial intelligence designed to understand, generate, and manipulate human language. Trained on massive datasets of text and code (often encompassing a significant portion of the internet), they learn complex patterns, relationships, and structures within language.
**Key characteristics:**
1. **"Large":** Refers to both the enormous amount of training data (trillions of words) and the model's architecture itself, which typically involves billions (or even trillions) of parameters – the internal variables adjusted during learning.
2. **Core Capability:** They function as sophisticated **prediction engines**. Given a sequence of text (a prompt), they predict the most likely next
"""
Generate the model
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import transformers
model_name = "zai-org/GLM-4.5"
tokenizer = AutoTokenizer.from_pretrained(model_name,trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name,device_map="cpu", torch_dtype="auto",trust_remote_code=True)
layer_config = {}
for n, m in model.named_modules():
if isinstance(m, torch.nn.Linear):
if "expert" in n or "shared_experts" in n:
layer_config[n] = {"bits": 4}
print(n, 4)
elif n != "lm_head":
layer_config[n] = {"bits": 8}
print(n, 8)
from auto_round import AutoRound
autoround = AutoRound(model, tokenizer, iters=0, layer_config=layer_config)
autoround.quantize_and_save(format="auto_round", output_dir="tmp_autoround")
Ethical Considerations and Limitations
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
Therefore, before deploying any applications of the model, developers should perform safety testing.
Caveats and Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
Here are a couple of useful links to learn more about Intel's AI software:
- Intel Neural Compressor link
Disclaimer
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
Cite
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
- Downloads last month
- 39
Model tree for Intel/GLM-4.5-int4-mixed-AutoRound
Base model
zai-org/GLM-4.5