CarrotAI commited on
Commit
58d9dd7
·
verified ·
1 Parent(s): 0df306c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -1
README.md CHANGED
@@ -7,4 +7,110 @@ language:
7
  - ko
8
  base_model:
9
  - Qwen/Qwen2-7B-Instruct
10
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  - ko
8
  base_model:
9
  - Qwen/Qwen2-7B-Instruct
10
+ ---
11
+
12
+ ## Quickstart
13
+
14
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
15
+
16
+ ```python
17
+ from transformers import AutoModelForCausalLM, AutoTokenizer
18
+ device = "cuda" # the device to load the model onto
19
+
20
+ model = AutoModelForCausalLM.from_pretrained(
21
+ "Qwen/Qwen2-7B-Instruct",
22
+ torch_dtype="auto",
23
+ device_map="auto"
24
+ )
25
+ tokenizer = AutoTokenizer.from_pretrained("CarrotAI/Rabbit-Ko-15B-Instruct")
26
+
27
+ prompt = "Give me a short introduction to large language model."
28
+ messages = [
29
+ {"role": "system", "content": "You are a helpful assistant."},
30
+ {"role": "user", "content": prompt}
31
+ ]
32
+ text = tokenizer.apply_chat_template(
33
+ messages,
34
+ tokenize=False,
35
+ add_generation_prompt=True
36
+ )
37
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
38
+
39
+ generated_ids = model.generate(
40
+ model_inputs.input_ids,
41
+ max_new_tokens=512
42
+ )
43
+ generated_ids = [
44
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
45
+ ]
46
+
47
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
48
+ ```
49
+
50
+ ### Processing Long Texts
51
+ 1. **Install vLLM**: You can install vLLM by running the following command.
52
+
53
+ ```bash
54
+ pip install "vllm>=0.4.3"
55
+ ```
56
+
57
+ Or you can install vLLM from [source](https://github.com/vllm-project/vllm/).
58
+
59
+ 2. **Configure Model Settings**: After downloading the model weights, modify the `config.json` file by including the below snippet:
60
+ ```json
61
+ {
62
+ "architectures": [
63
+ "Qwen2ForCausalLM"
64
+ ],
65
+ // ...
66
+ "vocab_size": 152064,
67
+
68
+ // adding the following snippets
69
+ "rope_scaling": {
70
+ "factor": 4.0,
71
+ "original_max_position_embeddings": 32768,
72
+ "type": "yarn"
73
+ }
74
+ }
75
+ ```
76
+ This snippet enable YARN to support longer contexts.
77
+
78
+ 3. **Model Deployment**: Utilize vLLM to deploy your model. For instance, you can set up an openAI-like server using the command:
79
+
80
+ ```bash
81
+ python -m vllm.entrypoints.openai.api_server --served-model-name Qwen2-7B-Instruct --model path/to/weights
82
+ ```
83
+
84
+ Then you can access the Chat API by:
85
+
86
+ ```bash
87
+ curl http://localhost:8000/v1/chat/completions \
88
+ -H "Content-Type: application/json" \
89
+ -d '{
90
+ "model": "CarrotAI/Rabbit-Ko-15B-Instruct",
91
+ "messages": [
92
+ {"role": "system", "content": "You are a helpful assistant."},
93
+ {"role": "user", "content": "Your Long Input Here."}
94
+ ]
95
+ }'
96
+ ```
97
+
98
+ For further usage instructions of vLLM, please refer to our [Github](https://github.com/QwenLM/Qwen2).
99
+
100
+
101
+ ### Applications
102
+ This fine-tuned model is particularly suited for [mention applications, e.g., chatbots, question-answering systems, etc.]. Its enhanced capabilities ensure more accurate and contextually appropriate responses in these domains.
103
+
104
+ ### Limitations and Considerations
105
+ While our fine-tuning process has optimized the model for specific tasks, it's important to acknowledge potential limitations. The model's performance can still vary based on the complexity of the task and the specificities of the input data. Users are encouraged to evaluate the model thoroughly in their specific context to ensure it meets their requirements.
106
+
107
+ If you liked this model, please use the card below
108
+
109
+ ```
110
+ @article{RabbitKo15BInstruct,
111
+ title={CarrotAI/Rabbit-Ko-15B-Instruct Card},
112
+ author={CarrotAI (L, GEUN)},
113
+ year={2024},
114
+ url = {https://huggingface.co/CarrotAI/Rabbit-Ko-15B-Instruct}
115
+ }
116
+ ```