migtissera
commited on
Commit
•
9565e16
1
Parent(s):
6d0d202
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,101 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
# Tess-2.0-Mixtral
|
6 |
+
Tess, short for Tesoro (Treasure in Italian), is a general purpose Large Language Model series. Tess-2.0-Mixtral was trained on the mistralai/Mixtral-8x7B-v0.1 base.
|
7 |
+
|
8 |
+
# Prompt Format:
|
9 |
+
|
10 |
+
```
|
11 |
+
SYSTEM: <ANY SYSTEM CONTEXT>
|
12 |
+
USER:
|
13 |
+
ASSISTANT:
|
14 |
+
```
|
15 |
+
|
16 |
+
<br>
|
17 |
+
|
18 |
+
![Tesoro](https://huggingface.co/migtissera/Tess-7B-v2.0/resolve/main/Tesoro.png)
|
19 |
+
|
20 |
+
<br>
|
21 |
+
|
22 |
+
### Below shows a code example on how to use this model:
|
23 |
+
|
24 |
+
```python
|
25 |
+
import torch, json
|
26 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
27 |
+
|
28 |
+
model_path = "migtissera/Tess-2.0-Mixtral"
|
29 |
+
output_file_path = "./conversations.jsonl"
|
30 |
+
|
31 |
+
model = AutoModelForCausalLM.from_pretrained(
|
32 |
+
model_path,
|
33 |
+
torch_dtype=torch.float16,
|
34 |
+
device_map="auto",
|
35 |
+
load_in_8bit=False,
|
36 |
+
trust_remote_code=True,
|
37 |
+
)
|
38 |
+
|
39 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
40 |
+
|
41 |
+
|
42 |
+
def generate_text(instruction):
|
43 |
+
tokens = tokenizer.encode(instruction)
|
44 |
+
tokens = torch.LongTensor(tokens).unsqueeze(0)
|
45 |
+
tokens = tokens.to("cuda")
|
46 |
+
|
47 |
+
instance = {
|
48 |
+
"input_ids": tokens,
|
49 |
+
"top_p": 1.0,
|
50 |
+
"temperature": 0.5,
|
51 |
+
"generate_len": 1024,
|
52 |
+
"top_k": 50,
|
53 |
+
}
|
54 |
+
|
55 |
+
length = len(tokens[0])
|
56 |
+
with torch.no_grad():
|
57 |
+
rest = model.generate(
|
58 |
+
input_ids=tokens,
|
59 |
+
max_length=length + instance["generate_len"],
|
60 |
+
use_cache=True,
|
61 |
+
do_sample=True,
|
62 |
+
top_p=instance["top_p"],
|
63 |
+
temperature=instance["temperature"],
|
64 |
+
top_k=instance["top_k"],
|
65 |
+
num_return_sequences=1,
|
66 |
+
)
|
67 |
+
output = rest[0][length:]
|
68 |
+
string = tokenizer.decode(output, skip_special_tokens=True)
|
69 |
+
answer = string.split("USER:")[0].strip()
|
70 |
+
return f"{answer}"
|
71 |
+
|
72 |
+
|
73 |
+
conversation = f"SYSTEM: Answer the question thoughtfully and intelligently. Always answer without hesitation."
|
74 |
+
|
75 |
+
|
76 |
+
while True:
|
77 |
+
user_input = input("You: ")
|
78 |
+
llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
|
79 |
+
answer = generate_text(llm_prompt)
|
80 |
+
print(answer)
|
81 |
+
conversation = f"{llm_prompt}{answer}"
|
82 |
+
json_data = {"prompt": user_input, "answer": answer}
|
83 |
+
|
84 |
+
## Save your conversation
|
85 |
+
with open(output_file_path, "a") as output_file:
|
86 |
+
output_file.write(json.dumps(json_data) + "\n")
|
87 |
+
|
88 |
+
```
|
89 |
+
|
90 |
+
<br>
|
91 |
+
|
92 |
+
#### Limitations & Biases:
|
93 |
+
|
94 |
+
While this model aims for accuracy, it can occasionally produce inaccurate or misleading results.
|
95 |
+
|
96 |
+
Despite diligent efforts in refining the pretraining data, there remains a possibility for the generation of inappropriate, biased, or offensive content.
|
97 |
+
|
98 |
+
Exercise caution and cross-check information when necessary. This is an uncensored model.
|
99 |
+
|
100 |
+
|
101 |
+
<br>
|