Skip to content
Snippets Groups Projects
Commit 00657e6e authored by gaojingtong's avatar gaojingtong
Browse files

Update 3 files

- /models/vanilla_llama3_baseline_track3.py
- /models/user_config.py
- /aicrowd.json
parent 294e052e
No related branches found
Tags submission-jyy-gpt5.1-specify-dyn-v1
No related merge requests found
{
"challenge_id": "amazon-kdd-cup-24-understanding-shopping-concepts",
"challenge_id": "amazon-kdd-cup-24-user-behavior-alignment",
"authors": [
"gaojingtong"
],
......
# Importing DummyModel from the models package.
# The DummyModel class is located in the dummy_model.py file inside the 'models' directory.
from models.dummy_model import DummyModel
from models.vanilla_llama3_baseline_track1 import Llama3_70B_ZeroShotModel
from models.vanilla_llama3_baseline_track3 import Llama3_70B_ZeroShotModel
# This line establishes an alias for the DummyModel class to be used within this script.
# Instead of directly using DummyModel everywhere in the code, we're assigning it to 'UserModel'.
......
......@@ -36,6 +36,7 @@ class Llama3_70B_ZeroShotModel(ShopBenchBaseModel):
self.generation_keys = ["Instructions:", "Explain ", "Translate ", "an adequate"]
self.max_new_tokens = 0
self.temperature = 0.0
self.new_prompts = ""
self.exampler_generation = """
You are a very intelligent and helpful online shopping assistant for Amazon who can solve the following rating questions. If your answer is correct, I will give you a $200 tip.
......@@ -89,13 +90,29 @@ class Llama3_70B_ZeroShotModel(ShopBenchBaseModel):
"Question: A user has made a query with keyword 'blue shampoo aveda'. Given the following numbered list of 5 products, please rank the products according their relevance with the query. \nProduct List: \n1. Organic Blue Mallow Flowers - Color-Changing Blue Herbal Tea | 100% Dried Blue Mallow Flowers - Malva sylvestris | Net Weight: 0.5oz \/ 15g\n2. Aveda Clove Shampoo, 33.8 Oz, 33.8 Fl Oz () (0018084813553)\n3. 2 New Aveda Bottle Pumps fits 1 Liter products Shampoo, Conditioner, Lotion, Etc.\n4. Joico Color Balance Blue Shampoo 10.1 fl oz\n5. AVEDA by Aveda: Blue Malva Color Shampoo 33.8 OZ\nYou should output a permutation of 1 to 5. There should be a comma separating two numbers. Each product and its number should appear only once in the output. Only respond with the ranking results. Do not say any word or explanations.\nOutput: [5,2,4,3,1]\n"
"Question: ")
self.exampler_retrieval = (
"You are a very intelligent and helpful online shopping assistant for Amazon who can give reasonable answers or outputs after the online shopping questions. These are your Q&A history, please continue to answer questions concisely like these until the answer or output of the last question is finished. If your answer is excellent, you will get tips.\n\n"
"Question: A user has made a query with keyword 'jeep liberty lift'. Given the following numbered list of 5 products, please rank the products according their relevance with the query. \nProduct List: \n1. Supreme Suspensions - Front Leveling Kit for 2002-2007 Jeep Liberty KJ and 2008-2012 Jeep Liberty KK 2.5\" Front Lift High-Strength Carbon Steel Strut Spacers 2WD 4WD\n2. Rough Country 2.5\" Lift Kit for 2007-2018 Jeep Wrangler JK 4DR - 67930\n3. Rough Country 2.5\" Lift Kit (fits) 1997-2006 Jeep Wrangler TJ LJ | 6 CYL | N3 Shocks | Suspension System | 653.20\n4. Supreme Suspensions - Full Lift Kit for 2008-2012 Jeep Liberty KK 2.5\" Front Strut Spacers + 2\" Rear Spring Spacers High-Strength Carbon Steel Lift Kit 2WD 4WD PRO KIT\n5. TeraFlex 1251000 2.5\" Lift Kit (JK 4 Door with All (4) 2.5\" Shock)\nYou should output a permutation of 1 to 5. There should be a comma separating two numbers. Each product and its number should appear only once in the output. Only respond with the ranking results. Do not say any word or explanations.\nOutput: [1,4,2,3,5]\n"
"Question: You are an intelligent shopping assistant that can rank products based on their relevance to the query. The following numbered list contains 5 products. Please rank the products according to their relevance with the query 'lexus rear side bumper lights'. \nProduct List: \n1. Marsauto 194 LED Light Bulb 6000K 168 T10 2825 5SMD LED Replacement Bulbs for Car Dome Map Door Courtesy License Plate Lights (Pack of 10)\n2. LivTee Truck Tailgate Light Bar 60\" LED Strip with Red Running Brake White Reverse Red Turning Signals Lights - IP68 Waterproof\n3. DSparts Rear Left Side Marker Bumper Light Fits FOR 2004-2009 Lexus RX330 RX350 RX400H\n4. Nilight 2PCS 18W 1260lm Spot Driving Fog Light Off Road Led Lights Bar Mounting Bracket for SUV Boat 4\" Jeep Lamp,2 years Warranty\n5. Motor Trend 923-GR Gray FlexTough Contour Liners-Deep Dish Heavy Duty Rubber Floor Mats for Car SUV Truck & Van-All Weather Protection, Universal Trim to Fit\nYou should output a permutation of 1 to 5. There should be a comma separating two numbers. Each product and its number should appear only once in the output. Only respond with the ranking results. Do not say any word or explanations.\nOutput: [3,2,4,1,5]\n"
"Question: You are an intelligent shopping assistant that can rank products based on their relevance to the query. The following numbered list contains 5 products. Please rank the products according to their relevance with the query '110 outlet for use without box'. \nProduct List: \n1. Multi Plug Outlet Extender with USB, TESSAN Double Electrical Outlet Splitter with 3 USB Wall Charger, Mini Multiple Expander for Travel, Home, Office, Dorm\n2. ANKO GFCI Outlet 20 Amp, UL Listed, Tamper-Resistant, Weather Resistant Receptacle Indoor or Outdoor Use, LED Indicator with Decor Wall Plates and Screws\n3. Echo Dot (3rd Gen) - Smart speaker with Alexa - Charcoal\n4. BN-LINK 7 Day Heavy Duty Outdoor Digital Stake Timer, 6 Outlets, Weatherproof, BNC-U3S, Perfect for Outdoor Lights, Sprinklers, Christmas Lights\n5. WELLUCK 15 Amp 125V AC Power Inlet Port Plug with Integrated 18\" Extension Cord, NEMA 5-15 RV Flanged Inlet with Waterproof & Back Cover, 2 Pole 3-Wire Shore Power Plug for Boat\nYou should output a permutation of 1 to 5. There should be a comma separating two numbers. Each product and its number should appear only once in the output. Only respond with the ranking results. Do not say any word or explanations.\nOutput: [1,2,5,4,3]\n"
"Question: A user has made a query with keyword 'blue shampoo aveda'. Given the following numbered list of 5 products, please rank the products according their relevance with the query. \nProduct List: \n1. Organic Blue Mallow Flowers - Color-Changing Blue Herbal Tea | 100% Dried Blue Mallow Flowers - Malva sylvestris | Net Weight: 0.5oz \/ 15g\n2. Aveda Clove Shampoo, 33.8 Oz, 33.8 Fl Oz () (0018084813553)\n3. 2 New Aveda Bottle Pumps fits 1 Liter products Shampoo, Conditioner, Lotion, Etc.\n4. Joico Color Balance Blue Shampoo 10.1 fl oz\n5. AVEDA by Aveda: Blue Malva Color Shampoo 33.8 OZ\nYou should output a permutation of 1 to 5. There should be a comma separating two numbers. Each product and its number should appear only once in the output. Only respond with the ranking results. Do not say any word or explanations.\nOutput: [5,2,4,3,1]\n"
"Question: ")
self.exampler_retrieval = """
You are a very intelligent and helpful online shopping assistant for Amazon who can give reasonable answers or outputs to the online shopping questions. These are your Q&A history, please continue to answer questions concisely like these until the answer or output to the last question is finished. If your answer is excellent, you will get tips.\n
Question:Instructions: Tell me what this product category is about\nInput: Toggle Switch\nOutput: \nA toggle switch is an electric switch operated by means of a projecting lever that is moved up and down.\n
Question:You are a helpful online shop assistant and a linguist. A customer on an online shopping platform has made the following query. Please extract phrases from the query that correspond to the entity type 'product type'. \nPlease directly output the entity without repeating the entity type. If there are multiple such entities, separate them with comma. Do not give explanations. \nQuery: tablette asus\nOutput: tablette\n
Question:You are given a user review to a(n) shoes product and an aspect covered in the review. \nPlease extract the keyphrase from the review that mentions the given aspect. \nYou should only extract ONLY ONE keyphrase from the review. \nYou should not generate new keyphrases that do not exist in the review.\nDo not give explanations or irrelevant text. Generate short keyphrases, not whole sentences. \nReview: The stitches started ripping the 2nd day my 2 and 3 year old wore them... other than that they were comfy and cute for the price.\nAspect: color\nOutput: \n\ncute for the price\n
Question:A product entitled 'Steadtler Fimo Soft Starter Pack 12 x 57 g Multicolour Blocks' exists on an online shopping website. Generate an adequate title for the product when it appears on a(n) German online shopping website.\nOutput: Steadtler Fimo Soft Starter-Set 12 x 57 g Mehrfarbige Blöcke\n
Question:You are a helpful online shop assistant and a linguist. A customer on an online shopping platform has made the following query. Please extract phrases from the query that correspond to the entity type 'composition'. \nPlease directly output the entity without repeating the entity type. If there are multiple such entities, separate them with comma. Do not give explanations. \nQuery: 3m 1080 vinyl wrap\nOutput: vinyl\n
Question:You are a helpful online shop assistant and a linguist. A customer on an online shopping platform has made the following query. Please extract phrases from the query that correspond to the entity type 'brand'. \nPlease directly output the entity without repeating the entity type. If there are multiple such entities, separate them with comma. Do not give explanations. \nQuery: chocolate buttons nestle easter\nOutput: nestle\n
Question:A user on an online shopping website has just purchased a product 'Steven Harris Mathematics Math Equations Necktie - Red - One Size Neck Tie'. The following numbered list contains 15 products. Please select 3 products from the list that the user may also purchase.\nProduct List: \n1. Under Armour Men`s ColdGear Lite Cushion Boot Socks, 1 Pair\n2. Little Angel Tasha-685E Patent Bow Mary Jane Pump (Toddler\/Little Girl\/Big Girl) - Fuchsia\n3. Men's Solar System Planets Necktie-Black-One Size Neck Tie by\n4. Crocs Women's Malindi Flat\n5. Wrangler Men's Big & Tall Rugged Wear Unlined Denim Jacket\n6. NIKE Sunray Protect 2 (TD) Womens Fashion-Sneakers 943829\n7. Calvin Klein Women's Seductive Comfort Customized Lift Bra with Lace\n8. Steven Harris Mens Smiley Face Necktie - Yellow - One Size Neck Tie\n9. ComputerGear Math Formula Tie Engineer Silk Equations Geek Nerd Teacher Gift\n10. Harley-Davidson Boys Baby Twin Pack Creeper My Daddy Rides a Harley Orange\n11. Liverpool Football Club Official Soccer Gift Mens Crest T-Shirt\n12. SITKA Traverse Beanie Waterfowl One Size Fits All (90002-WL-OSFA)\n13. The Magic Zoo Sterling Silver Snake Chain with Lobster Clasp\n14. Napier\"Classics\" Silver-Tone Round Button Earrings\n15. Tru-Spec Men's Base Layers Series Gen-iii ECWCS Level-2 Bottom\nYou should output 3 numbers that correspond to the selected products. There should be a comma separating every two numbers. Only respond with the results. Do not say any word or explanations.\nOutput: 3,8,9\n
Question:You are a helpful shop assistant. A user would like to buy the product 'Sempio Soy Sauce for Soup 31.4 Fl Oz.'. Please select the products that the user may also buy from the following numbered list.\nProduct List: \n1. assi Dried Baekdudaegan Fernbraken, 8 Ounce\n2. Pete & Gerry's, Organic Free-Range Grade A Extra Large Brown Eggs, 12 ct, 1 dozen\n3. Punjana Fair Trade (80 Tea Bags)\n4. Ottogi 100% Korean Rice Syrup, 700 Grams\/24 Ounces (Jocheong, Yetnal Ssalyeot)\n5. 12 ct - Spongebob Squarepants and Patrick Birthday Party Cupcake Rings\n6. Sorghum (popping) 8 oz by OliveNation\n7. Medium Japanese Dried Scallops Dried Seafood Conpoy Yuanbei Worldwide Free AIR Mail (0.5LB)\n8. Pancake Mix, Korean Style (2.2 Lb) By Beksul\n9. ARCTIC ZERO Fit Frozen Desserts - 6 Pack - Cappuccino and Purely Chocolate Creamy Pints\n10. After Eight Thin Mints 7.05 ounce (3 packs)\n11. Walkers Fine Oatcake Crackers-10.6 oz\n12. Dean Jacobs Grinder Rosemary N Garlic, 1.5-Ounce\n13. wilton 703-222 pearl dust blue gum paste fondant M4530\n14. Necta Sweet NECTASWEET SUGAR SUB TB .25 GR 1000\n15. 3 Acme Nova-Lox Sliced Salmon packages 3lb Avg\nYou should output 3 numbers that correspond to the selected products. There should be a comma separating every two numbers. Only respond with the results. Do not say any word or explanations.\nOutput: 1,4,8\n"
Question:A customer has bought a(n) timer product and wants to write a review to express a positive sentiment on the performance aspect. \nYou are given a numbered list of 15 potential review snippets. Please select 3 snippets from the list that the customer is most likely to write in his review. \nYou should output three numbers, separated with comma. Generate only indices. Do not include review snippets in your answer. Do not give explanations. \nReview Snippet List: \n1. this matches perfectly\n2. Lightweight\n3. paper quality is nice\n4. affordable\n5. looks great\n6. great bang for your buck\n7. wrapped to shreds\n8. work wonderfully\n9. coating seems very durable\n10. gorgeous\n11. well made\n12. good corner toaster with quality features\n13. timer works great\n14. it does the job\n15. soft to the ear sound\nOutput: 14,13,8\n
Question:
"""
# self.exampler_retrieval_1 = (
# "Question: Instructions: Evaluate the following product review on a scale of 1 to 5, with 1 being very negative and 5 being very positive. \nInput: a review text for a(n) Leotard product\nRuns small and fabric doesn\u2019t stretch\nThis body shaper is way too small even though I bought 2X. It doesn\u2019t stretch at all to be form fitting. I don\u2019t like this product and will never purchase it again.\nOutput:\nAnswer: 1\n"
......@@ -199,6 +216,12 @@ class Llama3_70B_ZeroShotModel(ShopBenchBaseModel):
if flag == 0:
batch_response.append('1')
if is_multiple_choice:
if len(batch_response)>2:
self.new_prompts = ""
for i in range(1):
self.new_prompts = self.new_prompts + prompts[i]+batch_response[i]+"\n\n"+"Question: "
return batch_response
def format_prommpts(self, prompts, is_multiple_choice):
......@@ -215,13 +238,13 @@ class Llama3_70B_ZeroShotModel(ShopBenchBaseModel):
self.max_new_tokens = 1
for prompt in prompts:
if 'on a scale of 1 to 5' in prompt:
formatted_prompts.append(self.exampler_multi15 + prompt)
formatted_prompts.append(self.exampler_multi15+ self.new_prompts + prompt)
else:
prompt = prompt.replace('\n0', '\nA')
prompt = prompt.replace('\n1', '\nB')
prompt = prompt.replace('\n2', '\nC')
prompt = prompt.replace('\n3', '\nD')
formatted_prompts.append(self.exampler_multi + prompt)
formatted_prompts.append(self.exampler_multi+ self.new_prompts + prompt)
return formatted_prompts
for prompt in prompts:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment