File size: 877 Bytes
2a12b77 9a0f501 2a12b77 9a0f501 2a12b77 9a0f501 2a12b77 9a0f501 2a12b77 9a0f501 2a12b77 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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() |