migtissera
commited on
Commit
•
d6a4b1f
1
Parent(s):
d0196f6
Update README.md
Browse files
README.md
CHANGED
@@ -8,133 +8,82 @@ model-index:
|
|
8 |
results: []
|
9 |
---
|
10 |
|
11 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
12 |
-
should probably proofread and complete it, then remove this comment. -->
|
13 |
|
14 |
-
[
|
15 |
-
<details><summary>See axolotl config</summary>
|
16 |
|
17 |
-
|
18 |
-
```yaml
|
19 |
-
base_model: mistralai/Codestral-22B-v0.1
|
20 |
-
model_type: AutoModelForCausalLM
|
21 |
-
tokenizer_type: AutoTokenizer
|
22 |
-
|
23 |
-
load_in_8bit: false
|
24 |
-
load_in_4bit: false
|
25 |
-
strict: false
|
26 |
-
|
27 |
-
datasets:
|
28 |
-
- path: /home/ubuntu/Tess-3-Code/multi_turn_chatml_deepseek_coder.jsonl
|
29 |
-
type: sharegpt
|
30 |
-
conversation: chatml
|
31 |
-
- path: /home/ubuntu/Tess-3-Code/single_turn_chatml_code_only.jsonl
|
32 |
-
type: sharegpt
|
33 |
-
conversation: chatml
|
34 |
-
- path: /home/ubuntu/Tess-v2.5-FULL-DATASET/Trinity-33B-v1.0-chatml.jsonl
|
35 |
-
type: sharegpt
|
36 |
-
conversation: chatml
|
37 |
-
|
38 |
-
|
39 |
-
chat_template: chatml
|
40 |
-
|
41 |
-
dataset_prepared_path: last_run_prepared_codestral
|
42 |
-
val_set_size: 0.0
|
43 |
-
output_dir: /home/ubuntu/trinity-codestral-1
|
44 |
-
|
45 |
-
sequence_len: 4096
|
46 |
-
sample_packing: true
|
47 |
-
pad_to_sequence_len: true
|
48 |
-
|
49 |
-
gradient_accumulation_steps: 2
|
50 |
-
micro_batch_size: 2
|
51 |
-
num_epochs: 1
|
52 |
-
logging_steps: 1
|
53 |
-
optimizer: paged_adamw_32bit
|
54 |
-
lr_scheduler: constant
|
55 |
-
learning_rate: 1e-6
|
56 |
-
|
57 |
-
wandb_project: kindo-lambda-labs
|
58 |
-
wandb_watch:
|
59 |
-
wandb_run_id:
|
60 |
-
wandb_log_model:
|
61 |
-
|
62 |
-
train_on_inputs: false
|
63 |
-
group_by_length: false
|
64 |
-
bf16: auto
|
65 |
-
fp16:
|
66 |
-
tf32: false
|
67 |
-
|
68 |
-
gradient_checkpointing: true
|
69 |
-
gradient_checkpointing_kwargs:
|
70 |
-
use_reentrant: false
|
71 |
-
early_stopping_patience:
|
72 |
-
resume_from_checkpoint:
|
73 |
-
local_rank:
|
74 |
-
logging_steps: 1
|
75 |
-
xformers_attention:
|
76 |
-
flash_attention: true
|
77 |
-
saves_per_epoch: 10
|
78 |
-
evals_per_epoch:
|
79 |
-
save_total_limit: 2
|
80 |
-
save_steps:
|
81 |
-
eval_sample_packing: false
|
82 |
-
debug:
|
83 |
-
deepspeed: /home/ubuntu/axolotl/deepspeed_configs/zero3_bf16.json
|
84 |
-
weight_decay: 0.0
|
85 |
-
fsdp:
|
86 |
-
fsdp_config:
|
87 |
-
special_tokens:
|
88 |
-
bos_token: "<|im_start|>"
|
89 |
-
eos_token: "<|im_end|>"
|
90 |
-
pad_token: "<|end_of_text|>"
|
91 |
|
92 |
-
|
93 |
|
94 |
-
</details><br>
|
95 |
|
96 |
-
#
|
97 |
|
98 |
-
|
|
|
|
|
99 |
|
100 |
-
|
101 |
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
105 |
|
106 |
-
|
|
|
|
|
|
|
107 |
|
108 |
-
## Training and evaluation data
|
109 |
|
110 |
-
|
|
|
|
|
|
|
111 |
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
The following hyperparameters were used during training:
|
117 |
-
- learning_rate: 1e-06
|
118 |
-
- train_batch_size: 2
|
119 |
-
- eval_batch_size: 2
|
120 |
-
- seed: 42
|
121 |
-
- distributed_type: multi-GPU
|
122 |
-
- num_devices: 8
|
123 |
-
- gradient_accumulation_steps: 2
|
124 |
-
- total_train_batch_size: 32
|
125 |
-
- total_eval_batch_size: 16
|
126 |
-
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
127 |
-
- lr_scheduler_type: constant
|
128 |
-
- lr_scheduler_warmup_steps: 73
|
129 |
-
- num_epochs: 1
|
130 |
|
131 |
-
|
132 |
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
- Datasets 2.19.1
|
140 |
-
- Tokenizers 0.19.1
|
|
|
8 |
results: []
|
9 |
---
|
10 |
|
|
|
|
|
11 |
|
12 |
+
![Trinity](https://huggingface.co/migtissera/Trinity-13B-v1.0/resolve/main/Trinity.png)
|
|
|
13 |
|
14 |
+
Tess, short for Tesoro (Treasure in Italian), is a general purpose Large Language Model series created by [Migel Tissera](https://x.com/migtissera).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
The compute for this model was generously sponsored by [KindoAI](https://kindo.ai).
|
17 |
|
|
|
18 |
|
19 |
+
# Sample Inference Python Script:
|
20 |
|
21 |
+
```python
|
22 |
+
import torch, json
|
23 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
24 |
|
25 |
+
model_path = "migtissera/Tess-3-Llama-3.1-405B"
|
26 |
|
27 |
+
model = AutoModelForCausalLM.from_pretrained(
|
28 |
+
model_path,
|
29 |
+
torch_dtype=torch.float16,
|
30 |
+
device_map="auto",
|
31 |
+
load_in_4bit=True,
|
32 |
+
trust_remote_code=False,
|
33 |
+
)
|
34 |
|
35 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=False)
|
36 |
|
37 |
+
terminators = [
|
38 |
+
tokenizer.convert_tokens_to_ids("<|end_of_text|>"),
|
39 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>"),
|
40 |
+
]
|
41 |
|
|
|
42 |
|
43 |
+
def generate_text(instruction):
|
44 |
+
tokens = tokenizer.encode(instruction)
|
45 |
+
tokens = torch.LongTensor(tokens).unsqueeze(0)
|
46 |
+
tokens = tokens.to("cuda")
|
47 |
|
48 |
+
instance = {
|
49 |
+
"input_ids": tokens,
|
50 |
+
"top_p": 1.0,
|
51 |
+
"temperature": 0.75,
|
52 |
+
"generate_len": 2048,
|
53 |
+
"top_k": 50,
|
54 |
+
}
|
55 |
|
56 |
+
length = len(tokens[0])
|
57 |
+
with torch.no_grad():
|
58 |
+
rest = model.generate(
|
59 |
+
input_ids=tokens,
|
60 |
+
max_length=length + instance["generate_len"],
|
61 |
+
use_cache=True,
|
62 |
+
do_sample=True,
|
63 |
+
top_p=instance["top_p"],
|
64 |
+
temperature=instance["temperature"],
|
65 |
+
top_k=instance["top_k"],
|
66 |
+
num_return_sequences=1,
|
67 |
+
pad_token_id=tokenizer.eos_token_id,
|
68 |
+
eos_token_id=terminators,
|
69 |
+
)
|
70 |
+
output = rest[0][length:]
|
71 |
+
string = tokenizer.decode(output, skip_special_tokens=True)
|
72 |
+
return f"{string}"
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
conversation = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are Tess, 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"""
|
76 |
|
77 |
|
78 |
+
while True:
|
79 |
+
user_input = input("You: ")
|
80 |
+
llm_prompt = f"{conversation}{user_input}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
|
81 |
+
answer = generate_text(llm_prompt)
|
82 |
+
print(answer)
|
83 |
|
84 |
+
conversation = (
|
85 |
+
f"{llm_prompt}{answer}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n"
|
86 |
+
)
|
87 |
|
88 |
+
json_data = {"prompt": user_input, "answer": answer}
|
89 |
+
```
|
|
|
|