Update README.md
Browse files
README.md
CHANGED
|
@@ -198,9 +198,81 @@ Step Training Loss
|
|
| 198 |
4 0.331900
|
| 199 |
5 0.276100
|
| 200 |
|
| 201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
-
|
|
|
|
| 204 |
|
| 205 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 206 |
|
|
|
|
| 198 |
4 0.331900
|
| 199 |
5 0.276100
|
| 200 |
|
| 201 |
+
Quick test 1 after training the last part of the dataset:
|
| 202 |
+
|
| 203 |
+
# alpaca_prompt = Copied from above
|
| 204 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 205 |
+
inputs = tokenizer(
|
| 206 |
+
[
|
| 207 |
+
alpaca_prompt.format(
|
| 208 |
+
"Continue the fibonnaci sequence.", # instruction
|
| 209 |
+
"1, 1, 2, 3, 5, 8", # input
|
| 210 |
+
"", # output - leave this blank for generation!
|
| 211 |
+
)
|
| 212 |
+
], return_tensors = "pt").to("cuda")
|
| 213 |
+
|
| 214 |
+
AI Response: ['<s> Below is an instruction that describes a task. Write a response that appropriately completes the request.\n### Input:\nContinue the fibonnaci sequence.\n\n### Output:\n1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 420, 787, 1444, 2881, 4765, 8640']
|
| 215 |
+
|
| 216 |
+
Quick test 2 after training the last part of the dataset:
|
| 217 |
+
|
| 218 |
+
# alpaca_prompt = Copied from above
|
| 219 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 220 |
+
inputs = tokenizer(
|
| 221 |
+
[
|
| 222 |
+
alpaca_prompt.format(
|
| 223 |
+
"Continue the fibonnaci sequence.", # instruction
|
| 224 |
+
"1, 1, 2, 3, 5, 8", # input
|
| 225 |
+
"", # output - leave this blank for generation!
|
| 226 |
+
)
|
| 227 |
+
], return_tensors = "pt").to("cuda")
|
| 228 |
+
|
| 229 |
+
from transformers import TextStreamer
|
| 230 |
+
text_streamer = TextStreamer(tokenizer)
|
| 231 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
|
| 232 |
+
|
| 233 |
+
AI Response: <s> Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
| 234 |
+
### Input:
|
| 235 |
+
Continue the fibonnaci sequence.
|
| 236 |
+
|
| 237 |
+
### Output:
|
| 238 |
+
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 420, 787, 1444, 2881, 4765, 8640, 17281, 31362, 65325, 128672, 251345, 410000, 720000, 1280000,
|
| 239 |
+
|
| 240 |
+
Quick test 3 after training the last part of the dataset:
|
| 241 |
+
|
| 242 |
+
if False:
|
| 243 |
+
from unsloth import FastLanguageModel
|
| 244 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 245 |
+
model_name = "lora_model", # YOUR MODEL YOU USED FOR TRAINING
|
| 246 |
+
max_seq_length = max_seq_length,
|
| 247 |
+
dtype = dtype,
|
| 248 |
+
load_in_4bit = load_in_4bit,
|
| 249 |
+
)
|
| 250 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 251 |
+
|
| 252 |
+
# alpaca_prompt = You MUST copy from above!
|
| 253 |
+
|
| 254 |
+
inputs = tokenizer(
|
| 255 |
+
[
|
| 256 |
+
alpaca_prompt.format(
|
| 257 |
+
"What is a famous tall tower in Paris?", # instruction
|
| 258 |
+
"", # input
|
| 259 |
+
"", # output - leave this blank for generation!
|
| 260 |
+
)
|
| 261 |
+
], return_tensors = "pt").to("cuda")
|
| 262 |
+
|
| 263 |
+
from transformers import TextStreamer
|
| 264 |
+
text_streamer = TextStreamer(tokenizer)
|
| 265 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 64)
|
| 266 |
+
|
| 267 |
+
AI Response: <s> Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
| 268 |
+
### Input:
|
| 269 |
+
What is a famous tall tower in Paris?
|
| 270 |
+
|
| 271 |
+
### Output:
|
| 272 |
+
The famous tall tower in Paris is the Eiffel Tower. It is a 300-meter-tall steel tower located in the heart of Paris, France. The tower was built in 18892 and is a popular tourist attraction. It is also a symbol of the city
|
| 273 |
|
| 274 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
| 275 |
+
tokenizer.batch_decode(outputs)
|
| 276 |
|
| 277 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 278 |
|