bjoernp commited on
Commit
873cc81
1 Parent(s): fafd51e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -0
README.md CHANGED
@@ -13,6 +13,7 @@ Tags:
13
  - mixtral
14
  - moe
15
  - discoresearch
 
16
  ---
17
 
18
 
@@ -102,6 +103,22 @@ tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
102
 
103
  If you use `tokenize=True` and `return_tensors="pt"` instead, then you will get a tokenized and formatted conversation ready to pass to `model.generate()`.
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  ## Datasets
106
 
107
  The following datasets were used for training DiscoLM Mixtral 8x7b alpha:
 
13
  - mixtral
14
  - moe
15
  - discoresearch
16
+ license: apache-2.0
17
  ---
18
 
19
 
 
103
 
104
  If you use `tokenize=True` and `return_tensors="pt"` instead, then you will get a tokenized and formatted conversation ready to pass to `model.generate()`.
105
 
106
+ Basic inference code:
107
+ ```python
108
+ import torch
109
+ from transformers import AutoModelForCausalLM, AutoTokenizer
110
+
111
+ model = AutoModelForCausalLM.from_pretrained("DiscoResearch/DiscoLM-mixtral-8x7b-v2", low_cpu_mem_usage=True, device_map="auto", trust_remote_code=True)
112
+ tok = AutoTokenizer.from_pretrained("DiscoResearch/DiscoLM-mixtral-8x7b-v2")
113
+ chat = [
114
+ {"role": "system", "content": "You are DiscoLM, a helpful assistant."},
115
+ {"role": "user", "content": "Please tell me possible reasons to call a research collective Disco Research"}
116
+ ]
117
+ x = tokenizer.apply_chat_template(chat, tokenize=True, return_tensors="pt", add_generation_prompt=True).cuda()
118
+ x = model.generate(x, max_new_tokens=128).cpu()
119
+ print(tok.batch_decode(x))
120
+ ```
121
+
122
  ## Datasets
123
 
124
  The following datasets were used for training DiscoLM Mixtral 8x7b alpha: