libraxiong commited on
Commit
3e3213b
1 Parent(s): 714d6dd

update readme

Browse files
Files changed (1) hide show
  1. README.md +60 -1
README.md CHANGED
@@ -3,4 +3,63 @@ license: apache-2.0
3
  language:
4
  - en
5
  - zh
6
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  language:
4
  - en
5
  - zh
6
+
7
+ ---
8
+
9
+ ### 1. Base Model Deepseek LLM
10
+
11
+ The base model is Deepseek-7b-chat model , lora dataset is [aaming77/huanhuan · Datasets at Hugging Face](https://huggingface.co/datasets/aaming77/huanhuan/viewer)
12
+
13
+
14
+ ### 2. Model Summary
15
+ `deepseek-llm-7b-chat` is a 7B parameter model initialized from `deepseek-llm-7b-base` and fine-tuned on extra instruction data.
16
+
17
+ model details you can see their **Repository:** [deepseek-ai/deepseek-LLM](https://github.com/deepseek-ai/deepseek-LLM)
18
+
19
+
20
+ ### 3. How to Use
21
+ Here give some examples of how to use our model.
22
+ #### Chat Completion
23
+ ```python
24
+ import torch
25
+ from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
26
+
27
+ model_name = "libraxiong/deepseek-zhenhuan-lora"
28
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
29
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
30
+ model.generation_config = GenerationConfig.from_pretrained(model_name)
31
+ model.generation_config.pad_token_id = model.generation_config.eos_token_id
32
+
33
+ messages = [
34
+ {"role": "user", "content": "Who are you?"}
35
+ ]
36
+ input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
37
+ outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)
38
+
39
+ result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
40
+ print(result)
41
+ ```
42
+
43
+ Avoiding the use of the provided function `apply_chat_template`, you can also interact with our model following the sample template. Note that `messages` should be replaced by your input.
44
+
45
+ ```
46
+ User: {messages[0]['content']}
47
+
48
+ Assistant: {messages[1]['content']}<|end▁of▁sentence|>User: {messages[2]['content']}
49
+
50
+ Assistant:
51
+ ```
52
+
53
+ **Note:** By default (`add_special_tokens=True`), our tokenizer automatically adds a `bos_token` (`<|begin▁of▁sentence|>`) before the input text. Additionally, since the system prompt is not compatible with this version of our models, we DO NOT RECOMMEND including the system prompt in your input.
54
+
55
+ ### 4. License
56
+ This code repository is licensed under the MIT License. The use of DeepSeek LLM models is subject to the Model License. DeepSeek LLM supports commercial use.
57
+
58
+ See the [LICENSE-MODEL](https://github.com/deepseek-ai/deepseek-LLM/blob/main/LICENSE-MODEL) for more details.
59
+
60
+ ### 5. Acknowledgement
61
+
62
+ [deepseek-ai/deepseek-llm-7b-chat · Hugging Face](https://huggingface.co/deepseek-ai/deepseek-llm-7b-chat)
63
+
64
+ [aaming77/huanhuan · Datasets at Hugging Face](https://huggingface.co/datasets/aaming77/huanhuan/viewer)
65
+