Archive of AI

Source Snapshot / 2023-08-03-qwen-7b-open-source-1

QwenLM/Qwen

Linked event: 2023-08-03 · Qwen-7B and Chat Weights Released Publicly, Launching the Alibaba Qwen Open-Model Lineage

Publisher
GitHub
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / d6254b260bb788db
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

Skip to content

Navigation Menu

Appearance settings

You signed in with another tab or window. Reload to refresh your session.

You signed out in another tab or window. Reload to refresh your session.

You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Repository navigation

NotificationsYou must be signed in to change notification settings

Star22.1k (22.1k)You must be signed in to star a repository

The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud.

chineseflash-attentionlarge-language-modelsllmnatural-language-processingpretrained-models

Apache-2.0 license

Custom properties

157 watching

Report repository

BranchesTags

Open more actions menu

Latest commit

Folders and files

Last commit message

Last commit date

ascend-support

.dockerignore

QWEN_TECHNICAL_REPORT.pdf

README_CN.md

README_ES.md

README_FR.md

README_JA.md

Tongyi Qianwen LICENSE AGREEMENT

Tongyi Qianwen RESEARCH LICENSE AGREEMENT

openai_api.py

requirements.txt

requirements_web_demo.txt

tech_memo.md

tokenization_note.md

tokenization_note_ja.md

tokenization_note_zh.md

View all files

Repository files navigation

中文  |  English  |  日本語 |  Français |  Español

🤗 Hugging Face   |   🤖 ModelScope   |    📑 Paper    |   🖥️ Demo

WeChat (微信)   |   Discord   |   API

Qwen2 is here! You are welcome to follow QwenLM/Qwen2 and share your experience there.

This repo (QwenLM/Qwen) is no longer actively maintained, due to substantial codebase differences.

Qwen-Chat (Int4)

Qwen-Chat (Int8)

We opensource our Qwen series, now including Qwen, the base language models, namely Qwen-1.8B, Qwen-7B, Qwen-14B, and Qwen-72B, as well as Qwen-Chat, the chat models, namely Qwen-1.8B-Chat, Qwen-7B-Chat, Qwen-14B-Chat, and Qwen-72B-Chat. Links are on the above table. Click them and check the model cards. Also, we release the technical report. Please click the paper link and check it out!

In brief, we have strong base language models, which have been stably pretrained for up to 3 trillion tokens of multilingual data with a wide coverage of domains, languages (with a focus on Chinese and English), etc. They are able to achieve competitive performance on benchmark datasets. Additionally, we have chat models that are aligned with human preference based on SFT and RLHF (not released yet), which are able to chat, create content, extract information, summarize, translate, code, solve math problems, and so on, and are able to use tools, play as agents, or even play as code interpreters, etc.

Release Date

System Prompt Enhancement

# of Pretrained Tokens

Minimum GPU Memory Usage of Finetuning (Q-Lora)

Minimum GPU Usage of Generating 2048 Tokens (Int4)

In this repo, you can figure out:

Quickstart with Qwen, and enjoy the simple inference.

Details about the quantization models, including GPTQ and KV cache quantization.

Statistics of inference performance, including speed and memory.

Tutorials on finetuning, including full-parameter tuning, LoRA, and Q-LoRA.

Instructions on deployment, with the example of vLLM and FastChat.

Instructions on building demos, including WebUI, CLI demo, etc.

Introduction to DashScope API service, as well as the instructions on building an OpenAI-style API for your model.

Information about Qwen for tool use, agent, and code interpreter

Statistics of long-context understanding evaluation

License agreement

Also, if you meet problems, turn to FAQ for help first. Still feeling struggled? Feel free to shoot us issues (better in English so that more people can understand you)! If you would like to help us, send us pull requests with no hesitation! We are always excited about PR!

Would like to chat with us or date us coffee time? Welcome to our Discord or WeChat!

News and Updates

