migtissera commited on
Commit
76def44
1 Parent(s): 0833025

Update README.md

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