Amith Adiraju
1. Added custom fine tuned model to provide item explanations is specific format.
5a29f4a
import torch | |
import re | |
model_inf_inp_prompt = "INSTRUCTION: given food item name, explain these things:(major ingredients,making process,portion & spicy/sweet,pairs with,allergens,food type(veg/non-veg/vegan)). ensure to get allergens and food category factually correct.Item Name: {} " | |
header_pattern = r'Item Name: (.*?)\. Major Ingredients: (.*?)\. Making Process: (.*?)\. Portion and Spice Level: (.*?)\. Pairs With: (.*?)\. Allergens: (.*?)\. Food Type: (.*?)\.\s*</s>' | |
dots_pattern = re.compile(r'\.{3,}') | |
DEBUG_MODE = True | |
model_name = "AmithAdiraju1694/gpt-neo-125M_menuitemexp" | |
def get_device(): | |
if torch.cuda.is_available(): | |
device = torch.device("cuda") | |
print(f"Using GPU: {torch.cuda.get_device_name(0)}") #get the name of the GPU being used. | |
else: | |
device = torch.device("cpu") | |
print("Using CPU") | |
return device | |
DEVICE = get_device() |