lunahr commited on
Commit
520cd1c
1 Parent(s): af65ae7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +68 -0
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: llama3.2
5
+ tags:
6
+ - text-generation-inference
7
+ - transformers
8
+ - llama
9
+ - trl
10
+ - sft
11
+ - reasoning
12
+ - llama-3
13
+ base_model: chuanli11/Llama-3.2-3B-Instruct-uncensored
14
+ datasets:
15
+ - KingNish/reasoning-base-20k
16
+ - lunahr/thea-name-overrides
17
+ ---
18
+
19
+ # Model Description
20
+
21
+ An uncensored reasoning Llama 3.2 3B model trained on reasoning data.
22
+
23
+ This is the 2nd revision of Thea, based on a better base model, and with twice the reasoning data.
24
+
25
+ It has been trained using improved training code, and gives an improved performance.
26
+ Here is what inference code you should use:
27
+ ```py
28
+ from transformers import AutoModelForCausalLM, AutoTokenizer
29
+
30
+ MAX_REASONING_TOKENS = 1024
31
+ MAX_RESPONSE_TOKENS = 512
32
+
33
+ model_name = "lunahr/thea-v2-3b-50r"
34
+
35
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
36
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
37
+
38
+ prompt = "Which is greater 9.9 or 9.11 ??"
39
+ messages = [
40
+ {"role": "user", "content": prompt}
41
+ ]
42
+
43
+ # Generate reasoning
44
+ reasoning_template = tokenizer.apply_chat_template(messages, tokenize=False, add_reasoning_prompt=True)
45
+ reasoning_inputs = tokenizer(reasoning_template, return_tensors="pt").to(model.device)
46
+ reasoning_ids = model.generate(**reasoning_inputs, max_new_tokens=MAX_REASONING_TOKENS)
47
+ reasoning_output = tokenizer.decode(reasoning_ids[0, reasoning_inputs.input_ids.shape[1]:], skip_special_tokens=True)
48
+
49
+ print("REASONING: " + reasoning_output)
50
+
51
+ # Generate answer
52
+ messages.append({"role": "reasoning", "content": reasoning_output})
53
+ response_template = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
54
+ response_inputs = tokenizer(response_template, return_tensors="pt").to(model.device)
55
+ response_ids = model.generate(**response_inputs, max_new_tokens=MAX_RESPONSE_TOKENS)
56
+ response_output = tokenizer.decode(response_ids[0, response_inputs.input_ids.shape[1]:], skip_special_tokens=True)
57
+
58
+ print("ANSWER: " + response_output)
59
+ ```
60
+
61
+ - **Trained by:** [Piotr Zalewski](https://huggingface.co/lunahr)
62
+ - **License:** llama3.2
63
+ - **Finetuned from model:** [chuanli11/Llama-3.2-3B-Instruct-uncensored](https://huggingface.co/chuanli11/Llama-3.2-3B-Instruct-uncensored)
64
+ - **Dataset used:** [KingNish/reasoning-base-20k](https://huggingface.co/datasets/KingNish/reasoning-base-20k)
65
+
66
+ This Llama model was trained faster than [Unsloth](https://github.com/unslothai/unsloth) using [custom training code](https://www.kaggle.com/code/piotr25691/distributed-llama-training-with-2xt4).
67
+
68
+ Visit https://www.kaggle.com/code/piotr25691/distributed-llama-training-with-2xt4 to find out how you can finetune your models using BOTH of the Kaggle provided GPUs.