2023.11.30 🔥 We release Qwen-72B and Qwen-72B-Chat, which are trained on 3T tokens and support 32k context, along with Qwen-1.8B, and Qwen-1.8B-Chat, on ModelScope and Hugging Face. We have also strengthened the System Prompt capabilities of the Qwen-72B-Chat and Qwen-1.8B-Chat, see example documentation. Additionally, support the inference on Ascend 910 and Hygon DCU. Check ascend-support and dcu-support for more details.

2023.10.17 We release the Int8 quantized model Qwen-7B-Chat-Int8 and Qwen-14B-Chat-Int8.

2023.9.25 🔥 We release Qwen-14B and Qwen-14B-Chat on ModelScope and Hugging Face, along with qwen.cpp and Qwen-Agent. Codes and checkpoints of Qwen-7B and Qwen-7B-Chat are also updated. PLEASE PULL THE LATEST VERSION!

Compared to Qwen-7B (original), Qwen-7B uses more training tokens, increasing from 2.2T tokens to 2.4T tokens, while the context length extends from 2048 to 8192. The Chinese knowledge and coding ability of Qwen-7B have been further improved.

2023.9.12 We now support finetuning on the Qwen-7B models, including full-parameter finetuning, LoRA and Q-LoRA.

2023.8.21 We release the Int4 quantized model for Qwen-7B-Chat, Qwen-7B-Chat-Int4, which requires low memory costs but achieves improved inference speed. Besides, there is no significant performance degradation on the benchmark evaluation.

2023.8.3 We release both Qwen-7B and Qwen-7B-Chat on ModelScope and Hugging Face. We also provide a technical memo for more details about the model, including training details and model performance.

Qwen models outperform the baseline models of similar model sizes on a series of benchmark datasets, e.g., MMLU, C-Eval, GSM8K, MATH, HumanEval, MBPP, BBH, etc., which evaluate the models’ capabilities on natural language understanding, mathematic problem solving, coding, etc. Qwen-72B achieves better performance than LLaMA2-70B on all tasks and outperforms GPT-3.5 on 7 out of 10 tasks.

InternLM-20B

Baichuan2-7B

Baichuan2-13B

For all compared models, we report the best scores between their official reported results and OpenCompass.

For more experimental results (detailed model performance on more benchmark datasets) and details, please refer to our technical report by clicking here.

Requirements

python 3.8 and above

pytorch 1.12 and above, 2.0 and above are recommended

transformers 4.32 and above

CUDA 11.4 and above are recommended (this is for GPU users, flash-attention users, etc.)

Below, we provide simple examples to show how to use Qwen-Chat with 🤖 ModelScope and 🤗 Transformers.

You can use our pre-built docker images to skip most of the environment setup steps, see Section "Using Pre-built Docker Images" for more details.

If not using docker, please make sure you have setup the environment and installed the required packages. Make sure you meet the above requirements, and then install the dependent libraries.

pip install -r requirements.txt

If your device supports fp16 or bf16, we recommend installing flash-attention (we support flash attention 2 now.) for higher efficiency and lower memory usage. (flash-attention is optional and the project can run normally without installing it)

git clone https://github.com/Dao-AILab/flash-attention

cd flash-attention && pip install .

# Below are optional. Installing them might be slow.

# pip install csrc/layer_norm

# If the version of flash-attn is higher than 2.1.1, the following is not needed.

# pip install csrc/rotary

Now you can start with ModelScope or Transformers.

🤗 Transformers

To use Qwen-Chat for the inference, all you need to do is to input a few lines of codes as demonstrated below. Remember to pass in the correct model names or paths, such as "Qwen/Qwen-7B-Chat" and "Qwen/Qwen-14B-Chat". However, please make sure that you are using the latest code.

from transformers import AutoModelForCausalLM, AutoTokenizer

from transformers.generation import GenerationConfig

# Model names: "Qwen/Qwen-7B-Chat", "Qwen/Qwen-14B-Chat"

tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True)

[...内容已截断,完整版请查看原文或 Wayback 快照]