Downloads · 30 days
84
2% of all-time downloads
Ramikan-BR/Qwen2-0.5B-v9
Qwen2-0.5B-v9 is a text generation model from Ramikan-BR. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
84
2% of all-time downloads
All-time downloads
3.6K
Public
Parameters
494M
3 GB on disk
Likes
0
Public
Click a slice to open those files.
.gguf994 MB · 33%
From the Hugging Face model README
1 - Question:
FastLanguageModel.for_inference(model) # Enable native 2x faster inference inputs = tokenizer( [ alpaca_prompt.format( "Continue the fibonnaci sequence.", # instruction "1, 1, 2, 3, 5, 8", # input "", # output - leave this blank for generation! ) ], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 128, use_cache = True) tokenizer.batch_decode(outputs)
1 - Answer:
2 - Question:
FastLanguageModel.for_inference(model) # Enable native 2x faster inference inputs = tokenizer( [ alpaca_prompt.format( "What is fibonacci sequence?", # instruction "", # input "", # output - leave this blank for generation! ) ], return_tensors = "pt").to("cuda")
from transformers import TextStreamer text_streamer = TextStreamer(tokenizer) _ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
2 - Answer:
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
What is fibonacci sequence?
3 - Question:
if False: from unsloth import FastLanguageModel model, tokenizer = FastLanguageModel.from_pretrained( model_name = "lora_model", # YOUR MODEL YOU USED FOR TRAINING max_seq_length = max_seq_length, dtype = dtype, load_in_4bit = load_in_4bit, ) FastLanguageModel.for_inference(model) # Enable native 2x faster inference
inputs = tokenizer( [ alpaca_prompt.format( "I need train a AI offline on my computer, give me a code very good for this case.", # instruction "", # input "", # output - leave this blank for generation! ) ], return_tensors = "pt").to("cuda")
from transformers import TextStreamer text_streamer = TextStreamer(tokenizer) _ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 4096)
3 - Answer:
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
I need train a AI offline on my computer, give me a code very good for this case.
Sure, I'd be happy to help you with that! Here's a simple example of how you could use TensorFlow, a popular deep learning library for Python, to train an AI model on your computer.
Firstly, you'll need to install TensorFlow on your computer. You can do this using pip:
pip install tensorflow
Once you have installed TensorFlow, you can start training your model. Here's a simple example:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
# define the model
model = tf.keras.Sequential([
tf.keras.layers.Dense(64, activation='relu', input_shape=(784,)),
tf.keras.layers.Dense(64, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax')
])
# compile the model
model.compile(optimizer='adam',
loss='categorical_crossentropy',
metrics=['accuracy'])
# train the model
model.fit(x_train, y_train, epochs=10)
In this example, we are using the Sequential model, which is a simple way to build a model. The model consists of two layers: one dense layer with 64 units and ReLU activation, and another dense layer with 64 units and also ReLU activation. The output layer has 10 units and softmax activation.
The model is then compiled with the Adam optimizer and categorical cross-entropy loss function. The model is then trained for 10 epochs.
Please note that this is a very simple example and you may need to adjust the model architecture, number of layers, number of units, and other parameters depending on your specific problem.
Also, remember that you need to install the necessary libraries first, which are TensorFlow and Keras. You can do this using pip:
pip install tensorflow
pip install keras
Once you have installed these libraries, you can run your code.
I hope this helps!<|endoftext|>
This qwen2 model was trained 2x faster with Unsloth and Huggingface's TRL library.