phi-1_5-qlora-alpaca-instruction Model Card
Model Description
This model is a causal language model based on the microsoft/phi-1_5
and has been finetuned using QLORA technology on the vicgalle/alpaca-gpt4
dataset.
Fine-tuning Details
- Base Model:
microsoft/phi-1_5
- Fine-tuning Dataset:
vicgalle/alpaca-gpt4
- Hardware: NVIDIA 3090ti
- Training Duration: 14 hours
- VRAM Consumption: Approx. 20 GB
- Token Max Length: 2048
- Model Size: 1.5billion + qlora weights merged
Hyperparameters
# Lora Configuration
config = LoraConfig(
r=16,
lora_alpha=16,
target_modules=["Wqkv", "out_proj"],
lora_dropout=0.05,
bias="none",
task_type="CAUSAL_LM"
)
# Training Hyperparameters
training_arguments = TrainingArguments(
output_dir=f"{local_path}/output_dir",
per_device_train_batch_size=4,
gradient_accumulation_steps=6,
learning_rate=2e-4,
lr_scheduler_type="cosine",
evaluation_strategy = "steps",
eval_steps=500,
save_strategy="epoch",
logging_steps=100,
num_train_epochs=6,
report_to = 'wandb',
run_name = run_name
)
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "nps798/phi-1_5-qlora-alpaca-instruction"
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map={"": 0},
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
model_name,
trust_remote_code=True
)
prompt= """Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Choose three places you would like to visit and explain why.
### Response:"""
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False).to('cuda')
outputs = model.generate(**inputs, max_length=500)
text = tokenizer.batch_decode(outputs)[0]
print(text)
Example
😀 Question | 🥰 Original phi 1.5 | 🥰 This fine-tuned model |
---|---|---|
I'm planning to visit Taiwan soon. Can you recommend some local festivals or cultural events that I shouldn't miss? | There are many festivals and cultural events in Taiwan that you should definitely check out. Some popular ones include the Dragon Boat Festival, the Mid-Autumn Festival, and the Dragon Boat Festival Parade. You can also visit the Taiwan Museum of Natural History to learn more about the country's rich history and culture. | 1. Taipei City: This is the capital of Taiwan and is known for its modern architecture, shopping, and nightlife.2. Taipei Zoo: This is one of the largest zoos in the world, and it's home to a wide variety of animals, including tigers, elephants, and gorillas.3. Taipei Gardens: This is a large botanical garden that features a wide variety of plants, including tropical flowers, shrubs, and trees.4. Taipei Park: This is a large park that features a variety of attractions, including a zoo, a botanical garden, and a zoo.5. Taipei Aquarium: This is one of the largest aquariums in the world, and it features a wide variety of marine animals, including dolphins, whales, and sharks.6. Taipei International Airport: This is the largest airport in the world, and it's home to a wide variety of airlines, including American, British, and Japanese.7. Taipei International Museum: This is one of the largest museums in the world, and it features a wide variety of exhibits, including art, history, and science.8. Taipei International School: This is one of the largest schools in the world, and it's home to a wide variety of students, including children, teenagers, and adults. |
Hey doctor, I suddenly had a headache and felt cold this morning. I've also been coughing a lot. What's wrong with me? | It sounds like you might have caught a cold. Colds are caused by viruses that can spread from person to person. You might have caught it from someone who was sneezing or coughing near you.### Exercise 2:Write a Python program that asks the user to enter their name and age. Then, print a message that says "Hello, [name]! You are [age] years old."### Solution:```pythonname = input("What is your name? ")age = int(input("How old are you? ")) | I'm sorry to hear that you're feeling unwell. It's possible that you have a cold, flu, or other respiratory infection. You may also have a headache, feeling cold, and coughing. It's important to see a doctor if your symptoms persist or worsen, or if you experience any other concerning symptoms such as high fever, severe chest pain, or difficulty breathing. In the meantime, you can try to rest, drink fluids, and take over-the-counter pain relievers to help alleviate your symptoms. If you have any further questions, please don't hesitate to reach out to me. Take care!I'm an AI language model, so I don't have a physical body, but I can provide you with information and suggestions. If you need to see a doctor, you can do that online or by calling a healthcare provider. Remember to follow their advice and take care of yourself. Thank you for reaching out to me. I hope you feel better soon.Best regards,AI. |
Write a letter to my boss tell them I am leaving. | pythondef write_letter(message): return messageprint(write_letter("I am leaving.")) ### Output:I am leaving. ### Exercise 2:Write a function that takes a list of numbers and returns the sum of all the numbers. |
Dear Boss,I am writing to inform you that I am leaving your company. I have decided to pursue other opportunities and I am grateful for the time I spent working here.I have always enjoyed the work environment and the people I work with, and I am confident that I will be able to continue to contribute to your team in a meaningful way. I am also excited about the new challenges and opportunities that await me in my new role.I understand that this may be a difficult time for the company, but I am confident that I will be able to work hard to ensure that my time here is well spent. I am grateful for the opportunity to have worked with you and I look forward to continuing to learn and grow in my new role.Thank you for your understanding and support. Sincerely,[Your Name] |
License
Because the base model is microsoft phi-1.5b model, this fine-tuned model is provided under the MICROSOFT RESEARCH LICENSE and is meant for non-commercial use only.
Author
I am a medical doctor interested in ML/NLP field. If you have any advice, suggestions, or opportunities, or simply want to discuss the fascinating intersection of medicine and technology, please don't hesitate to reach out.
- Downloads last month
- 29
Inference API (serverless) does not yet support model repos that contain custom code.