Finetune
Collection
11 items
•
Updated
Model Name: thesven/Phi3-mini-128k-guanaco
Base Model: microsoft/Phi-3-mini-128k-instruct
Fine-tuning Method: Supervised Fine-Tuning (SFT)
Dataset: Guanaco Clean
Training Data: A subset of filtered chats from the Guanaco dataset where the total input length was equal or less than 512 tokens.
Training Duration: 8 hours
Hardware: Nvidia RTX A4500
Epochs: 3
This model was finetuned on chat sequences to improve it's overall chat performance.
This model is designed to improve instruction-following capabilities, particularly for code-related tasks.
<|system|> {system_message} <|end|> <|user|> {Prompt) <|end|> <|assistant|>
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
model_name_or_path = "thesven/Phi3-mini-128k-guanaco"
# BitsAndBytesConfig for loading the model in 4-bit precision
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype="float16",
)
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
model_name_or_path,
device_map="auto",
trust_remote_code=False,
revision="main",
quantization_config=bnb_config
)
model.pad_token = model.config.eos_token_id
prompt_template = '''
<|system|>
You are an expert developer. Please help me with any coding questions.<|end|>
<|user|>
Create a function to get the total sum from an array of ints.<|end|>
<|assistant|>
'''
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.1, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=256)
generated_text = tokenizer.decode(output[0, len(input_ids[0]):], skip_special_tokens=True)
print(generated_text)