Update README.md
Browse files
README.md
CHANGED
@@ -25,7 +25,7 @@ Now imagine, if you will, having this bad boy generate a bunch of different prom
|
|
25 |
|
26 |
In other words, giving it a system prompt like "You are a creative writing partner", "You are an advanced coding assistant", "You are a damn good psychologist", etc, you can can quickly generate prompts for a niche dataset that can then be answered by large model.
|
27 |
|
28 |
-
In a different language: Ved hjælp af Husskades indsigt, hvor man udnytter sprogmodellers natur til at skabe tilpasningsdata, kan man med fordel bruge denne sprogmodel til at skrive instruktioner, og endda styre indholdet ved hjælp
|
29 |
|
30 |
## Training
|
31 |
|
@@ -50,7 +50,7 @@ All the datasets were used seperately and merged together using [Model Stock](ht
|
|
50 |
It actually generates an EOS token at the end of a *"user"* prompt. Lawdy that has been a pain when trying to use large models for this purpose. Good luck; have fun.
|
51 |
|
52 |
|
53 |
-
###
|
54 |
Giving the model this text at a temperature of 0.9:
|
55 |
```
|
56 |
<|im_start|>system
|
@@ -60,4 +60,37 @@ You are an AI coding assistant.<|im_end|>
|
|
60 |
Will return this:
|
61 |
```
|
62 |
Hey, can you help me write a simple program that generates a Fibonacci sequence until a certain number of terms? Like this: Fib(5) should give me the first five numbers in the series.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
```
|
|
|
25 |
|
26 |
In other words, giving it a system prompt like "You are a creative writing partner", "You are an advanced coding assistant", "You are a damn good psychologist", etc, you can can quickly generate prompts for a niche dataset that can then be answered by large model.
|
27 |
|
28 |
+
In a different language: Ved hjælp af Husskades indsigt, hvor man udnytter sprogmodellers natur til at skabe tilpasningsdata, kan man med fordel bruge denne sprogmodel til at skrive instruktioner, og endda styre indholdet ved hjælp af system beskeden.
|
29 |
|
30 |
## Training
|
31 |
|
|
|
50 |
It actually generates an EOS token at the end of a *"user"* prompt. Lawdy that has been a pain when trying to use large models for this purpose. Good luck; have fun.
|
51 |
|
52 |
|
53 |
+
### Response preview
|
54 |
Giving the model this text at a temperature of 0.9:
|
55 |
```
|
56 |
<|im_start|>system
|
|
|
60 |
Will return this:
|
61 |
```
|
62 |
Hey, can you help me write a simple program that generates a Fibonacci sequence until a certain number of terms? Like this: Fib(5) should give me the first five numbers in the series.
|
63 |
+
```
|
64 |
+
|
65 |
+
### Code example to use it
|
66 |
+
|
67 |
+
```python
|
68 |
+
import torch
|
69 |
+
from unsloth import FastLanguageModel
|
70 |
+
|
71 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
72 |
+
"trollek/LittleInstructionMaker-4B-v0.1",
|
73 |
+
dtype=torch.bfloat16,
|
74 |
+
load_in_4bit=True,
|
75 |
+
max_seq_length=8192
|
76 |
+
)
|
77 |
+
FastLanguageModel.for_inference(model)
|
78 |
+
|
79 |
+
def instruction_generator(system_message: str, num_instructions: int) -> str:
|
80 |
+
if system_message is None or "":
|
81 |
+
raise ValueError
|
82 |
+
if num_instructions < 1:
|
83 |
+
raise ValueError
|
84 |
+
magpie_template = f"<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n"
|
85 |
+
input_ids = tokenizer(danube_magpie, return_tensors="pt").input_ids.to("cuda")
|
86 |
+
for idx in range(num_instructions):
|
87 |
+
generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.9, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id)
|
88 |
+
response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True)
|
89 |
+
yield response
|
90 |
+
|
91 |
+
for instruct in instruction_generator("You are an AI coding assistant.", 2):
|
92 |
+
print(instruct)
|
93 |
+
|
94 |
+
# Can you help me write a simple programming language syntax?
|
95 |
+
# I want to create a Python program for a social media app that allows users to post and comment on stories. The message I want to convey is that staying connected with others is essential in life. Can you suggest a way to design the program?
|
96 |
```
|