lunahr commited on
Commit
77f5b01
·
verified ·
1 Parent(s): 38f3e49

write readme

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md CHANGED
@@ -1,3 +1,75 @@
1
  ---
 
 
2
  license: llama3.2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: CreitinGameplays/Llama-3.2-3b-Instruct-uncensored-refinetune
14
+ datasets:
15
+ - KingNish/reasoning-base-20k
16
+ pipeline_tag: text-generation
17
+ library_name: transformers
18
  ---
19
+
20
+ # Model Description
21
+
22
+ An uncensored reasoning Llama 3.2 3B model trained on reasoning data.
23
+
24
+ It has been trained using improved training code, and gives an improved performance.
25
+
26
+ This is a Thea 3B Update 1 model. The new features are:
27
+
28
+ - Trained on more examples than the original Thea model.
29
+ - Based off a different base model, with some of the lost accuracy points (hopefully) restored.
30
+
31
+ This model has not been tested in a GGUF setting yet. Try it in a GGUF setting yourself by using the [GGUF My Repo space](https://huggingface.co/spaces/ggml-org/gguf-my-repo).
32
+
33
+ Here is what inference code you should use:
34
+ ```py
35
+ from transformers import AutoModelForCausalLM, AutoTokenizer
36
+
37
+ MAX_REASONING_TOKENS = 1024
38
+ MAX_RESPONSE_TOKENS = 512
39
+
40
+ model_name = "lunahr/thea-3b-50r-u1"
41
+
42
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
43
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
44
+
45
+ prompt = "Which is greater 9.9 or 9.11 ??"
46
+ messages = [
47
+ {"role": "user", "content": prompt}
48
+ ]
49
+
50
+ # Generate reasoning
51
+ reasoning_template = tokenizer.apply_chat_template(messages, tokenize=False, add_reasoning_prompt=True)
52
+ reasoning_inputs = tokenizer(reasoning_template, return_tensors="pt").to(model.device)
53
+ reasoning_ids = model.generate(**reasoning_inputs, max_new_tokens=MAX_REASONING_TOKENS)
54
+ reasoning_output = tokenizer.decode(reasoning_ids[0, reasoning_inputs.input_ids.shape[1]:], skip_special_tokens=True)
55
+
56
+ print("REASONING: " + reasoning_output)
57
+
58
+ # Generate answer
59
+ messages.append({"role": "reasoning", "content": reasoning_output})
60
+ response_template = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
61
+ response_inputs = tokenizer(response_template, return_tensors="pt").to(model.device)
62
+ response_ids = model.generate(**response_inputs, max_new_tokens=MAX_RESPONSE_TOKENS)
63
+ response_output = tokenizer.decode(response_ids[0, response_inputs.input_ids.shape[1]:], skip_special_tokens=True)
64
+
65
+ print("ANSWER: " + response_output)
66
+ ```
67
+
68
+ - **Trained by:** [Piotr Zalewski](https://huggingface.co/lunahr)
69
+ - **License:** llama3.2
70
+ - **Finetuned from model:** [CreitinGameplays/Llama-3.2-3b-Instruct-uncensored-refinetune](https://huggingface.co/CreitinGameplays/Llama-3.2-3b-Instruct-uncensored-refinetune)
71
+ - **Dataset used:** [KingNish/reasoning-base-20k](https://huggingface.co/datasets/KingNish/reasoning-base-20k)
72
+
73
+ 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).
74
+
75
+ 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.