This is a base instruct model without any chat finetuning or reinforcement learning to mitigate safety concerns. This is simply trained on a custom dataset of 49,152 high quality examples from Alpaca, Pubmed, ScienceQA, and a few other datasets. Check out the "files and versions" tab of this repository for an example of inference, "Instruct_GPT_J_Gradio_Demo.ipynb"
This is a little convoluted but if you'd like to use the model as a chatbot, you can first run the gradio demo, and then use the api provided to create a simple loop, I provide "chat-aurora.py" for this purpose, it's usage is as follows.
I use a prompt that I generated/edited collaboratively with GPT-4 for both instruct and chat, it's a bit of a lie to the model but it is fun:
Remember to play with the hyperparameters when using the model, and that chat is not it's primary functionality .
If you'd simply like to use it as an instruct model, you can inference using either the gradio demo or like this:
1import torch
2from peft import PeftModel, PeftConfig
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5peft_model_id = "crumb/aurora-1.0"
6config = PeftConfig.from_pretrained(peft_model_id)
7model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto', revision='sharded')
8tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
9
10# Load the Lora model
11model = PeftModel.from_pretrained(model, peft_model_id)
12
13# This example is in the alpaca training set
14batch = tokenizer("Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: How can we reduce air pollution? ### Response: Let's break this problem down and work it out in a step by step way to be sure we have the right answer. ", return_tensors='pt')
15
16with torch.cuda.amp.autocast():
17 output_tokens = model.generate(**batch, max_new_tokens=256)
18
19print(tokenizer.decode(output_tokens[0], skip_special_tokens=True))
20"""
21Let's break this problem down and work it out in a step by step way to be sure we have the right answer.
22First, let's identify what causes air pollution. It comes from many sources such as cars, factories, power plants, burning fossil fuels, agricultural fertilizers, and other industrial activities. Next, we need to determine which steps we can take to lower air pollution levels. This includes reducing emissions from cars, improving fuel efficiency, using renewable energy sources such as solar or wind, and recycling materials. We can also reduce our dependence on fossil fuels through switching to cleaner forms of transportation like electric vehicles and public transport. Finally, we must educate people about the importance of environmental sustainability and encourage them to use sustainable practices when possible.
23In conclusion, reducing air pollution requires taking action at every level. We need to reduce emissions, improve efficiency, promote alternative forms of energy, and raise awareness.
24"""
You can turn an instruction, system, and input prompt into a prompt for the model like this
1def prompt(instruction, system='', input=''):
2 if input=='':
3 return f"{system} Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: {instruction} ### Response: "
4 return f"{system} Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. ### Instruction: {instruction} ### Input: {input} ### Response: "
I still need to evaluate the model a lot more but I'm so sleepy and swamped with college work