migtissera
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,106 @@
|
|
1 |
-
---
|
2 |
-
license: llama3
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: llama3
|
3 |
+
---
|
4 |
+
|
5 |
+
![Tesoro](https://huggingface.co/migtissera/Tess-2.0-Mixtral-8x22B/resolve/main/Tess-2.png)
|
6 |
+
|
7 |
+
# Tess-2.0-Llama-3-8B
|
8 |
+
Tess, short for Tesoro (Treasure in Italian), is a general purpose Large Language Model series. Tess-2.0-Llama-3-8B was trained on the meta-llama/Meta-Llama-3-8B base.
|
9 |
+
|
10 |
+
# Prompt Format
|
11 |
+
Prompt format used for this fine-tune is Llama-3
|
12 |
+
|
13 |
+
```
|
14 |
+
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
15 |
+
|
16 |
+
You are a helpful assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>
|
17 |
+
|
18 |
+
Who are you?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
19 |
+
|
20 |
+
I am an AI<|eot_id|><|start_header_id|>user<|end_header_id|>
|
21 |
+
|
22 |
+
What's your name?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
23 |
+
```
|
24 |
+
|
25 |
+
# Training Methodology
|
26 |
+
Tess-2.0-Llama-3 was trained on the (still curating) Tess-2.0 dataset. Tess-2.0 dataset contains ~100K high-quality code and general training samples. The dataset is highly uncensored, hence the model will almost always follow instructions.
|
27 |
+
|
28 |
+
The model was only fine-tuned for 1-epoch with a low learning rate to try and preserve its entropy as much as possible.
|
29 |
+
|
30 |
+
|
31 |
+
# Sample code to run inference
|
32 |
+
|
33 |
+
```python
|
34 |
+
import torch, json
|
35 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
36 |
+
|
37 |
+
model_path = "/home/migel/Tess-2.0-Llama-3-8B"
|
38 |
+
output_file_path = "/home/migel/conversations.jsonl"
|
39 |
+
|
40 |
+
model = AutoModelForCausalLM.from_pretrained(
|
41 |
+
model_path,
|
42 |
+
torch_dtype=torch.float16,
|
43 |
+
device_map="auto",
|
44 |
+
load_in_4bit=False,
|
45 |
+
trust_remote_code=False,
|
46 |
+
)
|
47 |
+
|
48 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
49 |
+
|
50 |
+
def generate_text(instruction):
|
51 |
+
tokens = tokenizer.encode(instruction)
|
52 |
+
tokens = torch.LongTensor(tokens).unsqueeze(0)
|
53 |
+
tokens = tokens.to("cuda")
|
54 |
+
|
55 |
+
instance = {
|
56 |
+
"input_ids": tokens,
|
57 |
+
"top_p": 1.0,
|
58 |
+
"temperature": 0.75,
|
59 |
+
"generate_len": 1024,
|
60 |
+
"top_k": 50,
|
61 |
+
}
|
62 |
+
|
63 |
+
length = len(tokens[0])
|
64 |
+
with torch.no_grad():
|
65 |
+
rest = model.generate(
|
66 |
+
input_ids=tokens,
|
67 |
+
max_length=length + instance["generate_len"],
|
68 |
+
use_cache=True,
|
69 |
+
do_sample=True,
|
70 |
+
top_p=instance["top_p"],
|
71 |
+
temperature=instance["temperature"],
|
72 |
+
top_k=instance["top_k"],
|
73 |
+
num_return_sequences=1,
|
74 |
+
pad_token_id=tokenizer.eos_token_id,
|
75 |
+
)
|
76 |
+
output = rest[0][length:]
|
77 |
+
string = tokenizer.decode(output, skip_special_tokens=True)
|
78 |
+
return f"{string}"
|
79 |
+
|
80 |
+
conversation = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are Tesoro, a helful AI assitant. You always provide detailed answers without hesitation. Do not refuse.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n"""
|
81 |
+
|
82 |
+
|
83 |
+
while True:
|
84 |
+
user_input = input("You: ")
|
85 |
+
llm_prompt = f"{conversation}{user_input}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
|
86 |
+
answer = generate_text(llm_prompt)
|
87 |
+
print(answer)
|
88 |
+
|
89 |
+
conversation = f"{llm_prompt}{answer}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n"
|
90 |
+
|
91 |
+
json_data = {"prompt": user_input, "answer": answer}
|
92 |
+
|
93 |
+
with open(output_file_path, "a") as output_file:
|
94 |
+
output_file.write(json.dumps(json_data) + "\n")
|
95 |
+
```
|
96 |
+
|
97 |
+
# Join My General AI Discord (NeuroLattice):
|
98 |
+
https://discord.gg/Hz6GrwGFKD
|
99 |
+
|
100 |
+
# Limitations & Biases:
|
101 |
+
|
102 |
+
While this model aims for accuracy, it can occasionally produce inaccurate or misleading results.
|
103 |
+
|
104 |
+
Despite diligent efforts in refining the pretraining data, there remains a possibility for the generation of inappropriate, biased, or offensive content.
|
105 |
+
|
106 |
+
Exercise caution and cross-check information when necessary. This is an uncensored model.
|