Ramikan-BR
commited on
Commit
•
e2f6c35
1
Parent(s):
f990710
Update README.md
Browse files
README.md
CHANGED
@@ -12,6 +12,77 @@ tags:
|
|
12 |
- sft
|
13 |
---
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Uploaded model
|
16 |
|
17 |
- **Developed by:** Ramikan-BR
|
|
|
12 |
- sft
|
13 |
---
|
14 |
|
15 |
+
## From the 10 refinement started answering the last fibonassi numbers wrong again, and now in this 13 refinement using Lora is back to answering correctly and writing the code to train an offline AI correctly.
|
16 |
+
|
17 |
+
1 - Question
|
18 |
+
|
19 |
+
if False:
|
20 |
+
from unsloth import FastLanguageModel
|
21 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
22 |
+
model_name = "lora_model", # YOUR MODEL YOU USED FOR TRAINING
|
23 |
+
max_seq_length = max_seq_length,
|
24 |
+
dtype = dtype,
|
25 |
+
load_in_4bit = load_in_4bit,
|
26 |
+
)
|
27 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
28 |
+
|
29 |
+
# alpaca_prompt = You MUST copy from above!
|
30 |
+
|
31 |
+
inputs = tokenizer(
|
32 |
+
[
|
33 |
+
alpaca_prompt.format(
|
34 |
+
"I need train a AI offline on my computer, give me a code good for this case.", # instruction
|
35 |
+
"", # input
|
36 |
+
"", # output - leave this blank for generation!
|
37 |
+
)
|
38 |
+
], return_tensors = "pt").to("cuda")
|
39 |
+
|
40 |
+
from transformers import TextStreamer
|
41 |
+
text_streamer = TextStreamer(tokenizer)
|
42 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 4096)
|
43 |
+
|
44 |
+
2 - Answer
|
45 |
+
|
46 |
+
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
47 |
+
|
48 |
+
### Input:
|
49 |
+
I need train a AI offline on my computer, give me a code good for this case.
|
50 |
+
|
51 |
+
### Output:
|
52 |
+
Sure, here's a simple example of how you can train an AI model on a computer using Python and TensorFlow. This is a very basic example and doesn't include many features that are commonly used in real-world applications.
|
53 |
+
|
54 |
+
Firstly, you need to install the necessary libraries. You can do this using pip:
|
55 |
+
|
56 |
+
```python
|
57 |
+
pip install tensorflow
|
58 |
+
```
|
59 |
+
|
60 |
+
Then, you can start training your model:
|
61 |
+
|
62 |
+
```python
|
63 |
+
import tensorflow as tf
|
64 |
+
from tensorflow.keras import models, layers
|
65 |
+
|
66 |
+
# define the model
|
67 |
+
model = tf.keras.models.Sequential([
|
68 |
+
tf.keras.layers.Dense(64, activation='relu', input_shape=(100,)),
|
69 |
+
tf.keras.layers.Dense(64, activation='relu'),
|
70 |
+
tf.keras.layers.Dense(10)
|
71 |
+
])
|
72 |
+
|
73 |
+
# compile the model
|
74 |
+
model.compile(optimizer='adam',
|
75 |
+
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
|
76 |
+
metrics=['accuracy'])
|
77 |
+
|
78 |
+
# train the model
|
79 |
+
model.fit(X_train, y_train, epochs=10)
|
80 |
+
```
|
81 |
+
|
82 |
+
Here, `X_train` and `y_train` are your training data, and `X_train.shape` and `y_train.shape` are the shape of your training data.
|
83 |
+
|
84 |
+
Please note that this is a very simple example and you may need to adjust the model architecture, number of layers, number of neurons in each layer, and other parameters depending on your specific problem.<|endoftext|>
|
85 |
+
|
86 |
# Uploaded model
|
87 |
|
88 |
- **Developed by:** Ramikan-BR
|