Instructions to use m-a-p/Qwen2-Instruct-7B-COIG-P with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use m-a-p/Qwen2-Instruct-7B-COIG-P with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="m-a-p/Qwen2-Instruct-7B-COIG-P") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("m-a-p/Qwen2-Instruct-7B-COIG-P") model = AutoModelForCausalLM.from_pretrained("m-a-p/Qwen2-Instruct-7B-COIG-P", device_map="auto") 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 Settings
- vLLM
How to use m-a-p/Qwen2-Instruct-7B-COIG-P with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "m-a-p/Qwen2-Instruct-7B-COIG-P" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-a-p/Qwen2-Instruct-7B-COIG-P", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/m-a-p/Qwen2-Instruct-7B-COIG-P
- SGLang
How to use m-a-p/Qwen2-Instruct-7B-COIG-P 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 "m-a-p/Qwen2-Instruct-7B-COIG-P" \ --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": "m-a-p/Qwen2-Instruct-7B-COIG-P", "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 "m-a-p/Qwen2-Instruct-7B-COIG-P" \ --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": "m-a-p/Qwen2-Instruct-7B-COIG-P", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use m-a-p/Qwen2-Instruct-7B-COIG-P with Docker Model Runner:
docker model run hf.co/m-a-p/Qwen2-Instruct-7B-COIG-P
- Model Card for Qwen2-Instruct-7B-COIG-P
- Model Details
- Uses
- Bias, Risks, and Limitations
- How to Get Started with the Model
- Training Details
- Evaluation
- Model Examination [optional]
- Environmental Impact
- Technical Specifications [optional]
- Citation [optional]
- Glossary [optional]
- More Information [optional]
- Model Card Authors [optional]
- Model Card Contact
Model Card for Qwen2-Instruct-7B-COIG-P
This model, Qwen2-Instruct-7B-COIG-P, is a 7B parameter large language model fine-tuned for instruction following, particularly within the Chinese language domain. It's based on the Qwen-2 architecture and trained using the COIG-P dataset, focusing on aligning the model's output with human preferences.
Model Details
Model Description
This repository contains the Qwen2-Instruct-7B-COIG-P model described in the paper COIG-P: A High-Quality and Large-Scale Chinese Preference Dataset for Alignment with Human Values. This model excels at generating text responses in Chinese according to user instructions.
- Developed by: [More Information Needed - Add developer/organization details]
- Funded by [optional]: [More Information Needed - Add funding source information]
- Shared by [optional]: m-a-p
- Model type: Large Language Model (LLM)
- Language(s) (NLP): Chinese (zh)
- License: Apache 2.0
- Finetuned from model [optional]: [More Information Needed - Add base model details]
Model Sources
- Repository: https://github.com/m-a-p/COIG-P
- Paper: https://arxiv.org/abs/2504.05535
- Demo [optional]: [More Information Needed - Add demo link if available]
Uses
Direct Use
This model can be used directly for text generation tasks in Chinese. Users can provide instructions or prompts, and the model will generate corresponding text outputs.
Downstream Use [optional]
This model can be fine-tuned for various downstream tasks such as question answering, text summarization, and translation, specifically within the Chinese language context.
Out-of-Scope Use
This model may not perform well on tasks requiring knowledge outside of the domain covered by the COIG-P dataset. Its performance in languages other than Chinese is also expected to be limited.
Bias, Risks, and Limitations
[More Information Needed - Add information on biases, risks, and limitations. Consider potential biases in the training data and the model's potential for generating harmful or inappropriate content.]
Recommendations
[More Information Needed - Add recommendations to mitigate biases, risks, and limitations]
How to Get Started with the Model
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForCausalLM.from_pretrained("m-a-p/Qwen2-Instruct-7B-COIG-P", trust_remote_code=True, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("m-a-p/Qwen2-Instruct-7B-COIG-P")
prompt = "Give me a short introduction to large language models."
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512)
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
Training Details
Training Data
[More Information Needed - Add details about the training data, linking to the Hugging Face dataset card if applicable. The dataset used is COIG-P: https://huggingface.co/datasets/m-a-p/COIG-P]
Training Procedure
[More Information Needed - Add details about the training procedure, including pre-processing steps and hyperparameters.]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
[More Information Needed - Detail the evaluation setup, including datasets, factors, and metrics used.]
Results
[More Information Needed - Present the evaluation results.]
Summary
[More Information Needed - Summarize the evaluation results.]
Model Examination [optional]
[More Information Needed]
Environmental Impact
[More Information Needed - Estimate and report the environmental impact of training this model.]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
@misc{pteam2025coigphighqualitylargescalechinese,
title={COIG-P: A High-Quality and Large-Scale Chinese Preference Dataset for Alignment with Human Values},
author={P Team and Siwei Wu and Jincheng Ren and Xinrun Du and Shuyue Guo and Xingwei Qu and Yiming Liang and Jie Liu and Yunwen Li and Tianyu Zheng and Boyu Feng and Huaqing Yuan and Zenith Wang and Jiaheng Liu and Wenhao Huang and Chenglin Cai and Haoran Que and Jian Yang and Yuelin Bai and Zekun Moore Wang and Zhouliang Yu and Qunshu Lin and Ding Pan and Yuchen Jiang and Tiannan Wang and Wangchunshu Zhou and Shenzhi Wang and Xingyuan Bu and Minghao Liu and Guoyin Wang and Ge Zhang and Chenghua Lin},
year={2025},
eprint={2504.05535},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.05535},
}
APA:
[More Information Needed - Add APA citation]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]
- Downloads last month
- 13