duyntnet commited on
Commit
474cade
1 Parent(s): dc3fe62

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +110 -0
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ inference: false
7
+ tags:
8
+ - transformers
9
+ - gguf
10
+ - imatrix
11
+ - Qwen2.5-14B-Instruct
12
+ ---
13
+ Quantizations of https://huggingface.co/Qwen/Qwen2.5-14B-Instruct
14
+
15
+
16
+ ### Inference Clients/UIs
17
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp)
18
+ * [KoboldCPP](https://github.com/LostRuins/koboldcpp)
19
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
20
+ * [ollama](https://github.com/ollama/ollama)
21
+
22
+
23
+ ---
24
+
25
+ # From original readme
26
+
27
+ Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
28
+
29
+ - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
30
+ - Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
31
+ - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
32
+ - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
33
+
34
+ **This repo contains the instruction-tuned 14B Qwen2.5 model**, which has the following features:
35
+ - Type: Causal Language Models
36
+ - Training Stage: Pretraining & Post-training
37
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
38
+ - Number of Parameters: 14.7B
39
+ - Number of Paramaters (Non-Embedding): 13.1B
40
+ - Number of Layers: 48
41
+ - Number of Attention Heads (GQA): 40 for Q and 8 for KV
42
+ - Context Length: Full 131,072 tokens and generation 8192 tokens
43
+ - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
44
+
45
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
46
+
47
+ ## Requirements
48
+
49
+ The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
50
+
51
+ With `transformers<4.37.0`, you will encounter the following error:
52
+ ```
53
+ KeyError: 'qwen2'
54
+ ```
55
+
56
+ ## Quickstart
57
+
58
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
59
+
60
+ ```python
61
+ from transformers import AutoModelForCausalLM, AutoTokenizer
62
+
63
+ model_name = "Qwen/Qwen2.5-14B-Instruct"
64
+
65
+ model = AutoModelForCausalLM.from_pretrained(
66
+ model_name,
67
+ torch_dtype="auto",
68
+ device_map="auto"
69
+ )
70
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
71
+
72
+ prompt = "Give me a short introduction to large language model."
73
+ messages = [
74
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
75
+ {"role": "user", "content": prompt}
76
+ ]
77
+ text = tokenizer.apply_chat_template(
78
+ messages,
79
+ tokenize=False,
80
+ add_generation_prompt=True
81
+ )
82
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
83
+
84
+ generated_ids = model.generate(
85
+ **model_inputs,
86
+ max_new_tokens=512
87
+ )
88
+ generated_ids = [
89
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
90
+ ]
91
+
92
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
93
+ ```
94
+
95
+ ### Processing Long Texts
96
+
97
+ The current `config.json` is set for context length up to 32,768 tokens.
98
+ To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
99
+
100
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
101
+ ```json
102
+ {
103
+ ...,
104
+ "rope_scaling": {
105
+ "factor": 4.0,
106
+ "original_max_position_embeddings": 32768,
107
+ "type": "yarn"
108
+ }
109
+ }
110
+ ```