Text Generation
Transformers
PyTorch
qwen2
quantization
sparsity
llm
conversational
text-generation-inference
Instructions to use HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50") model = AutoModelForCausalLM.from_pretrained("HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50") 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
- vLLM
How to use HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50
- SGLang
How to use HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50 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 "HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50" \ --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": "HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50", "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 "HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50" \ --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": "HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50 with Docker Model Runner:
docker model run hf.co/HangGuo/QWen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50
Improve model card: Add OBR paper details, usage, and tags
#1
by nielsr HF Staff - opened
This PR significantly improves the model card for the Qwen2.5-7B-FlatQuant-OBR-GPTQ-W4A4KV4S50 model (as implied by the context of FlatQuant and Qwen2.5).
Key changes include:
- Replacing the boilerplate content with a detailed description, including the paper title and abstract.
- Adding a link to the official Hugging Face paper page: Optimal Brain Restoration for Joint Quantization and Sparsification of LLMs.
- Adding a link to the GitHub repository: https://github.com/csguoh/OBR.
- Setting the
pipeline_tagtotext-generationto improve discoverability. - Updating the
licensetomit, aligning with the underlying FlatQuant method used for this specific model. - Adding relevant tags:
quantization,sparsity,llm,qwen2. - Including a clear "How to Get Started" section with a functional code snippet for
transformersinference, adapted from best practices and the context provided in the GitHub repository. - Adding the BibTeX citation.
- Populating various "Model Details" fields and removing empty boilerplate sections.
These changes make the model card much more informative and user-friendly, aligning it with Hugging Face's best practices.
HangGuo changed pull request status to merged