Downloads · 30 days
0
HuyRemy/aichat
aichat is a machine learning model from HuyRemy. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Just only a text gen model type, I'm just test train my dataset and...it's work, very nice, try it.
Downloads · 30 days
0
Access
Public
Updated Apr 25, 2024
Repo size
336 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 100%
From the Hugging Face model README
Just only a text gen model type, I'm just test train my dataset and...it's work, very nice, try it.
This is the model card of a 🤗 transformers model that has been pushed on the Hub.
USE T4 GPU
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps xformers trl peft accelerate bitsandbytes
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048
dtype = None
load_in_4bit = True
alpaca_prompt = """
### Instruction:
{}
### Input:
{}
### Response:
{}"""
def formatting_prompts_func(examples):
instructions = examples["instruction"]
inputs = examples["input"]
outputs = examples["output"]
texts = []
for instruction, input, output in zip(instructions, inputs, outputs):
text = alpaca_prompt.format(instruction, input, output) + EOS_TOKEN
texts.append(text)
return { "text" : texts, }
pass
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "huyremy/aichat",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
FastLanguageModel.for_inference(model)
EOS_TOKEN = tokenizer.eos_token
inputs = tokenizer(
[
alpaca_prompt.format(
"who is Nguyễn Phú Trọng?",
"",
"",
),
], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
tokenizer.batch_decode(outputs)