diff --git a/.ipynb_checkpoints/app-checkpoint.py b/.ipynb_checkpoints/app-checkpoint.py index 65ade26e36daa2a02cc5ca99911b135306d2e7c9..dba0722f1aedd4abe9203b9ad1a5b5f1c90b714a 100644 --- a/.ipynb_checkpoints/app-checkpoint.py +++ b/.ipynb_checkpoints/app-checkpoint.py @@ -13,15 +13,14 @@ keys_list = list(candidate_labels.keys()) with open("test_data.json", "r") as file: packing_data = json.load(file) -# function and gradio app -model_name = "facebook/bart-large-mnli" -classifier = pipeline("zero-shot-classification", model=model_name) -cut_off = 0.5 # used to choose which activities are relevant +# Load packing item data +with open("packing_templates_self_supported_offgrid_expanded.json", "r") as file: + packing_items = json.load(file) -def classify(#model_name, - trip_descr, cut_off): - - # Create an empty DataFrame with specified columns +# function and gradio app +def classify(model_name, trip_descr, cut_off = 0.5): + classifier = pipeline("zero-shot-classification", model=model_name) + ## Create and fill dataframe with class predictions df = pd.DataFrame(columns=['superclass', 'pred_class']) for i, key in enumerate(keys_list): if key == 'activities': @@ -32,16 +31,31 @@ def classify(#model_name, result = classifier(trip_descr, candidate_labels[key]) classes = result["labels"][0] df.loc[i] = [key, classes] - return df + + ## Look up and return list of items to pack based on class predictions + # make list from dataframe column + all_classes = [elem for x in df["pred_class"] for elem in (x if isinstance(x, list) else [x])] + # look up packing items for each class/key + list_of_list_of_items = [packing_items.get(k, []) for k in all_classes] + # combine lists and remove doubble entries + flat_unique = [] + for sublist in list_of_list_of_items: + for item in sublist: + if item not in flat_unique: + flat_unique.append(item) + # sort alphabetically to notice duplicates + sorted_list = sorted(flat_unique) + return df, "\n".join(sorted_list) demo = gr.Interface( fn=classify, inputs=[ - #gr.Textbox(label="Model name", value = "facebook/bart-large-mnli"), + gr.Textbox(label="Model name", value = "facebook/bart-large-mnli"), gr.Textbox(label="Trip description"), gr.Number(label="Activity cut-off", value = 0.5), ], - outputs="dataframe", + # outputs="dataframe", + outputs=[gr.Dataframe(label="DataFrame"), gr.Textbox(label="List of words")], title="Trip classification", description="Enter a text describing your trip", ) diff --git a/.ipynb_checkpoints/labels-checkpoint.txt b/.ipynb_checkpoints/labels-checkpoint.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb0a47ce96735e65087594d4e4733637a2d1c1e4 --- /dev/null +++ b/.ipynb_checkpoints/labels-checkpoint.txt @@ -0,0 +1,93 @@ +sunscreen +sunglasses +sunhat +flip-flops +swimsuit +beach towel +waterproof phone case +beach bag +snorkel gear +tent +sleeping bag +camping stove +flashlight +hiking boots +water filter +compass +first aid kit +bug spray +multi-tool +thermal clothing +ski jacket +ski goggles +snow boots +gloves +hand warmers +beanie +lip balm +snowboard +base layers +passport +visa documents +travel adapter +currency +sim card +travel pillow +neck wallet +travel insurance documents +power bank +laptop +business attire +dress shoes +charging cables +pen +headphones +lightweight backpack +travel-sized toiletries +packable rain jacket +dry bag +trekking poles +hostel lock +quick-dry towel +travel journal +snacks +blanket +emergency roadside kit +reusable coffee mug +reusable shopping bags +earplugs +fanny pack +poncho +bandana +comfortable shoes +bathing suit +sandals +light jacket +entertainment for downtime (e.g. book/ebook, games, laptop, journal) +short pants/skirts +t-shirts/tops +thin scarf +pants +shirts +cardigan/sweater +gifts +winter shoes +long pants +short pants +malaria medication +mosquito repellant +local currency +wallet +tickets +phone and charger +painkiller +necessary medication +personal toiletries (e.g. toothbrush, toothpaste) +underwear +socks +sleep wear +snacks for the journey +refillable water bottle +day pack +big backpack/suitcase + diff --git a/.ipynb_checkpoints/main_model-checkpoint.ipynb b/.ipynb_checkpoints/main_model-checkpoint.ipynb index 0ff8258d1c9d3cb9197bed8208aadc2be0929597..48d08426d3ca54533f36897ce80254d2dd9b86f6 100644 --- a/.ipynb_checkpoints/main_model-checkpoint.ipynb +++ b/.ipynb_checkpoints/main_model-checkpoint.ipynb @@ -5,7 +5,7 @@ "id": "e25090fa-f990-4f1a-84f3-b12159eedae8", "metadata": {}, "source": [ - "# Implement and test prediciton model" + "# Working with a Large Language Model (LLM)" ] }, { @@ -18,41 +18,32 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 2, "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", "metadata": {}, "outputs": [], "source": [ - "# Prerequisites\n", - "from tabulate import tabulate\n", - "from transformers import pipeline\n", + "import math\n", "import json\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plt\n", "import pickle\n", "import os\n", "import time\n", - "import math\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", "\n", - "# get candidate labels\n", + "# Get candidate labels\n", "with open(\"packing_label_structure.json\", \"r\") as file:\n", " candidate_labels = json.load(file)\n", "keys_list = list(candidate_labels.keys())\n", "\n", - "# Load test data (in list of dictionaries)\n", + "# Load test data (list of dictionaries)\n", "with open(\"test_data.json\", \"r\") as file:\n", " packing_data = json.load(file)\n", - "# Extract all trip descriptions and trip_types\n", + "# Extract trip descriptions and classification (trip_types)\n", "trip_descriptions = [trip['description'] for trip in packing_data]\n", - "trip_types = [trip['trip_types'] for trip in packing_data]\n", - "\n", - "# Access the first trip description\n", - "first_trip = trip_descriptions[0]\n", - "# Get the packing list for the secondfirst trip\n", - "first_trip_type = trip_types[0]\n", - "\n", - "# print(f\"First trip: {first_trip} \\n\")\n", - "# print(f\"Trip type: {first_trip_type}\")" + "trip_types = [trip['trip_types'] for trip in packing_data]" ] }, { @@ -65,12 +56,13 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 2, "id": "89d42ca7-e871-4eda-b428-69e9bd965428", "metadata": { "jupyter": { "source_hidden": true - } + }, + "scrolled": true }, "outputs": [ { @@ -171,13 +163,13 @@ "7 . We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels. \n", "\n", "yoga / wellness retreat\n", - "['hut-to-hut hiking', 'yoga']\n", + "['hiking', 'yoga']\n", "cold destination / winter\n", "lightweight (but comfortable)\n", - "formal (business trip)\n", - "sleeping in a tent\n", + "casual\n", + "indoor\n", "no own vehicle\n", - "avalanche-prone terrain\n", + "snow and ice\n", "7 days\n", "\n", "\n", @@ -228,20 +220,29 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 3, "id": "fac51224-9575-4b4b-8567-4ad4e759ecc9", "metadata": {}, "outputs": [], "source": [ - "# function that returns pandas data frame with predictions\n", - "\n", - "cut_off = 0.5 # used to choose which activities are relevant\n", + "def pred_trip(model_name, trip_descr, trip_type, cut_off = 0.5):\n", + " \"\"\"\n", + " Classifies trip\n", + " \n", + " Parameters:\n", + " model_name: name of hugging-face model\n", + " trip_descr: text describing the trip\n", + " trip_type: true trip classification\n", + " cut_off: cut_off for choosing activities\n", "\n", - "def pred_trip(model_name, trip_descr, trip_type, cut_off):\n", + " Returns:\n", + " pd Dataframe: with class predictions and true values\n", + " \"\"\"\n", + " \n", " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", - " # Create an empty DataFrame with specified columns\n", " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", " for i, key in enumerate(keys_list):\n", + " print(i)\n", " if key == 'activities':\n", " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", @@ -249,9 +250,6 @@ " else:\n", " result = classifier(trip_descr, candidate_labels[key])\n", " classes = result[\"labels\"][0]\n", - " print(result)\n", - " print(classes)\n", - " print(i)\n", " df.loc[i] = [key, classes]\n", " df['true_class'] = trip_type\n", " return df" @@ -259,1375 +257,71 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 4, "id": "b36ab806-2f35-4950-ac5a-7c192190cba7", "metadata": {}, "outputs": [], - "source": [ - "# function for accuracy, perc true classes identified and perc wrong pred classes\n", - "\n", - "def perf_measure(df):\n", - " df['same_value'] = df['pred_class'] == df['true_class']\n", - " correct = sum(df.loc[df.index != 1, 'same_value'])\n", - " total = len(df['same_value'])\n", - " accuracy = correct/total\n", - " pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", - " true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", - " correct = [label for label in pred_class if label in true_class]\n", - " num_correct = len(correct)\n", - " correct_perc = num_correct/len(true_class)\n", - " num_pred = len(pred_class)\n", - " if num_pred == 0:\n", - " wrong_perc = math.nan\n", - " else:\n", - " wrong_perc = (num_pred - num_correct)/num_pred\n", - " df_perf = pd.DataFrame({\n", - " 'accuracy': [accuracy],\n", - " 'true_ident': [correct_perc],\n", - " 'false_pred': [wrong_perc]\n", - " })\n", - " return(df_perf)" - ] - }, - { - "cell_type": "markdown", - "id": "c10aa57d-d7ed-45c7-bdf5-29af193c7fd5", - "metadata": {}, - "source": [ - "## Make predictions for many models and trip descriptions\n", - "\n", - "Provide a list of candidate models and apply them to the test data." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "dd7869a8-b436-40de-9ea0-28eb4b7d3248", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Using model: cross-encoder/nli-deberta-v3-base\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['micro-adventure / weekend trip', 'digital nomad trip', 'beach vacation', 'festival trip', 'city trip', 'cultural exploration', 'road trip (car/camper)', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'hut trek (winter)', 'ski tour / skitour', 'snowboard / splitboard trip', 'nature escape', 'yoga / wellness retreat', 'hut trek (summer)', 'camping trip (campground)'], 'scores': [0.9722680449485779, 0.007802918087691069, 0.0075571718625724316, 0.0022959215566515923, 0.0021305829286575317, 0.001222927705384791, 0.0009879637509584427, 0.000805296644102782, 0.0007946204277686775, 0.0007107199053280056, 0.0007009899127297103, 0.0006353880744427443, 0.0005838185315951705, 0.0005424902774393559, 0.0004807499353773892, 0.0004804217896889895]}\n", - "micro-adventure / weekend trip\n", - "0\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'sightseeing', 'relaxing', 'hiking', 'hut-to-hut hiking', 'stand-up paddleboarding (SUP)', 'photography', 'biking', 'running', 'ski touring', 'snowshoe hiking', 'yoga', 'kayaking / canoeing', 'horseback riding', 'rafting', 'paragliding', 'cross-country skiing', 'surfing', 'skiing', 'ice climbing', 'fishing', 'snorkeling', 'swimming', 'rock climbing', 'scuba diving'], 'scores': [0.4660525321960449, 0.007281942293047905, 0.003730606520548463, 0.0001860307966126129, 0.00014064949937164783, 0.00011034693307010457, 5.2949126256862655e-05, 3.828677654382773e-05, 3.396756437723525e-05, 1.5346524378401227e-05, 9.348185812996235e-06, 8.182429155567661e-06, 6.5973340497293975e-06, 6.271920938161202e-06, 5.544673058466287e-06, 5.299102667777333e-06, 4.855380211665761e-06, 4.506250661506783e-06, 3.949530764657538e-06, 3.730233856913401e-06, 3.297281637060223e-06, 3.0508665531669976e-06, 2.933618134193239e-06, 2.6379277642263332e-06, 2.2992651338427095e-06]}\n", - "[]\n", - "1\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'cold destination / winter', 'rainy climate', 'dry / desert-like', 'tropical / humid'], 'scores': [0.5463300943374634, 0.16045652329921722, 0.10073684900999069, 0.07946548610925674, 0.06506938487291336, 0.047941628843545914]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.6965053081512451, 0.11270010471343994, 0.10676420480012894, 0.08403033763170242]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.6362482309341431, 0.22082458436489105, 0.14292724430561066]}\n", - "casual\n", - "4\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['indoor', 'sleeping in a tent', 'huts with half board', 'sleeping in a car'], 'scores': [0.435793399810791, 0.20242486894130707, 0.19281964004039764, 0.16896207630634308]}\n", - "indoor\n", - "5\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9987181425094604, 0.0012818538816645741]}\n", - "no own vehicle\n", - "6\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['travel with children', 'self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'no special conditions to consider', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'pet-friendly', 'high alpine terrain'], 'scores': [0.2443356215953827, 0.20383375883102417, 0.14710737764835358, 0.1429106593132019, 0.09568475931882858, 0.09322812408208847, 0.03845797851681709, 0.03444178029894829]}\n", - "travel with children\n", - "7\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '7 days', '5 days', '3 days', '6 days', '4 days'], 'scores': [0.4730822443962097, 0.1168912723660469, 0.10058756172657013, 0.0991850346326828, 0.05424537882208824, 0.053677864372730255, 0.051554784178733826, 0.050775907933712006]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type micro-adventure / weekend trip \n", - "1 activities [] \n", - "2 climate_or_season variable weather / spring / autumn \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation no own vehicle \n", - "7 special_conditions travel with children \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 beach vacation \n", - "1 [swimming, going to the beach, relaxing, hiking] \n", - "2 warm destination / summer \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.0 NaN\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'festival trip', 'digital nomad trip', 'cultural exploration', 'ski tour / skitour', 'hut trek (summer)', 'hut trek (winter)', 'camping trip (campground)', 'long-distance hike / thru-hike', 'beach vacation', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'road trip (car/camper)', 'nature escape', 'yoga / wellness retreat'], 'scores': [0.7273069024085999, 0.16893576085567474, 0.0374605655670166, 0.013699190691113472, 0.010825436562299728, 0.009758710861206055, 0.007331428118050098, 0.004068635869771242, 0.003749603172764182, 0.003352535655722022, 0.0031235795468091965, 0.0026630775537341833, 0.0025940865743905306, 0.002538869855925441, 0.0018098815344274044, 0.0007818263256922364]}\n", - "city trip\n", - "0\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['relaxing', 'sightseeing', 'photography', 'running', 'yoga', 'hiking', 'ski touring', 'biking', 'going to the beach', 'rafting', 'horseback riding', 'swimming', 'skiing', 'hut-to-hut hiking', 'stand-up paddleboarding (SUP)', 'cross-country skiing', 'kayaking / canoeing', 'paragliding', 'surfing', 'snowshoe hiking', 'scuba diving', 'ice climbing', 'snorkeling', 'rock climbing', 'fishing'], 'scores': [0.8136454820632935, 0.7140676379203796, 0.6170756220817566, 0.05222179368138313, 0.004323678556829691, 0.00038644394953735173, 0.00017300622130278498, 0.00015315462951548398, 0.00010445844964124262, 6.36487384326756e-05, 4.631545380107127e-05, 3.839404962491244e-05, 3.114979335805401e-05, 2.5509923943900503e-05, 2.4492410375387408e-05, 2.280416083522141e-05, 2.255491381220054e-05, 2.068510184471961e-05, 1.266321760340361e-05, 1.1330040251777973e-05, 8.723225619178265e-06, 8.310731573146768e-06, 6.998459411988733e-06, 6.519879661937011e-06, 5.990766112518031e-06]}\n", - "['relaxing', 'sightseeing', 'photography']\n", - "1\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.2882528007030487, 0.2644135057926178, 0.19858866930007935, 0.09457410126924515, 0.09138277918100357, 0.06278812885284424]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'minimalist', 'ultralight'], 'scores': [0.4169069826602936, 0.4114149212837219, 0.12663574516773224, 0.04504229500889778]}\n", - "luxury (including evening wear)\n", - "3\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8982668519020081, 0.06863681226968765, 0.03309635445475578]}\n", - "casual\n", - "4\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.714741587638855, 0.23251301050186157, 0.03547109663486481, 0.017274310812354088]}\n", - "indoor\n", - "5\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9801605343818665, 0.019839433953166008]}\n", - "no own vehicle\n", - "6\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'travel with children', 'self-supported (bring your own cooking gear)', 'no special conditions to consider', 'high alpine terrain', 'off-grid / no electricity', 'snow, ice and avalanche-prone terrain', 'snow and ice'], 'scores': [0.334042489528656, 0.16580866277217865, 0.12393084913492203, 0.10801968723535538, 0.08762889355421066, 0.06602469086647034, 0.06402742117643356, 0.05051736533641815]}\n", - "pet-friendly\n", - "7\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '7+ days', '4 days', '7 days', '5 days', '6 days', '2 days', '1 day'], 'scores': [0.4001774787902832, 0.1674569994211197, 0.09989149123430252, 0.09311039745807648, 0.07716208696365356, 0.06582564115524292, 0.051743343472480774, 0.04463256150484085]}\n", - "3 days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type city trip \n", - "1 activities [relaxing, sightseeing, photography] \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort luxury (including evening wear) \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation no own vehicle \n", - "7 special_conditions pet-friendly \n", - "8 trip_length_days 3 days \n", - "\n", - " true_class \n", - "0 city trip \n", - "1 [sightseeing] \n", - "2 variable weather / spring / autumn \n", - "3 luxury (including evening wear) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 3 days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.0 NaN\n", - "0 0.666667 1.0 0.666667\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['city trip', 'ski tour / skitour', 'micro-adventure / weekend trip', 'festival trip', 'cultural exploration', 'road trip (car/camper)', 'long-distance hike / thru-hike', 'digital nomad trip', 'camping trip (campground)', 'hut trek (winter)', 'beach vacation', 'nature escape', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'hut trek (summer)', 'yoga / wellness retreat'], 'scores': [0.45239609479904175, 0.39182814955711365, 0.03087054006755352, 0.021208807826042175, 0.019435159862041473, 0.01809830032289028, 0.015263390727341175, 0.014824162237346172, 0.01339301560074091, 0.008623503148555756, 0.0034696790389716625, 0.0033059841953217983, 0.0026981434784829617, 0.0023115249350667, 0.0014284384669736028, 0.0008451264584437013]}\n", - "city trip\n", - "0\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['photography', 'running', 'paragliding', 'sightseeing', 'yoga', 'relaxing', 'stand-up paddleboarding (SUP)', 'going to the beach', 'hut-to-hut hiking', 'hiking', 'fishing', 'rock climbing', 'ski touring', 'kayaking / canoeing', 'snorkeling', 'biking', 'horseback riding', 'swimming', 'cross-country skiing', 'ice climbing', 'skiing', 'scuba diving', 'rafting', 'snowshoe hiking', 'surfing'], 'scores': [0.9982200860977173, 0.8451107144355774, 0.8157505989074707, 0.5136172771453857, 0.3555079400539398, 0.10830502957105637, 0.029663724824786186, 0.002340897684916854, 0.0021064123138785362, 0.001811002497561276, 0.001619927235879004, 0.0011951243504881859, 0.0005228804075159132, 0.0003923563053831458, 0.00026167574105784297, 0.00011586806067498401, 6.076138015487231e-05, 4.014953810838051e-05, 3.3960262953769416e-05, 3.057323192479089e-05, 2.75468519248534e-05, 2.5356062906212173e-05, 2.3491949832532555e-05, 1.6574558685533702e-05, 1.540743323857896e-05]}\n", - "['photography', 'running', 'paragliding', 'sightseeing']\n", - "1\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'rainy climate', 'warm destination / summer', 'tropical / humid'], 'scores': [0.9046850800514221, 0.06181586533784866, 0.01785154454410076, 0.007209230214357376, 0.004330475814640522, 0.0041077327914536]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['minimalist', 'luxury (including evening wear)', 'ultralight', 'lightweight (but comfortable)'], 'scores': [0.9266965389251709, 0.02874235063791275, 0.026161089539527893, 0.01839996874332428]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.695661723613739, 0.16892163455486298, 0.13541661202907562]}\n", - "casual\n", - "4\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['indoor', 'huts with half board', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.9643056392669678, 0.034512825310230255, 0.0006053661345504224, 0.0005761855863966048]}\n", - "indoor\n", - "5\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.8479765057563782, 0.15202350914478302]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['travel with children', 'pet-friendly', 'self-supported (bring your own cooking gear)', 'snow and ice', 'no special conditions to consider', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.5751603245735168, 0.08135509490966797, 0.07521982491016388, 0.06849102675914764, 0.06833382695913315, 0.06071845814585686, 0.0428948774933815, 0.0278265792876482]}\n", - "travel with children\n", - "7\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['7+ days', '7 days', '2 days', '5 days', '3 days', '4 days', '6 days', '1 day'], 'scores': [0.24407239258289337, 0.24201279878616333, 0.15072190761566162, 0.14704979956150055, 0.13021770119667053, 0.049783434718847275, 0.0354502871632576, 0.0006916742422617972]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type city trip \n", - "1 activities [photography, running, paragliding, sightseeing] \n", - "2 climate_or_season variable weather / spring / autumn \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation own vehicle \n", - "7 special_conditions travel with children \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 city trip \n", - "1 [relaxing] \n", - "2 cold destination / winter \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.0 NaN\n", - "0 0.666667 1.0 0.666667\n", - "0 0.444444 0.0 1.000000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['long-distance hike / thru-hike', 'cultural exploration', 'micro-adventure / weekend trip', 'ski tour / skitour', 'camping trip (campground)', 'festival trip', 'digital nomad trip', 'hut trek (summer)', 'camping trip (wild camping)', 'city trip', 'beach vacation', 'nature escape', 'yoga / wellness retreat', 'hut trek (winter)', 'road trip (car/camper)', 'snowboard / splitboard trip'], 'scores': [0.6391688585281372, 0.1992405354976654, 0.09796122461557388, 0.018116997554898262, 0.009553882293403149, 0.009360258467495441, 0.008848845027387142, 0.007181849330663681, 0.004239208064973354, 0.002507743425667286, 0.0009007346234284341, 0.0008697589510120451, 0.0005665600765496492, 0.0005454406491480768, 0.000539708009455353, 0.000398428674088791]}\n", - "long-distance hike / thru-hike\n", - "0\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['sightseeing', 'hiking', 'photography', 'running', 'rafting', 'relaxing', 'yoga', 'stand-up paddleboarding (SUP)', 'snorkeling', 'swimming', 'hut-to-hut hiking', 'rock climbing', 'paragliding', 'horseback riding', 'surfing', 'going to the beach', 'ski touring', 'fishing', 'kayaking / canoeing', 'skiing', 'scuba diving', 'ice climbing', 'biking', 'snowshoe hiking', 'cross-country skiing'], 'scores': [0.9999529719352722, 0.9988834857940674, 0.3719910979270935, 0.31013864278793335, 0.30444297194480896, 0.1280682533979416, 0.046863943338394165, 0.017836086452007294, 0.010855655185878277, 0.006217176094651222, 0.003480800660327077, 0.0017547928728163242, 0.0003136920277029276, 0.00019969380809925497, 0.00019650146714411676, 0.00014437627396546304, 7.375824498012662e-05, 6.8435758294072e-05, 6.381970888469368e-05, 3.951123289880343e-05, 3.331455081934109e-05, 1.7446116544306278e-05, 1.3563214452005923e-05, 1.0083023880724795e-05, 6.3861116359476e-06]}\n", - "['sightseeing', 'hiking']\n", - "1\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'rainy climate', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.37135037779808044, 0.3204072415828705, 0.21922175586223602, 0.03517947718501091, 0.02729681320488453, 0.02654428966343403]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight', 'minimalist'], 'scores': [0.31400763988494873, 0.3113711178302765, 0.19337615370750427, 0.18124504387378693]}\n", - "luxury (including evening wear)\n", - "3\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.7345985174179077, 0.21783266961574554, 0.04756878688931465]}\n", - "casual\n", - "4\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.45667150616645813, 0.31709080934524536, 0.1675349920988083, 0.05870261788368225]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.9976876974105835, 0.0023123116698116064]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['self-supported (bring your own cooking gear)', 'pet-friendly', 'travel with children', 'no special conditions to consider', 'off-grid / no electricity', 'snow and ice', 'high alpine terrain', 'snow, ice and avalanche-prone terrain'], 'scores': [0.22990663349628448, 0.19825373589992523, 0.19189415872097015, 0.12580519914627075, 0.07754165679216385, 0.07121263444423676, 0.06273777037858963, 0.04264823719859123]}\n", - "self-supported (bring your own cooking gear)\n", - "7\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['7+ days', '7 days', '3 days', '4 days', '6 days', '5 days', '2 days', '1 day'], 'scores': [0.9156420826911926, 0.04964160546660423, 0.015258747152984142, 0.008262275718152523, 0.0057467143051326275, 0.004083935171365738, 0.0007110430742613971, 0.0006536644068546593]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type long-distance hike / thru-hike \n", - "1 activities [sightseeing, hiking] \n", - "2 climate_or_season variable weather / spring / autumn \n", - "3 style_or_comfort luxury (including evening wear) \n", - "4 dress_code casual \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions self-supported (bring your own cooking gear) \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 cultural exploration \n", - "1 [sightseeing, hiking, rafting] \n", - "2 variable weather / spring / autumn \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 rainy climate \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['micro-adventure / weekend trip', 'hut trek (summer)', 'cultural exploration', 'camping trip (campground)', 'ski tour / skitour', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'festival trip', 'nature escape', 'digital nomad trip', 'city trip', 'yoga / wellness retreat', 'road trip (car/camper)', 'beach vacation', 'snowboard / splitboard trip', 'hut trek (winter)'], 'scores': [0.399262934923172, 0.11123846471309662, 0.10382843762636185, 0.09988072514533997, 0.04976071044802666, 0.042101696133613586, 0.039874546229839325, 0.029952242970466614, 0.027864206582307816, 0.025919852778315544, 0.024940188974142075, 0.020264005288481712, 0.011593679897487164, 0.01072726957499981, 0.0018079130677506328, 0.0009830890921875834]}\n", - "micro-adventure / weekend trip\n", - "0\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['hiking', 'sightseeing', 'swimming', 'relaxing', 'photography', 'yoga', 'rock climbing', 'running', 'horseback riding', 'paragliding', 'cross-country skiing', 'ice climbing', 'biking', 'hut-to-hut hiking', 'skiing', 'stand-up paddleboarding (SUP)', 'surfing', 'rafting', 'kayaking / canoeing', 'ski touring', 'snorkeling', 'scuba diving', 'fishing', 'snowshoe hiking', 'going to the beach'], 'scores': [0.9999757409095764, 0.9999136328697205, 0.9996724724769592, 0.9950104355812073, 0.9878146648406982, 0.9702362418174744, 0.9684181213378906, 0.9652480483055115, 0.9647860527038574, 0.9470340609550476, 0.9403603672981262, 0.9337814450263977, 0.7944441437721252, 0.7841721773147583, 0.7799363732337952, 0.7348324060440063, 0.4181976914405823, 0.41387978196144104, 0.3358054459095001, 0.2870975732803345, 0.2532541751861572, 0.15205828845500946, 0.08441334962844849, 0.03719170764088631, 0.0015505956253036857]}\n", - "['hiking', 'sightseeing', 'swimming', 'relaxing', 'photography', 'yoga', 'rock climbing', 'running', 'horseback riding', 'paragliding', 'cross-country skiing', 'ice climbing', 'biking', 'hut-to-hut hiking', 'skiing', 'stand-up paddleboarding (SUP)']\n", - "1\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'tropical / humid', 'dry / desert-like', 'rainy climate', 'cold destination / winter'], 'scores': [0.8853303790092468, 0.06323658674955368, 0.0203978531062603, 0.015069224871695042, 0.013677663169801235, 0.002288248622789979]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.28714197874069214, 0.26553791761398315, 0.2564510405063629, 0.19086909294128418]}\n", - "lightweight (but comfortable)\n", - "3\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.950221836566925, 0.03379425033926964, 0.015983905643224716]}\n", - "casual\n", - "4\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['huts with half board', 'sleeping in a tent', 'indoor', 'sleeping in a car'], 'scores': [0.47244933247566223, 0.22768281400203705, 0.17343464493751526, 0.12643319368362427]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.646557092666626, 0.353442907333374]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'pet-friendly', 'travel with children', 'no special conditions to consider', 'snow and ice'], 'scores': [0.24066784977912903, 0.21955342590808868, 0.20271560549736023, 0.13701395690441132, 0.1005372628569603, 0.03759154677391052, 0.031228909268975258, 0.03069145418703556]}\n", - "self-supported (bring your own cooking gear)\n", - "7\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['7+ days', '1 day', '7 days', '2 days', '6 days', '4 days', '3 days', '5 days'], 'scores': [0.925011932849884, 0.0197151992470026, 0.013198123313486576, 0.011958166025578976, 0.008182710967957973, 0.007919016294181347, 0.007132015191018581, 0.006882876623421907]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type micro-adventure / weekend trip \n", - "1 activities [hiking, sightseeing, swimming, relaxing, phot... \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort lightweight (but comfortable) \n", - "4 dress_code casual \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions self-supported (bring your own cooking gear) \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 nature escape \n", - "1 [swimming, relaxing, hiking] \n", - "2 warm destination / summer \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n", - "0 0.444444 1.000000 0.812500\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['long-distance hike / thru-hike', 'snowboard / splitboard trip', 'road trip (car/camper)', 'micro-adventure / weekend trip', 'digital nomad trip', 'hut trek (summer)', 'cultural exploration', 'beach vacation', 'nature escape', 'ski tour / skitour', 'camping trip (wild camping)', 'festival trip', 'yoga / wellness retreat', 'hut trek (winter)', 'camping trip (campground)', 'city trip'], 'scores': [0.307785302400589, 0.21902230381965637, 0.2059311717748642, 0.0918341726064682, 0.0317988395690918, 0.022238966077566147, 0.02077283337712288, 0.016396038234233856, 0.016088521108031273, 0.015115255489945412, 0.011458033695816994, 0.011041054502129555, 0.009128374978899956, 0.008595850318670273, 0.00814863946288824, 0.004644663538783789]}\n", - "long-distance hike / thru-hike\n", - "0\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['hiking', 'going to the beach', 'sightseeing', 'hut-to-hut hiking', 'relaxing', 'photography', 'ski touring', 'running', 'stand-up paddleboarding (SUP)', 'snowshoe hiking', 'yoga', 'rock climbing', 'biking', 'rafting', 'cross-country skiing', 'skiing', 'ice climbing', 'surfing', 'horseback riding', 'fishing', 'kayaking / canoeing', 'swimming', 'paragliding', 'snorkeling', 'scuba diving'], 'scores': [0.9999420046806335, 0.9937199950218201, 0.9705187678337097, 0.807087779045105, 0.7726525664329529, 0.7345634698867798, 0.22688233852386475, 0.19742780923843384, 0.10495136678218842, 0.022291118279099464, 0.01619880646467209, 0.005674958229064941, 0.0020213245879858732, 0.0010871101403608918, 0.000742745294701308, 0.00048393983161076903, 0.0002776516485027969, 0.00026415023603476584, 0.00021324043336790055, 0.0002008231676882133, 0.00011857100616907701, 7.436196028720587e-05, 4.881532731815241e-05, 2.4528446374461055e-05, 8.641897693451028e-06]}\n", - "['hiking', 'going to the beach', 'sightseeing', 'hut-to-hut hiking', 'relaxing', 'photography']\n", - "1\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'warm destination / summer', 'rainy climate', 'tropical / humid', 'dry / desert-like'], 'scores': [0.348645955324173, 0.251813679933548, 0.18834973871707916, 0.09632129967212677, 0.07351076602935791, 0.04135853052139282]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.5279046893119812, 0.26949775218963623, 0.18797814846038818, 0.014619375579059124]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.7808143496513367, 0.1755133420228958, 0.043672334402799606]}\n", - "casual\n", - "4\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.5076353549957275, 0.33340293169021606, 0.09201522171497345, 0.06694648414850235]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.9687432050704956, 0.03125680983066559]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['self-supported (bring your own cooking gear)', 'high alpine terrain', 'pet-friendly', 'travel with children', 'snow and ice', 'no special conditions to consider', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.27305731177330017, 0.18301300704479218, 0.17119400203227997, 0.13855385780334473, 0.07743344455957413, 0.05604451894760132, 0.05048489570617676, 0.05021902546286583]}\n", - "self-supported (bring your own cooking gear)\n", - "7\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['7 days', '6 days', '7+ days', '5 days', '2 days', '3 days', '4 days', '1 day'], 'scores': [0.39104464650154114, 0.2897762060165405, 0.1694536805152893, 0.04283830150961876, 0.03119494393467903, 0.030063502490520477, 0.027407746762037277, 0.018220972269773483]}\n", - "7 days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type long-distance hike / thru-hike \n", - "1 activities [hiking, going to the beach, sightseeing, hut-... \n", - "2 climate_or_season variable weather / spring / autumn \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions self-supported (bring your own cooking gear) \n", - "8 trip_length_days 7 days \n", - "\n", - " true_class \n", - "0 long-distance hike / thru-hike \n", - "1 [going to the beach] \n", - "2 tropical / humid \n", - "3 minimalist \n", - "4 casual \n", - "5 huts with half board \n", - "6 own vehicle \n", - "7 off-grid / no electricity \n", - "8 6 days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n", - "0 0.444444 1.000000 0.812500\n", - "0 0.555556 1.000000 0.833333\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['beach vacation', 'road trip (car/camper)', 'camping trip (campground)', 'micro-adventure / weekend trip', 'camping trip (wild camping)', 'festival trip', 'long-distance hike / thru-hike', 'digital nomad trip', 'ski tour / skitour', 'city trip', 'snowboard / splitboard trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'cultural exploration'], 'scores': [0.514082670211792, 0.21859246492385864, 0.17132116854190826, 0.07659809291362762, 0.00910242274403572, 0.002291250042617321, 0.0018519052537158132, 0.0013648553285747766, 0.0011585818137973547, 0.00088925426825881, 0.0006727487780153751, 0.0005743220681324601, 0.0004519206704571843, 0.00041462210356257856, 0.0003662202216219157, 0.0002674963616300374]}\n", - "beach vacation\n", - "0\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['going to the beach', 'stand-up paddleboarding (SUP)', 'relaxing', 'sightseeing', 'kayaking / canoeing', 'rafting', 'hiking', 'ski touring', 'paragliding', 'hut-to-hut hiking', 'swimming', 'fishing', 'surfing', 'biking', 'running', 'snorkeling', 'skiing', 'yoga', 'snowshoe hiking', 'ice climbing', 'horseback riding', 'rock climbing', 'scuba diving', 'photography', 'cross-country skiing'], 'scores': [0.9951664805412292, 0.0007465911330655217, 0.00012195681483717635, 5.901218537474051e-05, 4.4055559555999935e-05, 4.248578625265509e-05, 3.655617547337897e-05, 2.936698729172349e-05, 2.435299575154204e-05, 1.663279726926703e-05, 1.5113877452677116e-05, 1.4154848940961529e-05, 1.1902168807864655e-05, 1.1185119547008071e-05, 1.0269744052493479e-05, 7.661022209504154e-06, 6.11952600593213e-06, 5.437631898530526e-06, 4.908260507363593e-06, 4.472567525226623e-06, 3.872326033160789e-06, 3.687909611471696e-06, 3.5238058444519993e-06, 3.260090352341649e-06, 3.105657697233255e-06]}\n", - "['going to the beach']\n", - "1\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'warm destination / summer', 'rainy climate', 'tropical / humid', 'dry / desert-like'], 'scores': [0.46722230315208435, 0.16364941000938416, 0.15415365993976593, 0.08851196616888046, 0.07209648191928864, 0.05436616390943527]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'ultralight'], 'scores': [0.4169754087924957, 0.26534488797187805, 0.18320927023887634, 0.13447043299674988]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.8853278160095215, 0.09371301531791687, 0.02095925435423851]}\n", - "casual\n", - "4\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['sleeping in a tent', 'indoor', 'sleeping in a car', 'huts with half board'], 'scores': [0.9975091218948364, 0.0015241053188219666, 0.000863413792103529, 0.0001033771550282836]}\n", - "sleeping in a tent\n", - "5\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.6629492044448853, 0.3370508551597595]}\n", - "no own vehicle\n", - "6\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['travel with children', 'no special conditions to consider', 'self-supported (bring your own cooking gear)', 'snow and ice', 'pet-friendly', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.30429574847221375, 0.25901490449905396, 0.10586199909448624, 0.07926543056964874, 0.0763142853975296, 0.06895460188388824, 0.06407862156629562, 0.04221438243985176]}\n", - "travel with children\n", - "7\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['7+ days', '7 days', '2 days', '3 days', '4 days', '6 days', '1 day', '5 days'], 'scores': [0.4528488516807556, 0.16225562989711761, 0.11383233964443207, 0.06288284808397293, 0.06238923966884613, 0.05307593196630478, 0.04749447479844093, 0.04522067680954933]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type beach vacation \n", - "1 activities [going to the beach] \n", - "2 climate_or_season variable weather / spring / autumn \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation sleeping in a tent \n", - "6 transportation no own vehicle \n", - "7 special_conditions travel with children \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 beach vacation \n", - "1 [stand-up paddleboarding (SUP), surfing] \n", - "2 cold destination / winter \n", - "3 ultralight \n", - "4 casual \n", - "5 sleeping in a tent \n", - "6 own vehicle \n", - "7 off-grid / no electricity \n", - "8 6 days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n", - "0 0.444444 1.000000 0.812500\n", - "0 0.555556 1.000000 0.833333\n", - "0 0.333333 0.000000 1.000000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga / wellness retreat', 'micro-adventure / weekend trip', 'ski tour / skitour', 'cultural exploration', 'city trip', 'nature escape', 'digital nomad trip', 'festival trip', 'long-distance hike / thru-hike', 'camping trip (campground)', 'hut trek (winter)', 'camping trip (wild camping)', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'hut trek (summer)'], 'scores': [0.764270544052124, 0.14882460236549377, 0.01460289116948843, 0.013516460545361042, 0.01233332883566618, 0.01110365241765976, 0.008976204320788383, 0.008688248693943024, 0.0077370391227304935, 0.0027588019147515297, 0.002010364318266511, 0.0018135884311050177, 0.0010747710475698113, 0.0009247296256944537, 0.0008900162065401673, 0.0004748118226416409]}\n", - "yoga / wellness retreat\n", - "0\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga', 'relaxing', 'sightseeing', 'hiking', 'snowshoe hiking', 'ski touring', 'photography', 'hut-to-hut hiking', 'running', 'going to the beach', 'ice climbing', 'stand-up paddleboarding (SUP)', 'skiing', 'biking', 'cross-country skiing', 'rafting', 'paragliding', 'swimming', 'rock climbing', 'horseback riding', 'snorkeling', 'kayaking / canoeing', 'surfing', 'fishing', 'scuba diving'], 'scores': [0.9673612117767334, 0.851227879524231, 0.8119550943374634, 0.6501596570014954, 0.119605652987957, 0.030798301100730896, 0.0016445431392639875, 0.00024797520018182695, 0.00019679528486449271, 0.00017994307563640177, 0.00014823905075900257, 0.00011313055438222364, 0.00010658867540769279, 2.934567237389274e-05, 2.574020800238941e-05, 2.250136276416015e-05, 2.246206895506475e-05, 1.90786668099463e-05, 1.7564769223099574e-05, 1.5156508197833318e-05, 1.5060699297464453e-05, 1.4467946130025666e-05, 1.2958912520844024e-05, 8.721424819668755e-06, 7.419628673233092e-06]}\n", - "['yoga', 'relaxing', 'sightseeing', 'hiking']\n", - "1\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'warm destination / summer', 'tropical / humid', 'rainy climate'], 'scores': [0.7285766005516052, 0.256941556930542, 0.0047937845811247826, 0.003848850727081299, 0.0029669953510165215, 0.002872203476727009]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight', 'minimalist'], 'scores': [0.5102185606956482, 0.21124626696109772, 0.143381267786026, 0.1351538896560669]}\n", - "luxury (including evening wear)\n", - "3\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8451984524726868, 0.13289128243923187, 0.021910231560468674]}\n", - "casual\n", - "4\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['indoor', 'huts with half board', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.9983111023902893, 0.0010714009404182434, 0.00041075368062593043, 0.0002067020977847278]}\n", - "indoor\n", - "5\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9871621131896973, 0.012837963178753853]}\n", - "no own vehicle\n", - "6\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['snow and ice', 'self-supported (bring your own cooking gear)', 'pet-friendly', 'travel with children', 'no special conditions to consider', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.43503761291503906, 0.2160661667585373, 0.11101733148097992, 0.09975709766149521, 0.04071706160902977, 0.035351455211639404, 0.034011270850896835, 0.028042016550898552]}\n", - "snow and ice\n", - "7\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['7+ days', '7 days', '5 days', '6 days', '1 day', '4 days', '3 days', '2 days'], 'scores': [0.9084722995758057, 0.027727678418159485, 0.013248518109321594, 0.012942418456077576, 0.012128633446991444, 0.011794760823249817, 0.007681164424866438, 0.006004549562931061]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type yoga / wellness retreat \n", - "1 activities [yoga, relaxing, sightseeing, hiking] \n", - "2 climate_or_season variable weather / spring / autumn \n", - "3 style_or_comfort luxury (including evening wear) \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation no own vehicle \n", - "7 special_conditions snow and ice \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 yoga / wellness retreat \n", - "1 [hut-to-hut hiking, yoga] \n", - "2 cold destination / winter \n", - "3 lightweight (but comfortable) \n", - "4 formal (business trip) \n", - "5 sleeping in a tent \n", - "6 no own vehicle \n", - "7 avalanche-prone terrain \n", - "8 7 days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n", - "0 0.444444 1.000000 0.812500\n", - "0 0.555556 1.000000 0.833333\n", - "0 0.333333 0.000000 1.000000\n", - "0 0.222222 0.500000 0.750000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski tour / skitour', 'micro-adventure / weekend trip', 'cultural exploration', 'digital nomad trip', 'nature escape', 'city trip', 'festival trip', 'long-distance hike / thru-hike', 'hut trek (winter)', 'camping trip (campground)', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'yoga / wellness retreat', 'beach vacation', 'hut trek (summer)', 'road trip (car/camper)'], 'scores': [0.7912495136260986, 0.18457308411598206, 0.006496830843389034, 0.005906335078179836, 0.0022365122567862272, 0.0019783126190304756, 0.001958322012796998, 0.0015622376231476665, 0.0010011475533246994, 0.0008931723423302174, 0.0008437229553237557, 0.0006696251803077757, 0.0003258714859839529, 0.0001465948298573494, 8.767224062466994e-05, 7.109773287083954e-05]}\n", - "ski tour / skitour\n", - "0\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski touring', 'skiing', 'sightseeing', 'photography', 'relaxing', 'cross-country skiing', 'snowshoe hiking', 'running', 'ice climbing', 'yoga', 'hiking', 'hut-to-hut hiking', 'going to the beach', 'paragliding', 'rafting', 'rock climbing', 'biking', 'fishing', 'horseback riding', 'surfing', 'swimming', 'kayaking / canoeing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'scuba diving'], 'scores': [0.9999654293060303, 0.9944596886634827, 0.9757429957389832, 0.7401605844497681, 0.531012237071991, 0.43034660816192627, 0.05276774987578392, 0.023154079914093018, 0.014407726936042309, 0.005799490958452225, 0.0014456392964348197, 0.00032733430271036923, 0.00017197725537698716, 0.00013273980584926903, 6.611074786633253e-05, 6.148772808955982e-05, 2.5040852051461115e-05, 1.2513893125287723e-05, 1.1538132639543619e-05, 1.1156663276779e-05, 9.319897799286991e-06, 6.415570624085376e-06, 4.8607284952595364e-06, 4.313362751418026e-06, 2.94029791803041e-06]}\n", - "['ski touring', 'skiing', 'sightseeing', 'photography', 'relaxing']\n", - "1\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'rainy climate', 'warm destination / summer', 'tropical / humid', 'dry / desert-like'], 'scores': [0.995788037776947, 0.003548521315678954, 0.00025412594550289214, 0.00015224718663375825, 0.00014055441715754569, 0.00011639297736110166]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)'], 'scores': [0.687770664691925, 0.16885720193386078, 0.13132035732269287, 0.012051742523908615]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5839866399765015, 0.29318928718566895, 0.12282407283782959]}\n", - "casual\n", - "4\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['indoor', 'huts with half board', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.9995657801628113, 0.0003081962640862912, 0.00010346570343244821, 2.251639853056986e-05]}\n", - "indoor\n", - "5\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.5097633004188538, 0.49023669958114624]}\n", - "no own vehicle\n", - "6\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['snow and ice', 'travel with children', 'snow, ice and avalanche-prone terrain', 'high alpine terrain', 'off-grid / no electricity', 'no special conditions to consider', 'self-supported (bring your own cooking gear)', 'pet-friendly'], 'scores': [0.8326128721237183, 0.058215875178575516, 0.03803802654147148, 0.037274911999702454, 0.019825320690870285, 0.006256969179958105, 0.003933396656066179, 0.0038426516111940145]}\n", - "snow and ice\n", - "7\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['7+ days', '7 days', '5 days', '6 days', '2 days', '3 days', '4 days', '1 day'], 'scores': [0.8862869739532471, 0.023272352293133736, 0.018582874909043312, 0.017153384163975716, 0.015721378847956657, 0.014918344095349312, 0.013972579501569271, 0.010092118754982948]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type ski tour / skitour \n", - "1 activities [ski touring, skiing, sightseeing, photography... \n", - "2 climate_or_season cold destination / winter \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation no own vehicle \n", - "7 special_conditions snow and ice \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 ski tour / skitour \n", - "1 [ski touring, photography, swimming] \n", - "2 cold destination / winter \n", - "3 minimalist \n", - "4 conservative \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 avalanche-prone terrain \n", - "8 5 days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n", - "0 0.444444 1.000000 0.812500\n", - "0 0.555556 1.000000 0.833333\n", - "0 0.333333 0.000000 1.000000\n", - "0 0.222222 0.500000 0.750000\n", - "0 0.555556 0.666667 0.600000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['camping trip (wild camping)', 'camping trip (campground)', 'road trip (car/camper)', 'micro-adventure / weekend trip', 'beach vacation', 'cultural exploration', 'digital nomad trip', 'festival trip', 'nature escape', 'hut trek (summer)', 'ski tour / skitour', 'city trip', 'yoga / wellness retreat', 'long-distance hike / thru-hike', 'hut trek (winter)', 'snowboard / splitboard trip'], 'scores': [0.4519400894641876, 0.28106340765953064, 0.13299500942230225, 0.119535893201828, 0.006582783069461584, 0.0017220464069396257, 0.001517383847385645, 0.0014019669033586979, 0.001203698804602027, 0.0011794682359322906, 0.0002996847906615585, 0.00015913322567939758, 0.00015873221855144948, 0.00010613033373374492, 7.342447497649118e-05, 6.111798575147986e-05]}\n", - "camping trip (wild camping)\n", - "0\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['kayaking / canoeing', 'relaxing', 'swimming', 'snorkeling', 'going to the beach', 'sightseeing', 'rafting', 'running', 'hut-to-hut hiking', 'hiking', 'biking', 'photography', 'scuba diving', 'fishing', 'stand-up paddleboarding (SUP)', 'ski touring', 'surfing', 'paragliding', 'horseback riding', 'skiing', 'yoga', 'cross-country skiing', 'rock climbing', 'snowshoe hiking', 'ice climbing'], 'scores': [0.9992640614509583, 0.9951056241989136, 0.952499508857727, 0.745958149433136, 0.31057634949684143, 0.007450661156326532, 0.001950735691934824, 0.0017637719865888357, 0.00034216392668895423, 0.0001901666691992432, 0.00014842729433439672, 7.320140139199793e-05, 4.365198401501402e-05, 2.900436447816901e-05, 2.0703428162960336e-05, 1.2638719454116654e-05, 1.2075782251486089e-05, 1.2074711776222102e-05, 1.0869985089811962e-05, 8.656240424897987e-06, 7.343625838984735e-06, 5.0360499699309e-06, 3.929691501980415e-06, 3.7386994335975032e-06, 3.6782789720746223e-06]}\n", - "['kayaking / canoeing', 'relaxing', 'swimming', 'snorkeling']\n", - "1\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['tropical / humid', 'warm destination / summer', 'variable weather / spring / autumn', 'rainy climate', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.8114831447601318, 0.1454213559627533, 0.04021230712532997, 0.0011621474986895919, 0.0009152473649010062, 0.0008057011291384697]}\n", - "tropical / humid\n", - "2\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)'], 'scores': [0.9056079387664795, 0.0562594048678875, 0.03654729574918747, 0.0015853168442845345]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.9951170682907104, 0.003952663391828537, 0.0009303003898821771]}\n", - "casual\n", - "4\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['sleeping in a car', 'sleeping in a tent', 'huts with half board', 'indoor'], 'scores': [0.46298423409461975, 0.28609219193458557, 0.13673897087574005, 0.11418462544679642]}\n", - "sleeping in a car\n", - "5\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.9969540238380432, 0.003045988967642188]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['off-grid / no electricity', 'travel with children', 'self-supported (bring your own cooking gear)', 'no special conditions to consider', 'pet-friendly', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'snow and ice'], 'scores': [0.8579566478729248, 0.04456052556633949, 0.036918289959430695, 0.033982858061790466, 0.015213035978376865, 0.0060641285963356495, 0.002715851878747344, 0.00258863833732903]}\n", - "off-grid / no electricity\n", - "7\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['3 days', '4 days', '2 days', '7+ days', '5 days', '6 days', '7 days', '1 day'], 'scores': [0.9772002100944519, 0.00542174419388175, 0.004143798258155584, 0.004068906418979168, 0.0026373467408120632, 0.002349153393879533, 0.002291932003572583, 0.001886898186057806]}\n", - "3 days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type camping trip (wild camping) \n", - "1 activities [kayaking / canoeing, relaxing, swimming, snor... \n", - "2 climate_or_season tropical / humid \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation sleeping in a car \n", - "6 transportation own vehicle \n", - "7 special_conditions off-grid / no electricity \n", - "8 trip_length_days 3 days \n", - "\n", - " true_class \n", - "0 camping trip (wild camping) \n", - "1 [scuba diving, kayaking / canoeing] \n", - "2 tropical / humid \n", - "3 lightweight (but comfortable) \n", - "4 conservative \n", - "5 sleeping in a tent \n", - "6 own vehicle \n", - "7 no special conditions to consider \n", - "8 3 days \n", - " accuracy true_ident false_pred\n", - "0 0.444444 0.000000 NaN\n", - "0 0.666667 1.000000 0.666667\n", - "0 0.444444 0.000000 1.000000\n", - "0 0.333333 0.666667 0.000000\n", - "0 0.444444 1.000000 0.812500\n", - "0 0.555556 1.000000 0.833333\n", - "0 0.333333 0.000000 1.000000\n", - "0 0.222222 0.500000 0.750000\n", - "0 0.555556 0.666667 0.600000\n", - "0 0.444444 0.500000 0.750000\n", - " superclass same_value same_value same_value same_value \\\n", - "0 activity_type False True True False \n", - "1 activities False False False False \n", - "2 climate_or_season False False False True \n", - "3 style_or_comfort False True False False \n", - "4 dress_code True True True True \n", - "5 accommodation True True True False \n", - "6 transportation True True False False \n", - "7 special_conditions False False False False \n", - "8 trip_length_days True True True True \n", - "\n", - " same_value same_value same_value same_value same_value same_value \n", - "0 False True True True True True \n", - "1 False False False False False False \n", - "2 True False False False True True \n", - "3 True True False False True False \n", - "4 True True True False False False \n", - "5 False True True False True False \n", - "6 False True False True True True \n", - "7 False False False False False False \n", - "8 True False False False False True \n", - " superclass accuracy\n", - "0 activity_type 0.7\n", - "1 activities 0.0\n", - "2 climate_or_season 0.4\n", - "3 style_or_comfort 0.4\n", - "4 dress_code 0.7\n", - "5 accommodation 0.6\n", - "6 transportation 0.6\n", - "7 special_conditions 0.0\n", - "8 trip_length_days 0.6\n", - "accuracy 0.444444\n", - "true_ident 0.533333\n", - "false_pred 0.712500\n", - "dtype: float64\n", - "\n", - "Using model: joeddav/bart-large-mnli-yahoo-answers\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['cultural exploration', 'micro-adventure / weekend trip', 'beach vacation', 'city trip', 'road trip (car/camper)', 'long-distance hike / thru-hike', 'festival trip', 'nature escape', 'digital nomad trip', 'ski tour / skitour', 'hut trek (summer)', 'camping trip (campground)', 'camping trip (wild camping)', 'hut trek (winter)', 'snowboard / splitboard trip', 'yoga / wellness retreat'], 'scores': [0.16716161370277405, 0.12716785073280334, 0.1101449728012085, 0.08154628425836563, 0.06655469536781311, 0.05304424837231636, 0.04946322366595268, 0.0479649193584919, 0.04717966169118881, 0.04617271572351456, 0.039695873856544495, 0.03630887717008591, 0.03551309555768967, 0.03350067511200905, 0.02996276691555977, 0.028618555516004562]}\n", - "cultural exploration\n", - "0\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['sightseeing', 'relaxing', 'going to the beach', 'hiking', 'kayaking / canoeing', 'rafting', 'ski touring', 'hut-to-hut hiking', 'photography', 'biking', 'skiing', 'scuba diving', 'snorkeling', 'fishing', 'surfing', 'horseback riding', 'swimming', 'rock climbing', 'paragliding', 'ice climbing', 'cross-country skiing', 'running', 'snowshoe hiking', 'stand-up paddleboarding (SUP)', 'yoga'], 'scores': [0.8850327730178833, 0.7176618576049805, 0.6749467253684998, 0.42652514576911926, 0.32720306515693665, 0.25558674335479736, 0.2530333697795868, 0.24432694911956787, 0.23511365056037903, 0.22848117351531982, 0.182534322142601, 0.17652571201324463, 0.17509806156158447, 0.1716732233762741, 0.1655716449022293, 0.16310735046863556, 0.15896931290626526, 0.1521538496017456, 0.14194028079509735, 0.1316554993391037, 0.12896256148815155, 0.12777365744113922, 0.12260609865188599, 0.1141638234257698, 0.09925767034292221]}\n", - "['sightseeing', 'relaxing', 'going to the beach']\n", - "1\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'rainy climate'], 'scores': [0.266559362411499, 0.17630772292613983, 0.16403718292713165, 0.15154631435871124, 0.13040785491466522, 0.11114154011011124]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.38021835684776306, 0.23342055082321167, 0.22524654865264893, 0.16111454367637634]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.44398602843284607, 0.2991285026073456, 0.25688546895980835]}\n", - "conservative\n", - "4\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.3143824338912964, 0.24525196850299835, 0.22517447173595428, 0.21519118547439575]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5519587993621826, 0.4480411410331726]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no special conditions to consider', 'travel with children', 'high alpine terrain', 'self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'snow and ice', 'pet-friendly', 'snow, ice and avalanche-prone terrain'], 'scores': [0.20332522690296173, 0.13691647350788116, 0.12470469623804092, 0.12075766921043396, 0.11970027536153793, 0.10545651614665985, 0.09536156803369522, 0.09377763420343399]}\n", - "no special conditions to consider\n", - "7\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '6 days', '7 days', '4 days', '5 days', '2 days', '3 days', '1 day'], 'scores': [0.18392924964427948, 0.1266929656267166, 0.12513120472431183, 0.1190633624792099, 0.11783891916275024, 0.11224181950092316, 0.11214782297611237, 0.10295464098453522]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type cultural exploration \n", - "1 activities [sightseeing, relaxing, going to the beach] \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort minimalist \n", - "4 dress_code conservative \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions no special conditions to consider \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 beach vacation \n", - "1 [swimming, going to the beach, relaxing, hiking] \n", - "2 warm destination / summer \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.5 0.333333\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'cultural exploration', 'micro-adventure / weekend trip', 'road trip (car/camper)', 'festival trip', 'ski tour / skitour', 'long-distance hike / thru-hike', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'beach vacation', 'snowboard / splitboard trip', 'hut trek (winter)', 'camping trip (campground)', 'camping trip (wild camping)', 'yoga / wellness retreat'], 'scores': [0.25980284810066223, 0.16085410118103027, 0.11896767467260361, 0.05226515233516693, 0.050702739506959915, 0.046058136969804764, 0.0418943352997303, 0.04128628969192505, 0.031528014689683914, 0.030673017725348473, 0.029140915721654892, 0.02851775847375393, 0.028151461854577065, 0.02802700735628605, 0.027383984997868538, 0.024746567010879517]}\n", - "city trip\n", - "0\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'relaxing', 'photography', 'ski touring', 'kayaking / canoeing', 'horseback riding', 'biking', 'running', 'hut-to-hut hiking', 'skiing', 'hiking', 'rafting', 'snowshoe hiking', 'cross-country skiing', 'going to the beach', 'paragliding', 'ice climbing', 'stand-up paddleboarding (SUP)', 'rock climbing', 'yoga', 'fishing', 'scuba diving', 'snorkeling', 'surfing', 'swimming'], 'scores': [0.8883329033851624, 0.3308798372745514, 0.27078673243522644, 0.2502721846103668, 0.18221960961818695, 0.17400631308555603, 0.1706402450799942, 0.16008920967578888, 0.15355552732944489, 0.15223640203475952, 0.14949491620063782, 0.14705154299736023, 0.12970532476902008, 0.12721051275730133, 0.12559349834918976, 0.11049619317054749, 0.10980241000652313, 0.10505887120962143, 0.09921692311763763, 0.09889169037342072, 0.09842774271965027, 0.08242142200469971, 0.07435522973537445, 0.06917035579681396, 0.05980757251381874]}\n", - "['sightseeing']\n", - "1\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'tropical / humid', 'rainy climate'], 'scores': [0.20907093584537506, 0.19385375082492828, 0.18452785909175873, 0.14411833882331848, 0.13630695641040802, 0.13212208449840546]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.33152344822883606, 0.2675602436065674, 0.21385043859481812, 0.18706588447093964]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.4617535471916199, 0.2691788673400879, 0.26906755566596985]}\n", - "conservative\n", - "4\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.3076592981815338, 0.2513667345046997, 0.22900241613388062, 0.21197155117988586]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5231750011444092, 0.4768249988555908]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['no special conditions to consider', 'travel with children', 'self-supported (bring your own cooking gear)', 'high alpine terrain', 'off-grid / no electricity', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'pet-friendly'], 'scores': [0.18486706912517548, 0.13879624009132385, 0.12936383485794067, 0.1200103908777237, 0.11849591881036758, 0.10969463735818863, 0.1023821234703064, 0.0963897556066513]}\n", - "no special conditions to consider\n", - "7\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '7+ days', '4 days', '7 days', '5 days', '6 days', '2 days', '1 day'], 'scores': [0.26189228892326355, 0.12783558666706085, 0.12143480032682419, 0.10889916121959686, 0.1056910902261734, 0.1056862473487854, 0.0874469056725502, 0.08111389726400375]}\n", - "3 days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type city trip \n", - "1 activities [sightseeing] \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort minimalist \n", - "4 dress_code conservative \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions no special conditions to consider \n", - "8 trip_length_days 3 days \n", - "\n", - " true_class \n", - "0 city trip \n", - "1 [sightseeing] \n", - "2 variable weather / spring / autumn \n", - "3 luxury (including evening wear) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 3 days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.5 0.333333\n", - "0 0.333333 1.0 0.000000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['festival trip', 'cultural exploration', 'city trip', 'micro-adventure / weekend trip', 'hut trek (winter)', 'road trip (car/camper)', 'ski tour / skitour', 'digital nomad trip', 'hut trek (summer)', 'beach vacation', 'long-distance hike / thru-hike', 'snowboard / splitboard trip', 'camping trip (campground)', 'nature escape', 'camping trip (wild camping)', 'yoga / wellness retreat'], 'scores': [0.293078750371933, 0.16062624752521515, 0.06345170736312866, 0.06158151477575302, 0.056430768221616745, 0.04617263004183769, 0.040666013956069946, 0.03946645185351372, 0.03829963505268097, 0.03487568348646164, 0.03402161970734596, 0.02967722713947296, 0.02956923469901085, 0.027611277997493744, 0.025715729221701622, 0.01875552535057068]}\n", - "festival trip\n", - "0\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'hut-to-hut hiking', 'ski touring', 'going to the beach', 'snowshoe hiking', 'rafting', 'skiing', 'horseback riding', 'hiking', 'biking', 'cross-country skiing', 'kayaking / canoeing', 'ice climbing', 'rock climbing', 'stand-up paddleboarding (SUP)', 'paragliding', 'fishing', 'scuba diving', 'snorkeling', 'surfing', 'yoga', 'swimming'], 'scores': [0.2844759225845337, 0.14781935513019562, 0.1255393922328949, 0.061169520020484924, 0.059364836663007736, 0.05813053250312805, 0.055929142981767654, 0.05124993249773979, 0.04971772059798241, 0.04930657893419266, 0.04415588453412056, 0.039289798587560654, 0.03719090297818184, 0.036852315068244934, 0.03645915165543556, 0.032679203897714615, 0.031043078750371933, 0.02770671620965004, 0.026979653164744377, 0.024992449209094048, 0.020528962835669518, 0.017404912039637566, 0.013790704309940338, 0.012935450300574303, 0.01148306392133236]}\n", - "[]\n", - "1\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['cold destination / winter', 'warm destination / summer', 'variable weather / spring / autumn', 'tropical / humid', 'dry / desert-like', 'rainy climate'], 'scores': [0.3128221333026886, 0.21224693953990936, 0.14469023048877716, 0.12454197555780411, 0.10379233956336975, 0.10190633684396744]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight'], 'scores': [0.3766309320926666, 0.21288399398326874, 0.2106471210718155, 0.19983801245689392]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.4758940637111664, 0.35429829359054565, 0.16980759799480438]}\n", - "conservative\n", - "4\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['huts with half board', 'sleeping in a tent', 'indoor', 'sleeping in a car'], 'scores': [0.3428862690925598, 0.22737044095993042, 0.22447851300239563, 0.20526479184627533]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5038818717002869, 0.49611806869506836]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['no special conditions to consider', 'travel with children', 'snow and ice', 'self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'pet-friendly'], 'scores': [0.23147523403167725, 0.18651336431503296, 0.11385881155729294, 0.10224857926368713, 0.10020803660154343, 0.09738393872976303, 0.08595966547727585, 0.08235230296850204]}\n", - "no special conditions to consider\n", - "7\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['7+ days', '2 days', '6 days', '7 days', '4 days', '1 day', '5 days', '3 days'], 'scores': [0.1346655935049057, 0.13231344521045685, 0.12829753756523132, 0.12639833986759186, 0.12144803255796432, 0.12076283246278763, 0.11963488906621933, 0.11647934466600418]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type festival trip \n", - "1 activities [] \n", - "2 climate_or_season cold destination / winter \n", - "3 style_or_comfort minimalist \n", - "4 dress_code conservative \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions no special conditions to consider \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 city trip \n", - "1 [relaxing] \n", - "2 cold destination / winter \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.5 0.333333\n", - "0 0.333333 1.0 0.000000\n", - "0 0.333333 0.0 NaN\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['cultural exploration', 'micro-adventure / weekend trip', 'city trip', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'festival trip', 'beach vacation', 'nature escape', 'digital nomad trip', 'ski tour / skitour', 'hut trek (summer)', 'camping trip (wild camping)', 'camping trip (campground)', 'hut trek (winter)', 'snowboard / splitboard trip', 'yoga / wellness retreat'], 'scores': [0.2301025688648224, 0.09925426542758942, 0.08985505998134613, 0.06585080176591873, 0.05669157952070236, 0.05446624383330345, 0.04960283637046814, 0.04747692868113518, 0.04661855101585388, 0.04570435360074043, 0.04439116269350052, 0.03897939622402191, 0.03885677829384804, 0.03418416902422905, 0.03050987981259823, 0.027455391362309456]}\n", - "cultural exploration\n", - "0\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['sightseeing', 'hiking', 'rafting', 'kayaking / canoeing', 'hut-to-hut hiking', 'photography', 'ski touring', 'relaxing', 'going to the beach', 'rock climbing', 'horseback riding', 'snowshoe hiking', 'biking', 'fishing', 'skiing', 'ice climbing', 'cross-country skiing', 'scuba diving', 'running', 'snorkeling', 'paragliding', 'stand-up paddleboarding (SUP)', 'surfing', 'yoga', 'swimming'], 'scores': [0.9237843751907349, 0.5807417035102844, 0.36438122391700745, 0.35156574845314026, 0.31867438554763794, 0.31593140959739685, 0.251972496509552, 0.23514169454574585, 0.2322484701871872, 0.1928747147321701, 0.19096393883228302, 0.19053521752357483, 0.17830251157283783, 0.1695105880498886, 0.1686009168624878, 0.16153772175312042, 0.1443871408700943, 0.1430586725473404, 0.13869552314281464, 0.13344153761863708, 0.13196821510791779, 0.11570252478122711, 0.11023450642824173, 0.10557413846254349, 0.06943294405937195]}\n", - "['sightseeing', 'hiking']\n", - "1\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'rainy climate', 'cold destination / winter'], 'scores': [0.2094230055809021, 0.1916349083185196, 0.16284117102622986, 0.15685588121414185, 0.14797377586364746, 0.13127130270004272]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.31595101952552795, 0.24356427788734436, 0.23434904217720032, 0.20613564550876617]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['conservative', 'formal (business trip)', 'casual'], 'scores': [0.37413230538368225, 0.325387179851532, 0.30048051476478577]}\n", - "conservative\n", - "4\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['huts with half board', 'sleeping in a tent', 'sleeping in a car', 'indoor'], 'scores': [0.3308664560317993, 0.24956747889518738, 0.21383841335773468, 0.20572762191295624]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5778870582580566, 0.42211291193962097]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['no special conditions to consider', 'high alpine terrain', 'travel with children', 'self-supported (bring your own cooking gear)', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.16755643486976624, 0.16390444338321686, 0.1370989829301834, 0.12557697296142578, 0.12270595878362656, 0.11366964131593704, 0.0997702106833458, 0.06971736252307892]}\n", - "no special conditions to consider\n", - "7\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['7+ days', '3 days', '7 days', '6 days', '5 days', '4 days', '2 days', '1 day'], 'scores': [0.21186265349388123, 0.1408892422914505, 0.1314566731452942, 0.1299559772014618, 0.11523696780204773, 0.1068982481956482, 0.08361256867647171, 0.08008760213851929]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type cultural exploration \n", - "1 activities [sightseeing, hiking] \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort minimalist \n", - "4 dress_code conservative \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions no special conditions to consider \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 cultural exploration \n", - "1 [sightseeing, hiking, rafting] \n", - "2 variable weather / spring / autumn \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 rainy climate \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['micro-adventure / weekend trip', 'nature escape', 'cultural exploration', 'long-distance hike / thru-hike', 'hut trek (summer)', 'road trip (car/camper)', 'ski tour / skitour', 'beach vacation', 'camping trip (wild camping)', 'yoga / wellness retreat', 'camping trip (campground)', 'city trip', 'festival trip', 'digital nomad trip', 'snowboard / splitboard trip', 'hut trek (winter)'], 'scores': [0.1256595253944397, 0.11564762890338898, 0.0818299949169159, 0.0732298418879509, 0.06507544964551926, 0.06311747431755066, 0.06167558953166008, 0.05981043726205826, 0.05292873829603195, 0.052205272018909454, 0.0516391284763813, 0.05140812322497368, 0.04123023897409439, 0.03586934134364128, 0.03446359559893608, 0.03420962020754814]}\n", - "micro-adventure / weekend trip\n", - "0\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['sightseeing', 'relaxing', 'hiking', 'going to the beach', 'ski touring', 'kayaking / canoeing', 'swimming', 'snowshoe hiking', 'biking', 'skiing', 'hut-to-hut hiking', 'rafting', 'horseback riding', 'cross-country skiing', 'rock climbing', 'fishing', 'photography', 'snorkeling', 'ice climbing', 'scuba diving', 'running', 'paragliding', 'yoga', 'stand-up paddleboarding (SUP)', 'surfing'], 'scores': [0.9057115316390991, 0.8961816430091858, 0.8563272953033447, 0.560343325138092, 0.5547003149986267, 0.5404509902000427, 0.4798630177974701, 0.44734299182891846, 0.4323567748069763, 0.42824774980545044, 0.4198780655860901, 0.4178984761238098, 0.39238718152046204, 0.3922390639781952, 0.3457918167114258, 0.32880064845085144, 0.28747114539146423, 0.2871841490268707, 0.2843594551086426, 0.2745117247104645, 0.25936663150787354, 0.255580872297287, 0.25076478719711304, 0.2368549406528473, 0.21448370814323425]}\n", - "['sightseeing', 'relaxing', 'hiking', 'going to the beach', 'ski touring', 'kayaking / canoeing']\n", - "1\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.5326037406921387, 0.1439884454011917, 0.09808021783828735, 0.08567545562982559, 0.07123921066522598, 0.06841281056404114]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['luxury (including evening wear)', 'minimalist', 'ultralight', 'lightweight (but comfortable)'], 'scores': [0.2719852030277252, 0.25683045387268066, 0.2543821632862091, 0.2168021947145462]}\n", - "luxury (including evening wear)\n", - "3\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.367921382188797, 0.3297698199748993, 0.3023088574409485]}\n", - "conservative\n", - "4\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['huts with half board', 'sleeping in a tent', 'indoor', 'sleeping in a car'], 'scores': [0.2885679304599762, 0.2731105387210846, 0.22541317343711853, 0.21290835738182068]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5603166222572327, 0.43968331813812256]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['high alpine terrain', 'no special conditions to consider', 'snow and ice', 'travel with children', 'snow, ice and avalanche-prone terrain', 'pet-friendly', 'off-grid / no electricity', 'self-supported (bring your own cooking gear)'], 'scores': [0.17922939360141754, 0.14795276522636414, 0.14044788479804993, 0.1273242086172104, 0.12166408449411392, 0.10294044762849808, 0.09357009083032608, 0.08687112480401993]}\n", - "high alpine terrain\n", - "7\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['7+ days', '7 days', '6 days', '5 days', '1 day', '4 days', '2 days', '3 days'], 'scores': [0.43496060371398926, 0.09060744941234589, 0.08739206194877625, 0.0825117751955986, 0.08092711120843887, 0.07746576517820358, 0.07315219938755035, 0.07298304885625839]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type micro-adventure / weekend trip \n", - "1 activities [sightseeing, relaxing, hiking, going to the b... \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort luxury (including evening wear) \n", - "4 dress_code conservative \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions high alpine terrain \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 nature escape \n", - "1 [swimming, relaxing, hiking] \n", - "2 warm destination / summer \n", - "3 lightweight (but comfortable) \n", - "4 casual \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 no special conditions to consider \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n", - "0 0.222222 0.666667 0.666667\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['long-distance hike / thru-hike', 'micro-adventure / weekend trip', 'nature escape', 'camping trip (wild camping)', 'road trip (car/camper)', 'cultural exploration', 'beach vacation', 'ski tour / skitour', 'camping trip (campground)', 'snowboard / splitboard trip', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'digital nomad trip', 'festival trip', 'yoga / wellness retreat'], 'scores': [0.20863620936870575, 0.09685744345188141, 0.07517095655202866, 0.07343076914548874, 0.0706576257944107, 0.06391564011573792, 0.06255688518285751, 0.053629063069820404, 0.050872139632701874, 0.04593609273433685, 0.03691982477903366, 0.03505941480398178, 0.03402595594525337, 0.032621342688798904, 0.030087171122431755, 0.029623446986079216]}\n", - "long-distance hike / thru-hike\n", - "0\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['hiking', 'sightseeing', 'hut-to-hut hiking', 'kayaking / canoeing', 'biking', 'snowshoe hiking', 'rock climbing', 'running', 'going to the beach', 'ski touring', 'horseback riding', 'cross-country skiing', 'rafting', 'photography', 'skiing', 'relaxing', 'ice climbing', 'stand-up paddleboarding (SUP)', 'paragliding', 'fishing', 'snorkeling', 'surfing', 'scuba diving', 'swimming', 'yoga'], 'scores': [0.9707403779029846, 0.9418103694915771, 0.7376925349235535, 0.7047153115272522, 0.6968525648117065, 0.6724464893341064, 0.6657483577728271, 0.639492392539978, 0.6352409720420837, 0.622490406036377, 0.6204463243484497, 0.5850474834442139, 0.5416201949119568, 0.5212154984474182, 0.4965360760688782, 0.47773101925849915, 0.4552563726902008, 0.4388185143470764, 0.36490294337272644, 0.35453176498413086, 0.3505079746246338, 0.34379279613494873, 0.33917883038520813, 0.29816576838493347, 0.22803360223770142]}\n", - "['hiking', 'sightseeing', 'hut-to-hut hiking', 'kayaking / canoeing', 'biking', 'snowshoe hiking', 'rock climbing', 'running', 'going to the beach', 'ski touring', 'horseback riding', 'cross-country skiing', 'rafting', 'photography']\n", - "1\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['cold destination / winter', 'warm destination / summer', 'variable weather / spring / autumn', 'dry / desert-like', 'tropical / humid', 'rainy climate'], 'scores': [0.21317142248153687, 0.19148282706737518, 0.1802588552236557, 0.1510961800813675, 0.1343575417995453, 0.12963321805000305]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['ultralight', 'minimalist', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.3694746792316437, 0.2801797389984131, 0.23808696866035461, 0.11225863546133041]}\n", - "ultralight\n", - "3\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.34530097246170044, 0.3344888389110565, 0.32021021842956543]}\n", - "casual\n", - "4\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['huts with half board', 'sleeping in a tent', 'sleeping in a car', 'indoor'], 'scores': [0.41636165976524353, 0.25336143374443054, 0.19501948356628418, 0.13525746762752533]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5455801486968994, 0.454419881105423]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['high alpine terrain', 'snow, ice and avalanche-prone terrain', 'self-supported (bring your own cooking gear)', 'snow and ice', 'no special conditions to consider', 'off-grid / no electricity', 'travel with children', 'pet-friendly'], 'scores': [0.23942454159259796, 0.17255951464176178, 0.14906182885169983, 0.12937109172344208, 0.10819944739341736, 0.07577616721391678, 0.065253347158432, 0.060354046523571014]}\n", - "high alpine terrain\n", - "7\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['7+ days', '6 days', '7 days', '5 days', '4 days', '1 day', '2 days', '3 days'], 'scores': [0.22824247181415558, 0.218679741024971, 0.15772362053394318, 0.09058724343776703, 0.08163046836853027, 0.07612431794404984, 0.073652483522892, 0.07335961610078812]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type long-distance hike / thru-hike \n", - "1 activities [hiking, sightseeing, hut-to-hut hiking, kayak... \n", - "2 climate_or_season cold destination / winter \n", - "3 style_or_comfort ultralight \n", - "4 dress_code casual \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions high alpine terrain \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 long-distance hike / thru-hike \n", - "1 [going to the beach] \n", - "2 tropical / humid \n", - "3 minimalist \n", - "4 casual \n", - "5 huts with half board \n", - "6 own vehicle \n", - "7 off-grid / no electricity \n", - "8 6 days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n", - "0 0.222222 0.666667 0.666667\n", - "0 0.444444 1.000000 0.928571\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'road trip (car/camper)', 'nature escape', 'cultural exploration', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'camping trip (campground)', 'festival trip', 'ski tour / skitour', 'snowboard / splitboard trip', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'digital nomad trip', 'yoga / wellness retreat'], 'scores': [0.23744942247867584, 0.10603270679712296, 0.06524186581373215, 0.06422917544841766, 0.06201164796948433, 0.0533960796892643, 0.05292251333594322, 0.04764849692583084, 0.04592280834913254, 0.044455721974372864, 0.04425935447216034, 0.042198047041893005, 0.03631977364420891, 0.034582093358039856, 0.03345293551683426, 0.029877403751015663]}\n", - "beach vacation\n", - "0\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['going to the beach', 'stand-up paddleboarding (SUP)', 'sightseeing', 'kayaking / canoeing', 'surfing', 'swimming', 'relaxing', 'rafting', 'fishing', 'scuba diving', 'biking', 'snorkeling', 'photography', 'hiking', 'hut-to-hut hiking', 'paragliding', 'running', 'ski touring', 'rock climbing', 'horseback riding', 'skiing', 'yoga', 'cross-country skiing', 'ice climbing', 'snowshoe hiking'], 'scores': [0.9471756219863892, 0.8122013211250305, 0.8093580603599548, 0.7983085513114929, 0.7912724018096924, 0.6105694770812988, 0.5944762229919434, 0.5742869973182678, 0.47236502170562744, 0.3782857060432434, 0.33895358443260193, 0.32937514781951904, 0.3061094880104065, 0.2849915027618408, 0.2622394263744354, 0.2508765459060669, 0.24640551209449768, 0.24543659389019012, 0.22789046168327332, 0.2231861650943756, 0.2161550670862198, 0.19668278098106384, 0.19172737002372742, 0.17304891347885132, 0.1477421224117279]}\n", - "['going to the beach', 'stand-up paddleboarding (SUP)', 'sightseeing', 'kayaking / canoeing', 'surfing', 'swimming', 'relaxing', 'rafting']\n", - "1\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['warm destination / summer', 'cold destination / winter', 'variable weather / spring / autumn', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.3070872128009796, 0.1844758838415146, 0.15898537635803223, 0.13669373095035553, 0.11911879479885101, 0.09363904595375061]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['ultralight', 'minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.28144413232803345, 0.2764531075954437, 0.23644311726093292, 0.20565970242023468]}\n", - "ultralight\n", - "3\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.358445405960083, 0.33785077929496765, 0.30370378494262695]}\n", - "conservative\n", - "4\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.3697204291820526, 0.2906339168548584, 0.20863069593906403, 0.1310148984193802]}\n", - "sleeping in a tent\n", - "5\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5295110940933228, 0.47048884630203247]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['no special conditions to consider', 'snow and ice', 'travel with children', 'self-supported (bring your own cooking gear)', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity', 'high alpine terrain', 'pet-friendly'], 'scores': [0.205083966255188, 0.13198444247245789, 0.13119913637638092, 0.12617307901382446, 0.11661110073328018, 0.10581637173891068, 0.0973207950592041, 0.08581113070249557]}\n", - "no special conditions to consider\n", - "7\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['7+ days', '7 days', '6 days', '2 days', '5 days', '4 days', '3 days', '1 day'], 'scores': [0.19788584113121033, 0.1333414614200592, 0.13238824903964996, 0.12004666030406952, 0.11875136196613312, 0.10994188487529755, 0.1035337820649147, 0.08411075174808502]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type beach vacation \n", - "1 activities [going to the beach, stand-up paddleboarding (... \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort ultralight \n", - "4 dress_code conservative \n", - "5 accommodation sleeping in a tent \n", - "6 transportation own vehicle \n", - "7 special_conditions no special conditions to consider \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 beach vacation \n", - "1 [stand-up paddleboarding (SUP), surfing] \n", - "2 cold destination / winter \n", - "3 ultralight \n", - "4 casual \n", - "5 sleeping in a tent \n", - "6 own vehicle \n", - "7 off-grid / no electricity \n", - "8 6 days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n", - "0 0.222222 0.666667 0.666667\n", - "0 0.444444 1.000000 0.928571\n", - "0 0.444444 1.000000 0.750000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga / wellness retreat', 'micro-adventure / weekend trip', 'nature escape', 'long-distance hike / thru-hike', 'cultural exploration', 'ski tour / skitour', 'hut trek (winter)', 'city trip', 'beach vacation', 'road trip (car/camper)', 'hut trek (summer)', 'festival trip', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'camping trip (campground)', 'digital nomad trip'], 'scores': [0.2606178820133209, 0.08046605437994003, 0.06843063235282898, 0.059995006769895554, 0.059469204396009445, 0.05855844169855118, 0.055849116295576096, 0.047889091074466705, 0.045752931386232376, 0.04353173449635506, 0.04008011892437935, 0.038273148238658905, 0.03779057413339615, 0.03708784282207489, 0.03450765833258629, 0.03170054778456688]}\n", - "yoga / wellness retreat\n", - "0\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga', 'relaxing', 'hiking', 'ski touring', 'sightseeing', 'snowshoe hiking', 'running', 'hut-to-hut hiking', 'skiing', 'going to the beach', 'kayaking / canoeing', 'cross-country skiing', 'swimming', 'ice climbing', 'biking', 'rafting', 'rock climbing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'horseback riding', 'scuba diving', 'paragliding', 'photography', 'surfing', 'fishing'], 'scores': [0.8216512799263, 0.7652244567871094, 0.6132642030715942, 0.5138745307922363, 0.44325223565101624, 0.4208028316497803, 0.37471672892570496, 0.37093672156333923, 0.3666746914386749, 0.3648392856121063, 0.345426082611084, 0.3357292115688324, 0.3067779541015625, 0.3034307062625885, 0.2911964952945709, 0.25312700867652893, 0.24941785633563995, 0.23824645578861237, 0.2241792529821396, 0.213203564286232, 0.20734399557113647, 0.17350167036056519, 0.17043103277683258, 0.15861929953098297, 0.14433901011943817]}\n", - "['yoga', 'relaxing', 'hiking', 'ski touring']\n", - "1\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.36021333932876587, 0.19872936606407166, 0.1792670488357544, 0.0946045070886612, 0.09094184637069702, 0.07624392211437225]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['lightweight (but comfortable)', 'ultralight', 'minimalist', 'luxury (including evening wear)'], 'scores': [0.3093704581260681, 0.2733272314071655, 0.2592032551765442, 0.15809905529022217]}\n", - "lightweight (but comfortable)\n", - "3\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.40370842814445496, 0.3690830171108246, 0.22720862925052643]}\n", - "casual\n", - "4\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['indoor', 'sleeping in a tent', 'huts with half board', 'sleeping in a car'], 'scores': [0.2969803810119629, 0.26551374793052673, 0.22557803988456726, 0.21192780137062073]}\n", - "indoor\n", - "5\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5150290727615356, 0.48497089743614197]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['snow and ice', 'no special conditions to consider', 'snow, ice and avalanche-prone terrain', 'high alpine terrain', 'self-supported (bring your own cooking gear)', 'travel with children', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.17463071644306183, 0.16196538507938385, 0.14370520412921906, 0.13748210668563843, 0.11387145519256592, 0.1002817153930664, 0.09386476129293442, 0.07419868558645248]}\n", - "snow and ice\n", - "7\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['7+ days', '7 days', '6 days', '5 days', '1 day', '4 days', '2 days', '3 days'], 'scores': [0.16799123585224152, 0.12651269137859344, 0.12625618278980255, 0.11859724670648575, 0.11564400792121887, 0.11562533676624298, 0.11541663110256195, 0.11395667493343353]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type yoga / wellness retreat \n", - "1 activities [yoga, relaxing, hiking, ski touring] \n", - "2 climate_or_season cold destination / winter \n", - "3 style_or_comfort lightweight (but comfortable) \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation own vehicle \n", - "7 special_conditions snow and ice \n", - "8 trip_length_days 7+ days \n", - "\n", - " true_class \n", - "0 yoga / wellness retreat \n", - "1 [hut-to-hut hiking, yoga] \n", - "2 cold destination / winter \n", - "3 lightweight (but comfortable) \n", - "4 formal (business trip) \n", - "5 sleeping in a tent \n", - "6 no own vehicle \n", - "7 avalanche-prone terrain \n", - "8 7 days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n", - "0 0.222222 0.666667 0.666667\n", - "0 0.444444 1.000000 0.928571\n", - "0 0.444444 1.000000 0.750000\n", - "0 0.333333 0.500000 0.750000\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] - }, + "source": [ + "def perf_measure(df):\n", + " \"\"\"\n", + " Calculates performance measures:\n", + " Accuracy of classification excluding activities superclass\n", + " Percentage of correctly identified activities (#correctly predicted/#true activities)\n", + " Percentage of wrongly identified activities (#wrongly predicted/#predicted activities)\n", + "\n", + " Parameters:\n", + " df: pd Dataframe returned from pred_trip()\n", + "\n", + " Returns:\n", + " pd Dataframe: containing performance measures\n", + " \"\"\"\n", + " \n", + " df['same_value'] = df['pred_class'] == df['true_class']\n", + " correct = sum(df.loc[df.index != 1, 'same_value'])\n", + " total = len(df['same_value'])\n", + " accuracy = correct/total\n", + " pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + " true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + " correct = [label for label in pred_class if label in true_class]\n", + " num_correct = len(correct)\n", + " correct_perc = num_correct/len(true_class)\n", + " num_pred = len(pred_class)\n", + " if num_pred == 0:\n", + " wrong_perc = math.nan\n", + " else:\n", + " wrong_perc = (num_pred - num_correct)/num_pred\n", + " df_perf = pd.DataFrame({\n", + " 'accuracy': [accuracy],\n", + " 'true_ident': [correct_perc],\n", + " 'false_pred': [wrong_perc]\n", + " })\n", + " return(df_perf)" + ] + }, + { + "cell_type": "markdown", + "id": "c10aa57d-d7ed-45c7-bdf5-29af193c7fd5", + "metadata": {}, + "source": [ + "## Make predictions for many models and trip descriptions\n", + "\n", + "Provide a list of candidate models and apply them to the test data." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "dd7869a8-b436-40de-9ea0-28eb4b7d3248", + "metadata": { + "scrolled": true + }, + "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski tour / skitour', 'micro-adventure / weekend trip', 'cultural exploration', 'road trip (car/camper)', 'city trip', 'snowboard / splitboard trip', 'long-distance hike / thru-hike', 'digital nomad trip', 'hut trek (winter)', 'festival trip', 'hut trek (summer)', 'camping trip (wild camping)', 'nature escape', 'camping trip (campground)', 'beach vacation', 'yoga / wellness retreat'], 'scores': [0.1734267771244049, 0.09546443074941635, 0.08052344620227814, 0.07985977828502655, 0.06759097427129745, 0.06277172267436981, 0.054686594754457474, 0.05254476144909859, 0.0503639318048954, 0.044427838176488876, 0.043578390032052994, 0.043481748551130295, 0.04278255254030228, 0.04047577455639839, 0.038092684000730515, 0.029928630217909813]}\n", - "ski tour / skitour\n", - "0\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski touring', 'sightseeing', 'skiing', 'cross-country skiing', 'kayaking / canoeing', 'photography', 'snowshoe hiking', 'rafting', 'hiking', 'hut-to-hut hiking', 'relaxing', 'biking', 'paragliding', 'stand-up paddleboarding (SUP)', 'ice climbing', 'rock climbing', 'surfing', 'horseback riding', 'running', 'scuba diving', 'going to the beach', 'fishing', 'snorkeling', 'yoga', 'swimming'], 'scores': [0.8142338395118713, 0.7842962741851807, 0.6903234124183655, 0.6132006645202637, 0.5646158456802368, 0.5321369171142578, 0.4776653051376343, 0.47481176257133484, 0.4403829574584961, 0.4385501444339752, 0.43699926137924194, 0.424324631690979, 0.41724103689193726, 0.4036017656326294, 0.39129355549812317, 0.3776353597640991, 0.374114453792572, 0.3706415891647339, 0.3287637531757355, 0.3272634446620941, 0.31675824522972107, 0.30254125595092773, 0.30229055881500244, 0.21720251441001892, 0.20738299190998077]}\n", - "['ski touring', 'sightseeing', 'skiing', 'cross-country skiing', 'kayaking / canoeing', 'photography']\n", - "1\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'dry / desert-like', 'rainy climate'], 'scores': [0.31022897362709045, 0.20760662853717804, 0.1636965423822403, 0.11239969730377197, 0.10346854478120804, 0.10259959101676941]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.3154253363609314, 0.27500393986701965, 0.2093629390001297, 0.20020779967308044]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['formal (business trip)', 'conservative', 'casual'], 'scores': [0.42883870005607605, 0.2967377007007599, 0.27442359924316406]}\n", - "formal (business trip)\n", - "4\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.268301784992218, 0.2666485011577606, 0.23450568318367004, 0.2305440604686737]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5153052806854248, 0.4846946895122528]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['snow, ice and avalanche-prone terrain', 'high alpine terrain', 'no special conditions to consider', 'snow and ice', 'self-supported (bring your own cooking gear)', 'travel with children', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.19052204489707947, 0.15655279159545898, 0.13949212431907654, 0.13879263401031494, 0.11442805081605911, 0.10863885283470154, 0.08574623614549637, 0.06582723557949066]}\n", - "snow, ice and avalanche-prone terrain\n", - "7\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['7+ days', '7 days', '6 days', '5 days', '1 day', '4 days', '2 days', '3 days'], 'scores': [0.2278742790222168, 0.12380822747945786, 0.12119485437870026, 0.11229623854160309, 0.1085328683257103, 0.10332215577363968, 0.10219617187976837, 0.10077515244483948]}\n", - "7+ days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type ski tour / skitour \n", - "1 activities [ski touring, sightseeing, skiing, cross-count... \n", - "2 climate_or_season cold destination / winter \n", - "3 style_or_comfort minimalist \n", - "4 dress_code formal (business trip) \n", - "5 accommodation huts with half board \n", - "6 transportation own vehicle \n", - "7 special_conditions snow, ice and avalanche-prone terrain \n", - "8 trip_length_days 7+ days \n", "\n", - " true_class \n", - "0 ski tour / skitour \n", - "1 [ski touring, photography, swimming] \n", - "2 cold destination / winter \n", - "3 minimalist \n", - "4 conservative \n", - "5 indoor \n", - "6 no own vehicle \n", - "7 avalanche-prone terrain \n", - "8 5 days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n", - "0 0.222222 0.666667 0.666667\n", - "0 0.444444 1.000000 0.928571\n", - "0 0.444444 1.000000 0.750000\n", - "0 0.333333 0.500000 0.750000\n", - "0 0.333333 0.666667 0.666667\n" + "Using model: facebook/bart-large-mnli\n" ] }, { @@ -1638,103 +332,39 @@ ] }, { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['camping trip (wild camping)', 'camping trip (campground)', 'micro-adventure / weekend trip', 'road trip (car/camper)', 'nature escape', 'beach vacation', 'long-distance hike / thru-hike', 'cultural exploration', 'festival trip', 'ski tour / skitour', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'snowboard / splitboard trip', 'digital nomad trip', 'yoga / wellness retreat'], 'scores': [0.24850936233997345, 0.14938758313655853, 0.09667350351810455, 0.08339172601699829, 0.05508505925536156, 0.051402922719717026, 0.044685814529657364, 0.03972415253520012, 0.03578963875770569, 0.03319094330072403, 0.03277123346924782, 0.029747819527983665, 0.02797492779791355, 0.027441974729299545, 0.023192668333649635, 0.021030662581324577]}\n", - "camping trip (wild camping)\n", - "0\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['kayaking / canoeing', 'sightseeing', 'going to the beach', 'snorkeling', 'relaxing', 'hiking', 'rafting', 'hut-to-hut hiking', 'fishing', 'swimming', 'surfing', 'cross-country skiing', 'horseback riding', 'stand-up paddleboarding (SUP)', 'scuba diving', 'ski touring', 'rock climbing', 'photography', 'biking', 'skiing', 'snowshoe hiking', 'ice climbing', 'running', 'paragliding', 'yoga'], 'scores': [0.88539719581604, 0.8517834544181824, 0.6639761924743652, 0.6536601781845093, 0.6192843914031982, 0.5907655358314514, 0.5902426242828369, 0.5398754477500916, 0.522949755191803, 0.40187832713127136, 0.3998588025569916, 0.36464253067970276, 0.36373376846313477, 0.3598483204841614, 0.35947346687316895, 0.3562069237232208, 0.355800062417984, 0.34865936636924744, 0.32515498995780945, 0.3181168735027313, 0.31806549429893494, 0.3143276572227478, 0.2735307514667511, 0.2715666592121124, 0.17215368151664734]}\n", - "['kayaking / canoeing', 'sightseeing', 'going to the beach', 'snorkeling', 'relaxing', 'hiking', 'rafting', 'hut-to-hut hiking', 'fishing']\n", - "1\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'cold destination / winter', 'rainy climate'], 'scores': [0.32865503430366516, 0.1498994529247284, 0.14973486959934235, 0.1377931833267212, 0.12470144778490067, 0.10921601951122284]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.3909915089607239, 0.22962640225887299, 0.21160008013248444, 0.1677819937467575]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.37736961245536804, 0.3252304494380951, 0.29739996790885925]}\n", - "casual\n", - "4\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.42764899134635925, 0.22646835446357727, 0.18703599274158478, 0.1588466912508011]}\n", - "sleeping in a tent\n", - "5\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5207383036613464, 0.47926169633865356]}\n", - "own vehicle\n", - "6\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['no special conditions to consider', 'self-supported (bring your own cooking gear)', 'travel with children', 'high alpine terrain', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.16231811046600342, 0.15695218741893768, 0.1284862905740738, 0.12074963748455048, 0.11439701169729233, 0.11109456419944763, 0.10983186215162277, 0.09617031365633011]}\n", - "no special conditions to consider\n", - "7\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['3 days', '7+ days', '2 days', '4 days', '6 days', '1 day', '7 days', '5 days'], 'scores': [0.3021169900894165, 0.10651747137308121, 0.10220468044281006, 0.10134027898311615, 0.10006321221590042, 0.09801313281059265, 0.09622228145599365, 0.09352197498083115]}\n", - "3 days\n", - "8\n", - " superclass pred_class \\\n", - "0 activity_type camping trip (wild camping) \n", - "1 activities [kayaking / canoeing, sightseeing, going to th... \n", - "2 climate_or_season warm destination / summer \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation sleeping in a tent \n", - "6 transportation own vehicle \n", - "7 special_conditions no special conditions to consider \n", - "8 trip_length_days 3 days \n", - "\n", - " true_class \n", - "0 camping trip (wild camping) \n", - "1 [scuba diving, kayaking / canoeing] \n", - "2 tropical / humid \n", - "3 lightweight (but comfortable) \n", - "4 conservative \n", - "5 sleeping in a tent \n", - "6 own vehicle \n", - "7 no special conditions to consider \n", - "8 3 days \n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.500000 0.333333\n", - "0 0.333333 1.000000 0.000000\n", - "0 0.333333 0.000000 NaN\n", - "0 0.222222 0.666667 0.000000\n", - "0 0.222222 0.666667 0.666667\n", - "0 0.444444 1.000000 0.928571\n", - "0 0.444444 1.000000 0.750000\n", - "0 0.333333 0.500000 0.750000\n", - "0 0.333333 0.666667 0.666667\n", - "0 0.555556 0.500000 0.888889\n", - " superclass same_value same_value same_value same_value \\\n", - "0 activity_type False True False True \n", - "1 activities False True False False \n", - "2 climate_or_season True False True False \n", - "3 style_or_comfort False False False False \n", - "4 dress_code False False False False \n", - "5 accommodation False False False False \n", - "6 transportation False False False False \n", - "7 special_conditions True True True False \n", - "8 trip_length_days True True True True \n", - "\n", - " same_value same_value same_value same_value same_value same_value \n", - "0 False True True True True True \n", - "1 False False False False False False \n", - "2 True False False True True False \n", - "3 False False True True True False \n", - "4 False True False False False False \n", - "5 False True True False False True \n", - "6 False True True False False True \n", - "7 False False False False False True \n", - "8 True False False False False True \n", - " superclass accuracy\n", - "0 activity_type 0.7\n", - "1 activities 0.1\n", - "2 climate_or_season 0.5\n", - "3 style_or_comfort 0.3\n", - "4 dress_code 0.1\n", - "5 accommodation 0.3\n", - "6 transportation 0.3\n", - "7 special_conditions 0.4\n", - "8 trip_length_days 0.6\n", - "accuracy 0.355556\n", - "true_ident 0.650000\n", - "false_pred 0.553792\n", - "dtype: float64\n" + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 25\u001b[0m\n\u001b[1;32m 23\u001b[0m current_trip \u001b[38;5;241m=\u001b[39m trip_descriptions[i]\n\u001b[1;32m 24\u001b[0m current_type \u001b[38;5;241m=\u001b[39m trip_types[i]\n\u001b[0;32m---> 25\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpred_trip\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_trip\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcut_off\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 26\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 27\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n", + "Cell \u001b[0;32mIn[3], line 15\u001b[0m, in \u001b[0;36mpred_trip\u001b[0;34m(model_name, trip_descr, trip_type, cut_off)\u001b[0m\n\u001b[1;32m 13\u001b[0m classes \u001b[38;5;241m=\u001b[39m [result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m'\u001b[39m][i] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m indices]\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 15\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mclassifier\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrip_descr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcandidate_labels\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 16\u001b[0m classes \u001b[38;5;241m=\u001b[39m result[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 17\u001b[0m \u001b[38;5;28mprint\u001b[39m(result)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:206\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline.__call__\u001b[0;34m(self, sequences, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to understand extra arguments \u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msequences\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1294\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miterate(inputs, preprocess_params, forward_params, postprocess_params)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mframework \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpt\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ChunkPipeline):\n\u001b[0;32m-> 1294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1295\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43miter\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1296\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_iterator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1297\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43minputs\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnum_workers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbatch_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpreprocess_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforward_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostprocess_params\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:124\u001b[0m, in \u001b[0;36mPipelineIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_item()\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# We're out of items within a batch\u001b[39;00m\n\u001b[0;32m--> 124\u001b[0m item \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfer(item, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparams)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;66;03m# We now have a batch of \"inferred things\".\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:269\u001b[0m, in \u001b[0;36mPipelinePackIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m accumulator\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_last:\n\u001b[0;32m--> 269\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(processed, torch\u001b[38;5;241m.\u001b[39mTensor):\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1209\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1207\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1208\u001b[0m model_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdevice)\n\u001b[0;32m-> 1209\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mforward_params\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mdevice(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcpu\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 1211\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:229\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline._forward\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(model_forward)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 228\u001b[0m model_inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 229\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 231\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 232\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcandidate_label\u001b[39m\u001b[38;5;124m\"\u001b[39m: candidate_label,\n\u001b[1;32m 233\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msequence\u001b[39m\u001b[38;5;124m\"\u001b[39m: sequence,\n\u001b[1;32m 234\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m: inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 235\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moutputs,\n\u001b[1;32m 236\u001b[0m }\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m model_outputs\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:1763\u001b[0m, in \u001b[0;36mBartForSequenceClassification.forward\u001b[0;34m(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, inputs_embeds, decoder_inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1758\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m input_ids \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m inputs_embeds \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1759\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 1760\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPassing input embeddings is currently not supported for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1761\u001b[0m )\n\u001b[0;32m-> 1763\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1764\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1765\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1766\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_input_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_input_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1767\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_attention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_attention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1768\u001b[0m \u001b[43m \u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhead_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1769\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1770\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1771\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_outputs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_outputs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1772\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1773\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_inputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_inputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1774\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cache\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cache\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1775\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1776\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1777\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1778\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1779\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m outputs[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;66;03m# last hidden state\u001b[39;00m\n\u001b[1;32m 1781\u001b[0m eos_mask \u001b[38;5;241m=\u001b[39m input_ids\u001b[38;5;241m.\u001b[39meq(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39meos_token_id)\u001b[38;5;241m.\u001b[39mto(hidden_states\u001b[38;5;241m.\u001b[39mdevice)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:1528\u001b[0m, in \u001b[0;36mBartModel.forward\u001b[0;34m(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, past_key_values, inputs_embeds, decoder_inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1521\u001b[0m encoder_outputs \u001b[38;5;241m=\u001b[39m BaseModelOutput(\n\u001b[1;32m 1522\u001b[0m last_hidden_state\u001b[38;5;241m=\u001b[39mencoder_outputs[\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 1523\u001b[0m hidden_states\u001b[38;5;241m=\u001b[39mencoder_outputs[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(encoder_outputs) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1524\u001b[0m attentions\u001b[38;5;241m=\u001b[39mencoder_outputs[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(encoder_outputs) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m2\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1525\u001b[0m )\n\u001b[1;32m 1527\u001b[0m \u001b[38;5;66;03m# decoder outputs consists of (dec_features, past_key_value, dec_hidden, dec_attn)\u001b[39;00m\n\u001b[0;32m-> 1528\u001b[0m decoder_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecoder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1529\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_input_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1530\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_attention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1531\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_outputs\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1532\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_attention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1533\u001b[0m \u001b[43m \u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1534\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1535\u001b[0m \u001b[43m \u001b[49m\u001b[43mpast_key_values\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpast_key_values\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1536\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_inputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1537\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cache\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cache\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1538\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1539\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1540\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1541\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1543\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m return_dict:\n\u001b[1;32m 1544\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m decoder_outputs \u001b[38;5;241m+\u001b[39m encoder_outputs\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:1380\u001b[0m, in \u001b[0;36mBartDecoder.forward\u001b[0;34m(self, input_ids, attention_mask, encoder_hidden_states, encoder_attention_mask, head_mask, cross_attn_head_mask, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1367\u001b[0m layer_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_gradient_checkpointing_func(\n\u001b[1;32m 1368\u001b[0m decoder_layer\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__call__\u001b[39m,\n\u001b[1;32m 1369\u001b[0m hidden_states,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1377\u001b[0m use_cache,\n\u001b[1;32m 1378\u001b[0m )\n\u001b[1;32m 1379\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1380\u001b[0m layer_outputs \u001b[38;5;241m=\u001b[39m \u001b[43mdecoder_layer\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1381\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1382\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1383\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1384\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_attention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_attention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1385\u001b[0m \u001b[43m \u001b[49m\u001b[43mlayer_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[43m[\u001b[49m\u001b[43midx\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mis\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mnot\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1386\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_layer_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1387\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m[\u001b[49m\u001b[43midx\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mis\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mnot\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\n\u001b[1;32m 1388\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1389\u001b[0m \u001b[43m \u001b[49m\u001b[43mpast_key_value\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpast_key_value\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1390\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1391\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cache\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cache\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1392\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1393\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m layer_outputs[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1395\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m use_cache:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:666\u001b[0m, in \u001b[0;36mBartDecoderLayer.forward\u001b[0;34m(self, hidden_states, attention_mask, encoder_hidden_states, encoder_attention_mask, layer_head_mask, cross_attn_layer_head_mask, past_key_value, output_attentions, use_cache)\u001b[0m\n\u001b[1;32m 664\u001b[0m self_attn_past_key_value \u001b[38;5;241m=\u001b[39m past_key_value[:\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m past_key_value \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 665\u001b[0m \u001b[38;5;66;03m# add present self-attn cache to positions 1,2 of present_key_value tuple\u001b[39;00m\n\u001b[0;32m--> 666\u001b[0m hidden_states, self_attn_weights, present_key_value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mself_attn\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 667\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[43mpast_key_value\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mself_attn_past_key_value\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43mlayer_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlayer_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 673\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m nn\u001b[38;5;241m.\u001b[39mfunctional\u001b[38;5;241m.\u001b[39mdropout(hidden_states, p\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdropout, training\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtraining)\n\u001b[1;32m 674\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m residual \u001b[38;5;241m+\u001b[39m hidden_states\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:450\u001b[0m, in \u001b[0;36mBartSdpaAttention.forward\u001b[0;34m(self, hidden_states, key_value_states, past_key_value, attention_mask, layer_head_mask, output_attentions)\u001b[0m\n\u001b[1;32m 447\u001b[0m bsz, tgt_len, _ \u001b[38;5;241m=\u001b[39m hidden_states\u001b[38;5;241m.\u001b[39msize()\n\u001b[1;32m 449\u001b[0m \u001b[38;5;66;03m# get query proj\u001b[39;00m\n\u001b[0;32m--> 450\u001b[0m query_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mq_proj\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 451\u001b[0m \u001b[38;5;66;03m# get key, value proj\u001b[39;00m\n\u001b[1;32m 452\u001b[0m \u001b[38;5;66;03m# `past_key_value[0].shape[2] == key_value_states.shape[1]`\u001b[39;00m\n\u001b[1;32m 453\u001b[0m \u001b[38;5;66;03m# is checking that the `sequence_length` of the `past_key_value` is the same as\u001b[39;00m\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# the provided `key_value_states` to support prefix tuning\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 456\u001b[0m is_cross_attention\n\u001b[1;32m 457\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m past_key_value \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 458\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m past_key_value[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;241m==\u001b[39m key_value_states\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 459\u001b[0m ):\n\u001b[1;32m 460\u001b[0m \u001b[38;5;66;03m# reuse k,v, cross_attentions\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/linear.py:116\u001b[0m, in \u001b[0;36mLinear.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m: Tensor) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Tensor:\n\u001b[0;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mF\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinear\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mweight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbias\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ], @@ -1743,10 +373,10 @@ "model_names = [\n", " \"facebook/bart-large-mnli\",\n", " \"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\",\n", - " ##\"cross-encoder/nli-deberta-v3-base\",\n", + " \"cross-encoder/nli-deberta-v3-base\",\n", " \"cross-encoder/nli-deberta-v3-large\",\n", " \"MoritzLaurer/mDeBERTa-v3-base-mnli-xnli\",\n", - " ##\"joeddav/bart-large-mnli-yahoo-answers\",\n", + " \"joeddav/bart-large-mnli-yahoo-answers\",\n", " \"MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli\",\n", " \"MoritzLaurer/deberta-v3-large-zeroshot-v2.0\",\n", " \"valhalla/distilbart-mnli-12-1\",\n", @@ -1764,31 +394,24 @@ " current_trip = trip_descriptions[i]\n", " current_type = trip_types[i]\n", " df = pred_trip(model_name, current_trip, current_type, cut_off = 0.5)\n", - " print(df)\n", - " # accuracy, perc true classes identified and perc wrong pred classes\n", " performance = pd.concat([performance, perf_measure(df)])\n", - " print(performance)\n", - " \n", " result_list.append(df)\n", " end_time = time.time()\n", " elapsed_time = end_time - start_time\n", - " # Extract \"same_value\" column from each DataFrame\n", - " sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", + " \n", + " # Extract and combine columns identifying correct prediction (for each trip)\n", + " sv_columns = [df['same_value'] for df in result_list]\n", " sv_columns.insert(0, result_list[0]['superclass'])\n", - " # Combine into a new DataFrame (columns side-by-side)\n", " sv_df = pd.concat(sv_columns, axis=1)\n", - " print(sv_df)\n", - " # Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", + " # Compute accuracy per superclass\n", " row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", " df_row_means = pd.DataFrame({\n", " 'superclass': sv_df['superclass'],\n", " 'accuracy': row_means\n", " })\n", - " print(df_row_means)\n", " # Compute performance measures per trip (mean for each column of performance table)\n", " column_means = performance.mean()\n", - " print(column_means)\n", - " # save results\n", + " # Save results\n", " model = model_name.replace(\"/\", \"-\")\n", " model_result = {\n", " 'model': model,\n", @@ -1798,9 +421,7 @@ " 'perf_superclass': df_row_means,\n", " 'elapsed_time': elapsed_time\n", " }\n", - " # File path with folder\n", " filename = os.path.join('results', f'{model}_results.pkl')\n", - " # Save the object\n", " with open(filename, 'wb') as f:\n", " pickle.dump(model_result, f)\n", "\n", @@ -1818,8 +439,8 @@ }, { "cell_type": "code", - "execution_count": 14, - "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", + "execution_count": 6, + "id": "37849e0b-864e-4377-b06c-0ac70c3861f9", "metadata": { "scrolled": true }, @@ -1837,7 +458,7 @@ "----------------------------------------\n", "Model: joeddav-bart-large-mnli-yahoo-answers\n", "Performance Summary:\n", - "accuracy 0.344444\n", + "accuracy 0.355556\n", "true_ident 0.650000\n", "false_pred 0.553792\n", "dtype: float64\n", @@ -1851,23 +472,23 @@ "----------------------------------------\n", "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", "Performance Summary:\n", - "accuracy 0.566667\n", + "accuracy 0.611111\n", "true_ident 0.841667\n", "false_pred 0.546667\n", "dtype: float64\n", "----------------------------------------\n", "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", "Performance Summary:\n", - "accuracy 0.466667\n", + "accuracy 0.455556\n", "true_ident 0.408333\n", "false_pred 0.481250\n", "dtype: float64\n", "----------------------------------------\n", "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", "Performance Summary:\n", - "accuracy 0.455556\n", - "true_ident 0.325000\n", - "false_pred 0.500000\n", + "accuracy 0.500\n", + "true_ident 0.325\n", + "false_pred 0.500\n", "dtype: float64\n", "----------------------------------------\n", "Model: facebook-bart-large-mnli\n", @@ -1879,7 +500,7 @@ "----------------------------------------\n", "Model: valhalla-distilbart-mnli-12-1\n", "Performance Summary:\n", - "accuracy 0.522222\n", + "accuracy 0.500000\n", "true_ident 0.300000\n", "false_pred 0.533333\n", "dtype: float64\n", @@ -1890,130 +511,13 @@ "true_ident 0.841667\n", "false_pred 0.572381\n", "dtype: float64\n", - "----------------------------------------\n", - "Model: cross-encoder-nli-deberta-v3-base\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.7\n", - "1 activities 0.0\n", - "2 climate_or_season 0.4\n", - "3 style_or_comfort 0.4\n", - "4 dress_code 0.7\n", - "5 accommodation 0.6\n", - "6 transportation 0.6\n", - "7 special_conditions 0.0\n", - "8 trip_length_days 0.6\n", - "----------------------------------------\n", - "Model: joeddav-bart-large-mnli-yahoo-answers\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.7\n", - "1 activities 0.1\n", - "2 climate_or_season 0.5\n", - "3 style_or_comfort 0.3\n", - "4 dress_code 0.1\n", - "5 accommodation 0.3\n", - "6 transportation 0.3\n", - "7 special_conditions 0.3\n", - "8 trip_length_days 0.6\n", - "----------------------------------------\n", - "Model: cross-encoder-nli-deberta-v3-large\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.6\n", - "1 activities 0.1\n", - "2 climate_or_season 0.5\n", - "3 style_or_comfort 0.4\n", - "4 dress_code 0.7\n", - "5 accommodation 0.7\n", - "6 transportation 0.4\n", - "7 special_conditions 0.3\n", - "8 trip_length_days 0.6\n", - "----------------------------------------\n", - "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.8\n", - "1 activities 0.0\n", - "2 climate_or_season 0.7\n", - "3 style_or_comfort 0.4\n", - "4 dress_code 0.7\n", - "5 accommodation 0.8\n", - "6 transportation 0.9\n", - "7 special_conditions 0.2\n", - "8 trip_length_days 0.6\n", - "----------------------------------------\n", - "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.9\n", - "1 activities 0.0\n", - "2 climate_or_season 0.6\n", - "3 style_or_comfort 0.5\n", - "4 dress_code 0.6\n", - "5 accommodation 0.3\n", - "6 transportation 0.8\n", - "7 special_conditions 0.1\n", - "8 trip_length_days 0.4\n", - "----------------------------------------\n", - "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.7\n", - "1 activities 0.0\n", - "2 climate_or_season 0.5\n", - "3 style_or_comfort 0.3\n", - "4 dress_code 0.7\n", - "5 accommodation 0.5\n", - "6 transportation 0.8\n", - "7 special_conditions 0.0\n", - "8 trip_length_days 0.6\n", - "----------------------------------------\n", - "Model: facebook-bart-large-mnli\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.8\n", - "1 activities 0.0\n", - "2 climate_or_season 0.6\n", - "3 style_or_comfort 0.4\n", - "4 dress_code 0.7\n", - "5 accommodation 0.3\n", - "6 transportation 0.8\n", - "7 special_conditions 0.0\n", - "8 trip_length_days 0.6\n", - "----------------------------------------\n", - "Model: valhalla-distilbart-mnli-12-1\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.7\n", - "1 activities 0.1\n", - "2 climate_or_season 0.6\n", - "3 style_or_comfort 0.4\n", - "4 dress_code 0.7\n", - "5 accommodation 0.4\n", - "6 transportation 0.9\n", - "7 special_conditions 0.3\n", - "8 trip_length_days 0.7\n", - "----------------------------------------\n", - "Model: MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", - "Performance Summary:\n", - " superclass accuracy\n", - "0 activity_type 0.8\n", - "1 activities 0.0\n", - "2 climate_or_season 0.5\n", - "3 style_or_comfort 0.3\n", - "4 dress_code 0.8\n", - "5 accommodation 0.8\n", - "6 transportation 0.7\n", - "7 special_conditions 0.2\n", - "8 trip_length_days 0.6\n", "----------------------------------------\n" ] } ], "source": [ "# Folder where .pkl files are saved\n", - "results_dir = 'results/before'\n", + "results_dir = 'results'\n", "\n", "# Dictionary to store all loaded results\n", "all_results = {}\n", @@ -2033,13 +537,7 @@ "for model, data in all_results.items():\n", " print(f\"Model: {model}\")\n", " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", - " print(\"-\" * 40)\n", - "\n", - "# Compare performance across models\n", - "for model, data in all_results.items():\n", - " print(f\"Model: {model}\")\n", - " print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", - " print(\"-\" * 40)" + " print(\"-\" * 40)\n" ] }, { @@ -2060,7 +558,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 7, "id": "57fd150d-1cda-4be5-806b-ef380469243a", "metadata": { "scrolled": true @@ -2076,11 +574,11 @@ "\n", "cross-encoder-nli-deberta-v3-large: Index([0, 1, 2, 3, 4, 6, 7, 8, 9], dtype='int64')\n", "\n", - "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: Index([2, 5, 6, 7, 8, 9], dtype='int64')\n", + "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: Index([2, 3, 5, 6, 7, 8, 9], dtype='int64')\n", "\n", "MoritzLaurer-mDeBERTa-v3-base-mnli-xnli: RangeIndex(start=0, stop=10, step=1)\n", "\n", - "MoritzLaurer-deberta-v3-large-zeroshot-v2.0: Index([0, 1, 2, 3, 4, 5, 6, 7, 9], dtype='int64')\n", + "MoritzLaurer-deberta-v3-large-zeroshot-v2.0: Index([1, 2, 3, 5, 6, 7, 9], dtype='int64')\n", "\n", "facebook-bart-large-mnli: RangeIndex(start=0, stop=10, step=1)\n", "\n", @@ -2093,6 +591,8 @@ ], "source": [ "def get_difficult_trips(model_result, cut_off = 0.6):\n", + " \"\"\"\n", + " \"\"\"\n", " # model_result is a dict with dict_keys(['model', 'predictions', \n", " # 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", " # get performance dataframe and repair index\n", @@ -2120,9 +620,11 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 8, "id": "a2754cb7-59b9-4f1d-ab74-1bf711b3eba2", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", @@ -2141,16 +643,29 @@ "7+ days\n", "\n", "\n", + "3 . I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August. \n", + "\n", + "cultural exploration\n", + "['sightseeing', 'hiking', 'rafting']\n", + "variable weather / spring / autumn\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "rainy climate\n", + "7+ days\n", + "\n", + "\n", "7 . We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels. \n", "\n", "yoga / wellness retreat\n", - "['hut-to-hut hiking', 'yoga']\n", + "['hiking', 'yoga']\n", "cold destination / winter\n", "lightweight (but comfortable)\n", - "formal (business trip)\n", - "sleeping in a tent\n", + "casual\n", + "indoor\n", "no own vehicle\n", - "avalanche-prone terrain\n", + "snow and ice\n", "7 days\n", "\n", "\n" @@ -2185,7 +700,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 9, "id": "adb491b1-3ac3-4c32-934f-5eb6171f2ec9", "metadata": {}, "outputs": [ @@ -2199,7 +714,7 @@ "\n", "cross-encoder-nli-deberta-v3-large: ['activities', 'climate_or_season', 'style_or_comfort', 'transportation', 'special_conditions']\n", "\n", - "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: ['activities', 'style_or_comfort', 'special_conditions']\n", + "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: ['activities', 'style_or_comfort']\n", "\n", "MoritzLaurer-mDeBERTa-v3-base-mnli-xnli: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions', 'trip_length_days']\n", "\n", @@ -2207,7 +722,7 @@ "\n", "facebook-bart-large-mnli: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions']\n", "\n", - "valhalla-distilbart-mnli-12-1: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "valhalla-distilbart-mnli-12-1: ['activities', 'climate_or_season', 'style_or_comfort', 'accommodation', 'special_conditions']\n", "\n", "MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli: ['activities', 'climate_or_season', 'style_or_comfort', 'special_conditions']\n", "\n" @@ -2242,7 +757,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 10, "id": "4e51c11b-9a0a-4f9d-b20c-a6feda2d5a3b", "metadata": {}, "outputs": [ @@ -2250,7 +765,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'style_or_comfort', 'activities', 'special_conditions'}\n" + "{'style_or_comfort', 'activities'}\n" ] } ], @@ -2262,7 +777,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 11, "id": "f0e31e2c-e87d-4776-b781-991919492430", "metadata": {}, "outputs": [], @@ -2281,41 +796,149 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 10, "id": "b020f584-1468-4c84-9dac-7ca7fac6e8ca", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\n", - "\n", - "dict_keys(['model', 'predictions', 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", - "\n", - "accuracy 0.522222\n", - "true_ident 0.841667\n", - "false_pred 0.572381\n", - "dtype: float64\n", - "0.5222222222222223\n" + "[]\n", + " accuracy true_ident false_pred \\\n", + "0 0.444444 0.533333 0.712500 \n", + "1 0.355556 0.650000 0.553792 \n", + "2 0.466667 0.566667 0.541667 \n", + "3 0.611111 0.841667 0.546667 \n", + "4 0.455556 0.408333 0.481250 \n", + "5 0.500000 0.325000 0.500000 \n", + "6 0.466667 0.708333 0.400000 \n", + "7 0.500000 0.300000 0.533333 \n", + "8 0.522222 0.841667 0.572381 \n", + "\n", + " model \n", + "0 cross-encoder-nli-deberta-v3-base \n", + "1 joeddav-bart-large-mnli-yahoo-answers \n", + "2 cross-encoder-nli-deberta-v3-large \n", + "3 MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-... \n", + "4 MoritzLaurer-mDeBERTa-v3-base-mnli-xnli \n", + "5 MoritzLaurer-deberta-v3-large-zeroshot-v2.0 \n", + "6 facebook-bart-large-mnli \n", + "7 valhalla-distilbart-mnli-12-1 \n", + "8 MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli \n" ] } ], "source": [ "# Make table of 'perf_summary' for all models inlcude time elapsed\n", - "print(type(all_results))\n", - "print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"]))\n", - "print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"].keys())\n", - "print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"]))\n", - "print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"])\n", - "print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"][\"accuracy\"])\n", + "#print(type(all_results))\n", + "#print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"]))\n", + "#print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"].keys())\n", + "#print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"]))\n", + "#print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"])\n", + "#print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"][\"accuracy\"])\n", "# make empty data frame\n", + "perf_table = []\n", + "print(perf_table)\n", + "\n", "# fill in for loop with perf_summary per model\n", + "for model, result in all_results.items():\n", + " row = pd.DataFrame(result[\"perf_summary\"]).T\n", + " #print(row.shape)\n", + " row[\"model\"] = model\n", + " perf_table.append(row)\n", + "# Concatenate all into one table\n", + "df_all = pd.concat(perf_table, ignore_index=True)\n", "\n", + "print(df_all)\n", + "#print(type(df_all))\n", + " \n", "\n", "# Make ranking from that table for each category\n" ] }, + { + "cell_type": "code", + "execution_count": 25, + "id": "222a70fc-8d3c-4ebb-9954-d5c72baed9e5", + "metadata": {}, + "outputs": [], + "source": [ + "# return packing list additionally to classes\n", + "# Load packing item data\n", + "with open(\"packing_templates_self_supported_offgrid_expanded.json\", \"r\") as file:\n", + " packing_items = json.load(file)\n", + "\n", + "# function and gradio app\n", + "def classify(model_name, trip_descr, cut_off = 0.5):\n", + " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", + " ## Create and fill dataframe with class predictions\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " df.loc[i] = [key, classes]\n", + "\n", + " ## Look up and return list of items to pack based on class predictions\n", + " # make list from dataframe column\n", + " all_classes = [elem for x in df[\"pred_class\"] for elem in (x if isinstance(x, list) else [x])]\n", + " # look up packing items for each class/key\n", + " list_of_list_of_items = [packing_items.get(k, []) for k in all_classes]\n", + " # combine lists and remove doubble entries\n", + " flat_unique = []\n", + " for sublist in list_of_list_of_items:\n", + " for item in sublist:\n", + " if item not in flat_unique:\n", + " flat_unique.append(item)\n", + " # sort alphabetically to notice duplicates\n", + " sorted_list = sorted(flat_unique) \n", + " return df, sorted_list" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "0f7376bd-a50b-47cc-8055-48a6de5dfee6", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "( superclass pred_class\n", + "0 activity_type beach vacation\n", + "1 activities [going to the beach, relaxing, hiking]\n", + "2 climate_or_season warm destination / summer\n", + "3 style_or_comfort minimalist\n", + "4 dress_code casual\n", + "5 accommodation huts with half board\n", + "6 transportation no own vehicle\n", + "7 special_conditions off-grid / no electricity\n", + "8 trip_length_days 7+ days, ['1 set kleding voor elke situatie', 'EHBO-set', 'USB-hub (voor meerdere devices)', 'aantal maaltijden/snacks afgestemd op duur', 'alles-in-één zeep', 'back-up verlichting (bijv. kleine zaklamp)', 'blarenpleisters of tape', 'boek of e-reader', 'comfortabele kleding', 'compacte tandenborstel', 'contant geld voor betalingen', 'dagrugzak', 'extra kledinglaag', 'extra opladerkabels', 'hiking sokken (anti-blaren)', 'hikingstokken', 'hoed of pet', 'hoofdlamp + extra batterijen', 'jeans of comfortabele broek', 'kleine rugzak', 'kleine toilettas', 'koeltas', 'lakenzak (vaak verplicht)', 'lichte handdoek', 'lichte pyjama of slaapkleding', 'lichte schoenen', 'lichtgewicht handdoek', 'luchtige kleding', 'muziek / koptelefoon', 'navigatie (kaart, kompas of GPS)', 'navigatieapparaat met offline kaarten', 'noodcommunicatie (bijv. GPS beacon of satellietboodschapper)', 'notitieboekje + pen', 'ondergoed per dag', 'oorstopjes', 'openbaar vervoer app of ticket', 'oplaadbare batterijen en oplader', 'opvouwbaar zonnepaneel (indien langere tochten)', 'pantoffels of slippers voor binnen', 'papieren kaart en kompas', 'pet of hoed', 'powerbank (minstens 10.000 mAh)', 'regenjas of poncho', 'reserveringsbevestiging', 'rugzak', 'slippers', 'snacks / energierepen', 'snacks voor onderweg', 'sneakers', 'sokken per dag', 'strandlaken', 'strandstoel', 'strandtas', 't-shirts', 'toilettas', 'trui of hoodie', 'verpakking om elektronica droog te houden', 'wandelschoenen of trailrunners', 'waterfles', 'waterfles of waterzak', 'zaklamp of hoofdlamp', 'zitkussen of strandmat', 'zonnebrand', 'zonnebrand en zonnebril', 'zonnebrandcrème', 'zonnebril', 'zonnecrème', 'zonnehoed', 'zonnepaneel of draagbaar laadsysteem', 'zwemkleding'])\n" + ] + } + ], + "source": [ + "# Access the first trip description\n", + "first_trip = trip_descriptions[0]\n", + "tmp = classify(\"facebook/bart-large-mnli\", first_trip )\n", + "print(tmp)" + ] + }, { "cell_type": "markdown", "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", @@ -2326,16 +949,46 @@ }, { "cell_type": "code", - "execution_count": 66, - "id": "cb7fd425-d0d6-458d-97ca-2150dc55f206", + "execution_count": 28, + "id": "5bf23e10-0a93-4b2f-9508-34bb0974d24c", + "metadata": {}, + "outputs": [], + "source": [ + "# Prerequisites\n", + "from transformers import pipeline\n", + "import json\n", + "import pandas as pd\n", + "import gradio as gr\n", + "\n", + "# get candidate labels\n", + "with open(\"packing_label_structure.json\", \"r\") as file:\n", + " candidate_labels = json.load(file)\n", + "keys_list = list(candidate_labels.keys())\n", + "\n", + "# Load test data (in list of dictionaries)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Extract all trip descriptions and trip_types\n", + "# trip_descriptions = [trip['description'] for trip in packing_data]\n", + "# trip_types = [trip['trip_types'] for trip in packing_data]\n", + "\n", + "# Load packing item data\n", + "with open(\"packing_templates_self_supported_offgrid_expanded.json\", \"r\") as file:\n", + " packing_items = json.load(file)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "61ebbe99-2563-4c99-ba65-d2312c9d5844", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Running on local URL: http://127.0.0.1:7861\n", - "Running on public URL: https://aa06d5d85ffadaa92b.gradio.live\n", + "Running on local URL: http://127.0.0.1:7863\n", + "Running on public URL: https://ffd87a6918736e600d.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] @@ -2343,7 +996,7 @@ { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -2351,127 +1004,86 @@ }, "metadata": {}, "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n", - "5\n", - "6\n", - "7\n", - "8\n", - "0\n", - "1\n", - "2\n", - "3\n", - "4\n", - "5\n", - "6\n", - "7\n", - "8\n" - ] } ], "source": [ - "# use model with gradio\n", - "from transformers import pipeline\n", - "import gradio as gr\n", - "\n", - "# make a function for what I am doing\n", - "def classify(text):\n", - " df = pd.DataFrame(columns=['Superclass', 'class'])\n", + "# function and gradio app\n", + "def classify(model_name, trip_descr, cut_off = 0.5):\n", + " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", + " ## Create and fill dataframe with class predictions\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", " for i, key in enumerate(keys_list):\n", - " # Run the classification (ca 30 seconds classifying)\n", " if key == 'activities':\n", - " result = classifier(text, candidate_labels[key], multi_label=True)\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", " classes = [result['labels'][i] for i in indices]\n", " else:\n", - " result = classifier(text, candidate_labels[key])\n", + " result = classifier(trip_descr, candidate_labels[key])\n", " classes = result[\"labels\"][0]\n", - " print(i)\n", " df.loc[i] = [key, classes]\n", "\n", - " return df\n", + " ## Look up and return list of items to pack based on class predictions\n", + " # make list from dataframe column\n", + " all_classes = [elem for x in df[\"pred_class\"] for elem in (x if isinstance(x, list) else [x])]\n", + " # look up packing items for each class/key\n", + " list_of_list_of_items = [packing_items.get(k, []) for k in all_classes]\n", + " # combine lists and remove doubble entries\n", + " flat_unique = []\n", + " for sublist in list_of_list_of_items:\n", + " for item in sublist:\n", + " if item not in flat_unique:\n", + " flat_unique.append(item)\n", + " # sort alphabetically to notice duplicates\n", + " sorted_list = sorted(flat_unique) \n", + " return df, \"\\n\".join(sorted_list)\n", "\n", "demo = gr.Interface(\n", " fn=classify,\n", - " inputs=\"text\",\n", - " outputs=\"dataframe\",\n", - " title=\"Zero-Shot Classification\",\n", + " inputs=[\n", + " gr.Textbox(label=\"Model name\", value = \"facebook/bart-large-mnli\"),\n", + " gr.Textbox(label=\"Trip description\"),\n", + " gr.Number(label=\"Activity cut-off\", value = 0.5),\n", + " ],\n", + " # outputs=\"dataframe\",\n", + " outputs=[gr.Dataframe(label=\"DataFrame\"), gr.Textbox(label=\"List of words\")],\n", + " title=\"Trip classification\",\n", " description=\"Enter a text describing your trip\",\n", ")\n", "\n", "# Launch the Gradio app\n", "if __name__ == \"__main__\":\n", - " demo.launch(share=True)" - ] - }, - { - "cell_type": "markdown", - "id": "8e856a9c-a66c-4c4b-b7cf-8c52abbbc6fa", - "metadata": {}, - "source": [ - "Use model with gradio" + " demo.launch()\n" ] }, { "cell_type": "code", - "execution_count": 4, - "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", - "metadata": { - "scrolled": true - }, + "execution_count": 32, + "id": "1f5df949-a527-4b11-8e5e-23786e1cde12", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Running on local URL: http://127.0.0.1:7861\n", - "Running on public URL: https://0f70ba5369d721cf8f.gradio.live\n", - "\n", - "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" + "I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.\n" ] }, { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] } ], "source": [ - "# Define the Gradio interface\n", - "def classify(text):\n", - " return classifier(text, class_labels)\n", - "\n", - "demo = gr.Interface(\n", - " fn=classify,\n", - " inputs=\"text\",\n", - " outputs=\"json\",\n", - " title=\"Zero-Shot Classification\",\n", - " description=\"Enter a text describing your trip\",\n", - ")\n", - "\n", - "# Launch the Gradio app\n", - "if __name__ == \"__main__\":\n", - " demo.launch(share=True)" + "print(first_trip)" ] }, { "cell_type": "code", "execution_count": null, - "id": "c8da1c90-d3a3-4b08-801c-b3afa17b2633", + "id": "9d74d4e7-80f6-44d3-a5c7-b41025b7d8fc", "metadata": {}, "outputs": [], "source": [] diff --git a/app.py b/app.py index 65ade26e36daa2a02cc5ca99911b135306d2e7c9..dba0722f1aedd4abe9203b9ad1a5b5f1c90b714a 100644 --- a/app.py +++ b/app.py @@ -13,15 +13,14 @@ keys_list = list(candidate_labels.keys()) with open("test_data.json", "r") as file: packing_data = json.load(file) -# function and gradio app -model_name = "facebook/bart-large-mnli" -classifier = pipeline("zero-shot-classification", model=model_name) -cut_off = 0.5 # used to choose which activities are relevant +# Load packing item data +with open("packing_templates_self_supported_offgrid_expanded.json", "r") as file: + packing_items = json.load(file) -def classify(#model_name, - trip_descr, cut_off): - - # Create an empty DataFrame with specified columns +# function and gradio app +def classify(model_name, trip_descr, cut_off = 0.5): + classifier = pipeline("zero-shot-classification", model=model_name) + ## Create and fill dataframe with class predictions df = pd.DataFrame(columns=['superclass', 'pred_class']) for i, key in enumerate(keys_list): if key == 'activities': @@ -32,16 +31,31 @@ def classify(#model_name, result = classifier(trip_descr, candidate_labels[key]) classes = result["labels"][0] df.loc[i] = [key, classes] - return df + + ## Look up and return list of items to pack based on class predictions + # make list from dataframe column + all_classes = [elem for x in df["pred_class"] for elem in (x if isinstance(x, list) else [x])] + # look up packing items for each class/key + list_of_list_of_items = [packing_items.get(k, []) for k in all_classes] + # combine lists and remove doubble entries + flat_unique = [] + for sublist in list_of_list_of_items: + for item in sublist: + if item not in flat_unique: + flat_unique.append(item) + # sort alphabetically to notice duplicates + sorted_list = sorted(flat_unique) + return df, "\n".join(sorted_list) demo = gr.Interface( fn=classify, inputs=[ - #gr.Textbox(label="Model name", value = "facebook/bart-large-mnli"), + gr.Textbox(label="Model name", value = "facebook/bart-large-mnli"), gr.Textbox(label="Trip description"), gr.Number(label="Activity cut-off", value = 0.5), ], - outputs="dataframe", + # outputs="dataframe", + outputs=[gr.Dataframe(label="DataFrame"), gr.Textbox(label="List of words")], title="Trip classification", description="Enter a text describing your trip", ) diff --git a/blog_post/article.md b/blog_post/article.md new file mode 100644 index 0000000000000000000000000000000000000000..51ce1d4788fd44aa0e060c5dd5fbc1beb4b8cd02 --- /dev/null +++ b/blog_post/article.md @@ -0,0 +1,45 @@ +# Working with Large Language Models +## Introduction +* What are LLMs and why are they popular +* How to use the open source platform to use LLMs for own application; example of creating a packing list. + +## Why bother to adept models to your application +* Problems of LLMS: Hallucination and wrong outputs +* Controll outputs by using zero-shot-calssification + * briefly mention other types of classification +* How we do it with our packing list model + * Why not use packing items as classes + * Use superclasses to categories trip and have packing items correspond to superclasses + * Asses performance with small test data set + * mention gradio app to make it user friendly and spaces to share model + +## Implementation of packing list model +### Prerequisites before you start to code +* Hugging face account also use access token, mention api +* Use anaconda +* Install python and libraries +* create jupyter notebook +* pip install stuff + +### Predefine outputs/classes + +### Model implementation + +### Using gradio app + +### Share your model +* created space +* created github access token on huffing face and then github actions workflow +* you need to install the required dependencies in the environment where your Hugging Face Space is running. +* create requirements.txt file with necessary libraries + + +## Performance assessment +* Test data creation + +## Side notes +* Hugging face API (or mention during implementation) + +## Closing +* Summary +* Limitations diff --git a/main_model.ipynb b/main_model.ipynb index 8f217f037282ada92bc7c413aed21eb6626fcbc1..48d08426d3ca54533f36897ce80254d2dd9b86f6 100644 --- a/main_model.ipynb +++ b/main_model.ipynb @@ -5,7 +5,7 @@ "id": "e25090fa-f990-4f1a-84f3-b12159eedae8", "metadata": {}, "source": [ - "# Implement and test prediciton model" + "# Working with a Large Language Model (LLM)" ] }, { @@ -18,41 +18,32 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", "metadata": {}, "outputs": [], "source": [ - "# Prerequisites\n", - "from tabulate import tabulate\n", - "from transformers import pipeline\n", + "import math\n", "import json\n", - "import pandas as pd\n", - "import matplotlib.pyplot as plt\n", "import pickle\n", "import os\n", "import time\n", - "import math\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", "\n", - "# get candidate labels\n", + "# Get candidate labels\n", "with open(\"packing_label_structure.json\", \"r\") as file:\n", " candidate_labels = json.load(file)\n", "keys_list = list(candidate_labels.keys())\n", "\n", - "# Load test data (in list of dictionaries)\n", + "# Load test data (list of dictionaries)\n", "with open(\"test_data.json\", \"r\") as file:\n", " packing_data = json.load(file)\n", - "# Extract all trip descriptions and trip_types\n", + "# Extract trip descriptions and classification (trip_types)\n", "trip_descriptions = [trip['description'] for trip in packing_data]\n", - "trip_types = [trip['trip_types'] for trip in packing_data]\n", - "\n", - "# Access the first trip description\n", - "first_trip = trip_descriptions[0]\n", - "# Get the packing list for the secondfirst trip\n", - "first_trip_type = trip_types[0]\n", - "\n", - "# print(f\"First trip: {first_trip} \\n\")\n", - "# print(f\"Trip type: {first_trip_type}\")" + "trip_types = [trip['trip_types'] for trip in packing_data]" ] }, { @@ -229,20 +220,29 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "fac51224-9575-4b4b-8567-4ad4e759ecc9", "metadata": {}, "outputs": [], "source": [ - "# function that returns pandas data frame with predictions and true values\n", - "\n", - "cut_off = 0.5 # used to choose which activities are relevant\n", + "def pred_trip(model_name, trip_descr, trip_type, cut_off = 0.5):\n", + " \"\"\"\n", + " Classifies trip\n", + " \n", + " Parameters:\n", + " model_name: name of hugging-face model\n", + " trip_descr: text describing the trip\n", + " trip_type: true trip classification\n", + " cut_off: cut_off for choosing activities\n", "\n", - "def pred_trip(model_name, trip_descr, trip_type, cut_off):\n", + " Returns:\n", + " pd Dataframe: with class predictions and true values\n", + " \"\"\"\n", + " \n", " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", - " # Create an empty DataFrame with specified columns\n", " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", " for i, key in enumerate(keys_list):\n", + " print(i)\n", " if key == 'activities':\n", " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", @@ -250,9 +250,6 @@ " else:\n", " result = classifier(trip_descr, candidate_labels[key])\n", " classes = result[\"labels\"][0]\n", - " print(result)\n", - " print(classes)\n", - " print(i)\n", " df.loc[i] = [key, classes]\n", " df['true_class'] = trip_type\n", " return df" @@ -260,14 +257,25 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "b36ab806-2f35-4950-ac5a-7c192190cba7", "metadata": {}, "outputs": [], "source": [ - "# function for accuracy, perc true classes identified and perc wrong pred classes\n", - "\n", "def perf_measure(df):\n", + " \"\"\"\n", + " Calculates performance measures:\n", + " Accuracy of classification excluding activities superclass\n", + " Percentage of correctly identified activities (#correctly predicted/#true activities)\n", + " Percentage of wrongly identified activities (#wrongly predicted/#predicted activities)\n", + "\n", + " Parameters:\n", + " df: pd Dataframe returned from pred_trip()\n", + "\n", + " Returns:\n", + " pd Dataframe: containing performance measures\n", + " \"\"\"\n", + " \n", " df['same_value'] = df['pred_class'] == df['true_class']\n", " correct = sum(df.loc[df.index != 1, 'same_value'])\n", " total = len(df['same_value'])\n", @@ -365,10 +373,10 @@ "model_names = [\n", " \"facebook/bart-large-mnli\",\n", " \"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\",\n", - " ##\"cross-encoder/nli-deberta-v3-base\",\n", + " \"cross-encoder/nli-deberta-v3-base\",\n", " \"cross-encoder/nli-deberta-v3-large\",\n", " \"MoritzLaurer/mDeBERTa-v3-base-mnli-xnli\",\n", - " ##\"joeddav/bart-large-mnli-yahoo-answers\",\n", + " \"joeddav/bart-large-mnli-yahoo-answers\",\n", " \"MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli\",\n", " \"MoritzLaurer/deberta-v3-large-zeroshot-v2.0\",\n", " \"valhalla/distilbart-mnli-12-1\",\n", @@ -386,31 +394,24 @@ " current_trip = trip_descriptions[i]\n", " current_type = trip_types[i]\n", " df = pred_trip(model_name, current_trip, current_type, cut_off = 0.5)\n", - " print(df)\n", - " # accuracy, perc true classes identified and perc wrong pred classes\n", " performance = pd.concat([performance, perf_measure(df)])\n", - " print(performance)\n", - " \n", " result_list.append(df)\n", " end_time = time.time()\n", " elapsed_time = end_time - start_time\n", - " # Extract \"same_value\" column from each DataFrame\n", - " sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", + " \n", + " # Extract and combine columns identifying correct prediction (for each trip)\n", + " sv_columns = [df['same_value'] for df in result_list]\n", " sv_columns.insert(0, result_list[0]['superclass'])\n", - " # Combine into a new DataFrame (columns side-by-side)\n", " sv_df = pd.concat(sv_columns, axis=1)\n", - " print(sv_df)\n", - " # Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", + " # Compute accuracy per superclass\n", " row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", " df_row_means = pd.DataFrame({\n", " 'superclass': sv_df['superclass'],\n", " 'accuracy': row_means\n", " })\n", - " print(df_row_means)\n", " # Compute performance measures per trip (mean for each column of performance table)\n", " column_means = performance.mean()\n", - " print(column_means)\n", - " # save results\n", + " # Save results\n", " model = model_name.replace(\"/\", \"-\")\n", " model_result = {\n", " 'model': model,\n", @@ -420,9 +421,7 @@ " 'perf_superclass': df_row_means,\n", " 'elapsed_time': elapsed_time\n", " }\n", - " # File path with folder\n", " filename = os.path.join('results', f'{model}_results.pkl')\n", - " # Save the object\n", " with open(filename, 'wb') as f:\n", " pickle.dump(model_result, f)\n", "\n", @@ -440,116 +439,7 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Model: cross-encoder-nli-deberta-v3-base\n", - "Performance Summary:\n", - "accuracy 0.444444\n", - "true_ident 0.533333\n", - "false_pred 0.712500\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: joeddav-bart-large-mnli-yahoo-answers\n", - "Performance Summary:\n", - "accuracy 0.344444\n", - "true_ident 0.650000\n", - "false_pred 0.553792\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: cross-encoder-nli-deberta-v3-large\n", - "Performance Summary:\n", - "accuracy 0.466667\n", - "true_ident 0.566667\n", - "false_pred 0.541667\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", - "Performance Summary:\n", - "accuracy 0.566667\n", - "true_ident 0.841667\n", - "false_pred 0.546667\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", - "Performance Summary:\n", - "accuracy 0.466667\n", - "true_ident 0.408333\n", - "false_pred 0.481250\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", - "Performance Summary:\n", - "accuracy 0.455556\n", - "true_ident 0.325000\n", - "false_pred 0.500000\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: facebook-bart-large-mnli\n", - "Performance Summary:\n", - "accuracy 0.466667\n", - "true_ident 0.708333\n", - "false_pred 0.400000\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: valhalla-distilbart-mnli-12-1\n", - "Performance Summary:\n", - "accuracy 0.522222\n", - "true_ident 0.300000\n", - "false_pred 0.533333\n", - "dtype: float64\n", - "----------------------------------------\n", - "Model: MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", - "Performance Summary:\n", - "accuracy 0.522222\n", - "true_ident 0.841667\n", - "false_pred 0.572381\n", - "dtype: float64\n", - "----------------------------------------\n" - ] - } - ], - "source": [ - "# Folder where .pkl files are saved\n", - "results_dir = 'results/before'\n", - "\n", - "# Dictionary to store all loaded results\n", - "all_results = {}\n", - "\n", - "# Loop through all .pkl files in the folder\n", - "for filename in os.listdir(results_dir):\n", - " if filename.endswith('.pkl'):\n", - " model_name = filename.replace('_results.pkl', '') # Extract model name\n", - " file_path = os.path.join(results_dir, filename)\n", - " \n", - " # Load the result\n", - " with open(file_path, 'rb') as f:\n", - " result = pickle.load(f)\n", - " all_results[model_name] = result\n", - "\n", - "# Compare performance across models\n", - "for model, data in all_results.items():\n", - " print(f\"Model: {model}\")\n", - " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", - " print(\"-\" * 40)\n", - "\n", - "# Compare performance across models\n", - "#for model, data in all_results.items():\n", - "# print(f\"Model: {model}\")\n", - "# print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", - "# print(\"-\" * 40)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "37849e0b-864e-4377-b06c-0ac70c3861f9", "metadata": { "scrolled": true @@ -701,6 +591,8 @@ ], "source": [ "def get_difficult_trips(model_result, cut_off = 0.6):\n", + " \"\"\"\n", + " \"\"\"\n", " # model_result is a dict with dict_keys(['model', 'predictions', \n", " # 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", " # get performance dataframe and repair index\n", @@ -808,7 +700,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "id": "adb491b1-3ac3-4c32-934f-5eb6171f2ec9", "metadata": {}, "outputs": [ @@ -904,26 +796,27 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 10, "id": "b020f584-1468-4c84-9dac-7ca7fac6e8ca", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[]\n", - "\n", - " accuracy true_ident false_pred \\\n", - "0 0.444444 0.533333 0.7125 \n", - "1 0.355556 0.65 0.553792 \n", - "2 0.466667 0.566667 0.541667 \n", - "3 0.611111 0.841667 0.546667 \n", - "4 0.455556 0.408333 0.48125 \n", - "5 0.5 0.325 0.5 \n", - "6 0.466667 0.708333 0.4 \n", - "7 0.5 0.3 0.533333 \n", - "8 0.522222 0.841667 0.572381 \n", + " accuracy true_ident false_pred \\\n", + "0 0.444444 0.533333 0.712500 \n", + "1 0.355556 0.650000 0.553792 \n", + "2 0.466667 0.566667 0.541667 \n", + "3 0.611111 0.841667 0.546667 \n", + "4 0.455556 0.408333 0.481250 \n", + "5 0.500000 0.325000 0.500000 \n", + "6 0.466667 0.708333 0.400000 \n", + "7 0.500000 0.300000 0.533333 \n", + "8 0.522222 0.841667 0.572381 \n", "\n", " model \n", "0 cross-encoder-nli-deberta-v3-base \n", @@ -968,20 +861,82 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 25, + "id": "222a70fc-8d3c-4ebb-9954-d5c72baed9e5", + "metadata": {}, + "outputs": [], + "source": [ + "# return packing list additionally to classes\n", + "# Load packing item data\n", + "with open(\"packing_templates_self_supported_offgrid_expanded.json\", \"r\") as file:\n", + " packing_items = json.load(file)\n", + "\n", + "# function and gradio app\n", + "def classify(model_name, trip_descr, cut_off = 0.5):\n", + " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", + " ## Create and fill dataframe with class predictions\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " df.loc[i] = [key, classes]\n", + "\n", + " ## Look up and return list of items to pack based on class predictions\n", + " # make list from dataframe column\n", + " all_classes = [elem for x in df[\"pred_class\"] for elem in (x if isinstance(x, list) else [x])]\n", + " # look up packing items for each class/key\n", + " list_of_list_of_items = [packing_items.get(k, []) for k in all_classes]\n", + " # combine lists and remove doubble entries\n", + " flat_unique = []\n", + " for sublist in list_of_list_of_items:\n", + " for item in sublist:\n", + " if item not in flat_unique:\n", + " flat_unique.append(item)\n", + " # sort alphabetically to notice duplicates\n", + " sorted_list = sorted(flat_unique) \n", + " return df, sorted_list" + ] + }, + { + "cell_type": "code", + "execution_count": 26, "id": "0f7376bd-a50b-47cc-8055-48a6de5dfee6", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "\n" + "( superclass pred_class\n", + "0 activity_type beach vacation\n", + "1 activities [going to the beach, relaxing, hiking]\n", + "2 climate_or_season warm destination / summer\n", + "3 style_or_comfort minimalist\n", + "4 dress_code casual\n", + "5 accommodation huts with half board\n", + "6 transportation no own vehicle\n", + "7 special_conditions off-grid / no electricity\n", + "8 trip_length_days 7+ days, ['1 set kleding voor elke situatie', 'EHBO-set', 'USB-hub (voor meerdere devices)', 'aantal maaltijden/snacks afgestemd op duur', 'alles-in-één zeep', 'back-up verlichting (bijv. kleine zaklamp)', 'blarenpleisters of tape', 'boek of e-reader', 'comfortabele kleding', 'compacte tandenborstel', 'contant geld voor betalingen', 'dagrugzak', 'extra kledinglaag', 'extra opladerkabels', 'hiking sokken (anti-blaren)', 'hikingstokken', 'hoed of pet', 'hoofdlamp + extra batterijen', 'jeans of comfortabele broek', 'kleine rugzak', 'kleine toilettas', 'koeltas', 'lakenzak (vaak verplicht)', 'lichte handdoek', 'lichte pyjama of slaapkleding', 'lichte schoenen', 'lichtgewicht handdoek', 'luchtige kleding', 'muziek / koptelefoon', 'navigatie (kaart, kompas of GPS)', 'navigatieapparaat met offline kaarten', 'noodcommunicatie (bijv. GPS beacon of satellietboodschapper)', 'notitieboekje + pen', 'ondergoed per dag', 'oorstopjes', 'openbaar vervoer app of ticket', 'oplaadbare batterijen en oplader', 'opvouwbaar zonnepaneel (indien langere tochten)', 'pantoffels of slippers voor binnen', 'papieren kaart en kompas', 'pet of hoed', 'powerbank (minstens 10.000 mAh)', 'regenjas of poncho', 'reserveringsbevestiging', 'rugzak', 'slippers', 'snacks / energierepen', 'snacks voor onderweg', 'sneakers', 'sokken per dag', 'strandlaken', 'strandstoel', 'strandtas', 't-shirts', 'toilettas', 'trui of hoodie', 'verpakking om elektronica droog te houden', 'wandelschoenen of trailrunners', 'waterfles', 'waterfles of waterzak', 'zaklamp of hoofdlamp', 'zitkussen of strandmat', 'zonnebrand', 'zonnebrand en zonnebril', 'zonnebrandcrème', 'zonnebril', 'zonnecrème', 'zonnehoed', 'zonnepaneel of draagbaar laadsysteem', 'zwemkleding'])\n" ] } ], "source": [ - "print(type(all_results))" + "# Access the first trip description\n", + "first_trip = trip_descriptions[0]\n", + "tmp = classify(\"facebook/bart-large-mnli\", first_trip )\n", + "print(tmp)" ] }, { @@ -994,7 +949,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 28, "id": "5bf23e10-0a93-4b2f-9508-34bb0974d24c", "metadata": {}, "outputs": [], @@ -1015,12 +970,16 @@ " packing_data = json.load(file)\n", "# Extract all trip descriptions and trip_types\n", "# trip_descriptions = [trip['description'] for trip in packing_data]\n", - "# trip_types = [trip['trip_types'] for trip in packing_data]" + "# trip_types = [trip['trip_types'] for trip in packing_data]\n", + "\n", + "# Load packing item data\n", + "with open(\"packing_templates_self_supported_offgrid_expanded.json\", \"r\") as file:\n", + " packing_items = json.load(file)" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 31, "id": "61ebbe99-2563-4c99-ba65-d2312c9d5844", "metadata": {}, "outputs": [ @@ -1028,8 +987,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Running on local URL: http://127.0.0.1:7860\n", - "Running on public URL: https://91493051ab28db8a5a.gradio.live\n", + "Running on local URL: http://127.0.0.1:7863\n", + "Running on public URL: https://ffd87a6918736e600d.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] @@ -1037,7 +996,7 @@ { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -1045,22 +1004,13 @@ }, "metadata": {}, "output_type": "display_data" - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" - ] } ], "source": [ "# function and gradio app\n", - "cut_off = 0.5 # used to choose which activities are relevant\n", - "\n", - "def classify(model_name, trip_descr, cut_off):\n", + "def classify(model_name, trip_descr, cut_off = 0.5):\n", " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", - " # Create an empty DataFrame with specified columns\n", + " ## Create and fill dataframe with class predictions\n", " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", " for i, key in enumerate(keys_list):\n", " if key == 'activities':\n", @@ -1071,7 +1021,21 @@ " result = classifier(trip_descr, candidate_labels[key])\n", " classes = result[\"labels\"][0]\n", " df.loc[i] = [key, classes]\n", - " return df\n", + "\n", + " ## Look up and return list of items to pack based on class predictions\n", + " # make list from dataframe column\n", + " all_classes = [elem for x in df[\"pred_class\"] for elem in (x if isinstance(x, list) else [x])]\n", + " # look up packing items for each class/key\n", + " list_of_list_of_items = [packing_items.get(k, []) for k in all_classes]\n", + " # combine lists and remove doubble entries\n", + " flat_unique = []\n", + " for sublist in list_of_list_of_items:\n", + " for item in sublist:\n", + " if item not in flat_unique:\n", + " flat_unique.append(item)\n", + " # sort alphabetically to notice duplicates\n", + " sorted_list = sorted(flat_unique) \n", + " return df, \"\\n\".join(sorted_list)\n", "\n", "demo = gr.Interface(\n", " fn=classify,\n", @@ -1080,15 +1044,49 @@ " gr.Textbox(label=\"Trip description\"),\n", " gr.Number(label=\"Activity cut-off\", value = 0.5),\n", " ],\n", - " outputs=\"dataframe\",\n", + " # outputs=\"dataframe\",\n", + " outputs=[gr.Dataframe(label=\"DataFrame\"), gr.Textbox(label=\"List of words\")],\n", " title=\"Trip classification\",\n", " description=\"Enter a text describing your trip\",\n", ")\n", "\n", "# Launch the Gradio app\n", "if __name__ == \"__main__\":\n", - " demo.launch(share=True)\n" + " demo.launch()\n" ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "1f5df949-a527-4b11-8e5e-23786e1cde12", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + } + ], + "source": [ + "print(first_trip)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9d74d4e7-80f6-44d3-a5c7-b41025b7d8fc", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/packing_templates_self_supported_offgrid_expanded.json b/packing_templates_self_supported_offgrid_expanded.json index 00628832ac08f03085def79d5532f14526016cba..5ba7ca60cd497312ca85e5acb0c1f522ae844b47 100644 --- a/packing_templates_self_supported_offgrid_expanded.json +++ b/packing_templates_self_supported_offgrid_expanded.json @@ -616,7 +616,7 @@ "partner check voor vertrek" ], "no special conditions": [ - ] + ], "1 day": [ "ondergoed per dag", "sokken per dag", diff --git a/space/space/space/.ipynb_checkpoints/app-checkpoint.py b/space/space/space/.ipynb_checkpoints/app-checkpoint.py index 948b66b2b3571417237381958a3e5ee68345a6a8..65ade26e36daa2a02cc5ca99911b135306d2e7c9 100644 --- a/space/space/space/.ipynb_checkpoints/app-checkpoint.py +++ b/space/space/space/.ipynb_checkpoints/app-checkpoint.py @@ -1,22 +1,48 @@ +# Prerequisites from transformers import pipeline +import json +import pandas as pd import gradio as gr -# Load the model and create a pipeline for zero-shot classification -classifier = pipeline("zero-shot-classification", model="facebook/bart-base") +# get candidate labels +with open("packing_label_structure.json", "r") as file: + candidate_labels = json.load(file) +keys_list = list(candidate_labels.keys()) -# Load labels from a txt file -with open("labels.txt", "r", encoding="utf-8") as f: - class_labels = [line.strip() for line in f if line.strip()] +# Load test data (in list of dictionaries) +with open("test_data.json", "r") as file: + packing_data = json.load(file) -# Define the Gradio interface -def classify(text): - return classifier(text, class_labels) +# function and gradio app +model_name = "facebook/bart-large-mnli" +classifier = pipeline("zero-shot-classification", model=model_name) +cut_off = 0.5 # used to choose which activities are relevant + +def classify(#model_name, + trip_descr, cut_off): + + # Create an empty DataFrame with specified columns + df = pd.DataFrame(columns=['superclass', 'pred_class']) + for i, key in enumerate(keys_list): + if key == 'activities': + result = classifier(trip_descr, candidate_labels[key], multi_label=True) + indices = [i for i, score in enumerate(result['scores']) if score > cut_off] + classes = [result['labels'][i] for i in indices] + else: + result = classifier(trip_descr, candidate_labels[key]) + classes = result["labels"][0] + df.loc[i] = [key, classes] + return df demo = gr.Interface( fn=classify, - inputs="text", - outputs="json", - title="Zero-Shot Classification", + inputs=[ + #gr.Textbox(label="Model name", value = "facebook/bart-large-mnli"), + gr.Textbox(label="Trip description"), + gr.Number(label="Activity cut-off", value = 0.5), + ], + outputs="dataframe", + title="Trip classification", description="Enter a text describing your trip", ) diff --git a/space/space/space/.ipynb_checkpoints/main_model-checkpoint.ipynb b/space/space/space/.ipynb_checkpoints/main_model-checkpoint.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..0ff8258d1c9d3cb9197bed8208aadc2be0929597 --- /dev/null +++ b/space/space/space/.ipynb_checkpoints/main_model-checkpoint.ipynb @@ -0,0 +1,2501 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e25090fa-f990-4f1a-84f3-b12159eedae8", + "metadata": {}, + "source": [ + "# Implement and test prediciton model" + ] + }, + { + "cell_type": "markdown", + "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", + "metadata": {}, + "source": [ + "## Prerequisites" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", + "metadata": {}, + "outputs": [], + "source": [ + "# Prerequisites\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", + "import json\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import pickle\n", + "import os\n", + "import time\n", + "import math\n", + "\n", + "# get candidate labels\n", + "with open(\"packing_label_structure.json\", \"r\") as file:\n", + " candidate_labels = json.load(file)\n", + "keys_list = list(candidate_labels.keys())\n", + "\n", + "# Load test data (in list of dictionaries)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Extract all trip descriptions and trip_types\n", + "trip_descriptions = [trip['description'] for trip in packing_data]\n", + "trip_types = [trip['trip_types'] for trip in packing_data]\n", + "\n", + "# Access the first trip description\n", + "first_trip = trip_descriptions[0]\n", + "# Get the packing list for the secondfirst trip\n", + "first_trip_type = trip_types[0]\n", + "\n", + "# print(f\"First trip: {first_trip} \\n\")\n", + "# print(f\"Trip type: {first_trip_type}\")" + ] + }, + { + "cell_type": "markdown", + "id": "5cf4f76f-0035-44e8-93af-52eafaec686e", + "metadata": {}, + "source": [ + "**All trip descriptions**" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "89d42ca7-e871-4eda-b428-69e9bd965428", + "metadata": { + "jupyter": { + "source_hidden": true + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0 . I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands. \n", + "\n", + "beach vacation\n", + "['swimming', 'going to the beach', 'relaxing', 'hiking']\n", + "warm destination / summer\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "1 . We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train. \n", + "\n", + "city trip\n", + "['sightseeing']\n", + "variable weather / spring / autumn\n", + "luxury (including evening wear)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "3 days\n", + "\n", + "\n", + "2 . My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany. \n", + "\n", + "city trip\n", + "['relaxing']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "3 . I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August. \n", + "\n", + "cultural exploration\n", + "['sightseeing', 'hiking', 'rafting']\n", + "variable weather / spring / autumn\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "rainy climate\n", + "7+ days\n", + "\n", + "\n", + "4 . We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation. \n", + "\n", + "nature escape\n", + "['swimming', 'relaxing', 'hiking']\n", + "warm destination / summer\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "5 . I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days. \n", + "\n", + "long-distance hike / thru-hike\n", + "['going to the beach']\n", + "tropical / humid\n", + "minimalist\n", + "casual\n", + "huts with half board\n", + "own vehicle\n", + "off-grid / no electricity\n", + "6 days\n", + "\n", + "\n", + "6 . I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks. \n", + "\n", + "beach vacation\n", + "['stand-up paddleboarding (SUP)', 'surfing']\n", + "cold destination / winter\n", + "ultralight\n", + "casual\n", + "sleeping in a tent\n", + "own vehicle\n", + "off-grid / no electricity\n", + "6 days\n", + "\n", + "\n", + "7 . We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels. \n", + "\n", + "yoga / wellness retreat\n", + "['hut-to-hut hiking', 'yoga']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "formal (business trip)\n", + "sleeping in a tent\n", + "no own vehicle\n", + "avalanche-prone terrain\n", + "7 days\n", + "\n", + "\n", + "8 . I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days. \n", + "\n", + "ski tour / skitour\n", + "['ski touring', 'photography', 'swimming']\n", + "cold destination / winter\n", + "minimalist\n", + "conservative\n", + "indoor\n", + "no own vehicle\n", + "avalanche-prone terrain\n", + "5 days\n", + "\n", + "\n", + "9 . We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days. \n", + "\n", + "camping trip (wild camping)\n", + "['scuba diving', 'kayaking / canoeing']\n", + "tropical / humid\n", + "lightweight (but comfortable)\n", + "conservative\n", + "sleeping in a tent\n", + "own vehicle\n", + "no special conditions to consider\n", + "3 days\n", + "\n", + "\n" + ] + } + ], + "source": [ + "for i, item in enumerate(trip_descriptions):\n", + " print(i, \".\", item, \"\\n\")\n", + " for elem in trip_types[i]:\n", + " print(elem)\n", + " print(\"\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "0f60c54b-affc-4d9a-acf1-da70f68c5578", + "metadata": {}, + "source": [ + "**Functions**" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "fac51224-9575-4b4b-8567-4ad4e759ecc9", + "metadata": {}, + "outputs": [], + "source": [ + "# function that returns pandas data frame with predictions\n", + "\n", + "cut_off = 0.5 # used to choose which activities are relevant\n", + "\n", + "def pred_trip(model_name, trip_descr, trip_type, cut_off):\n", + " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", + " # Create an empty DataFrame with specified columns\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(result)\n", + " print(classes)\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + " df['true_class'] = trip_type\n", + " return df" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "b36ab806-2f35-4950-ac5a-7c192190cba7", + "metadata": {}, + "outputs": [], + "source": [ + "# function for accuracy, perc true classes identified and perc wrong pred classes\n", + "\n", + "def perf_measure(df):\n", + " df['same_value'] = df['pred_class'] == df['true_class']\n", + " correct = sum(df.loc[df.index != 1, 'same_value'])\n", + " total = len(df['same_value'])\n", + " accuracy = correct/total\n", + " pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + " true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + " correct = [label for label in pred_class if label in true_class]\n", + " num_correct = len(correct)\n", + " correct_perc = num_correct/len(true_class)\n", + " num_pred = len(pred_class)\n", + " if num_pred == 0:\n", + " wrong_perc = math.nan\n", + " else:\n", + " wrong_perc = (num_pred - num_correct)/num_pred\n", + " df_perf = pd.DataFrame({\n", + " 'accuracy': [accuracy],\n", + " 'true_ident': [correct_perc],\n", + " 'false_pred': [wrong_perc]\n", + " })\n", + " return(df_perf)" + ] + }, + { + "cell_type": "markdown", + "id": "c10aa57d-d7ed-45c7-bdf5-29af193c7fd5", + "metadata": {}, + "source": [ + "## Make predictions for many models and trip descriptions\n", + "\n", + "Provide a list of candidate models and apply them to the test data." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "dd7869a8-b436-40de-9ea0-28eb4b7d3248", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Using model: cross-encoder/nli-deberta-v3-base\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['micro-adventure / weekend trip', 'digital nomad trip', 'beach vacation', 'festival trip', 'city trip', 'cultural exploration', 'road trip (car/camper)', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'hut trek (winter)', 'ski tour / skitour', 'snowboard / splitboard trip', 'nature escape', 'yoga / wellness retreat', 'hut trek (summer)', 'camping trip (campground)'], 'scores': [0.9722680449485779, 0.007802918087691069, 0.0075571718625724316, 0.0022959215566515923, 0.0021305829286575317, 0.001222927705384791, 0.0009879637509584427, 0.000805296644102782, 0.0007946204277686775, 0.0007107199053280056, 0.0007009899127297103, 0.0006353880744427443, 0.0005838185315951705, 0.0005424902774393559, 0.0004807499353773892, 0.0004804217896889895]}\n", + "micro-adventure / weekend trip\n", + "0\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'sightseeing', 'relaxing', 'hiking', 'hut-to-hut hiking', 'stand-up paddleboarding (SUP)', 'photography', 'biking', 'running', 'ski touring', 'snowshoe hiking', 'yoga', 'kayaking / canoeing', 'horseback riding', 'rafting', 'paragliding', 'cross-country skiing', 'surfing', 'skiing', 'ice climbing', 'fishing', 'snorkeling', 'swimming', 'rock climbing', 'scuba diving'], 'scores': [0.4660525321960449, 0.007281942293047905, 0.003730606520548463, 0.0001860307966126129, 0.00014064949937164783, 0.00011034693307010457, 5.2949126256862655e-05, 3.828677654382773e-05, 3.396756437723525e-05, 1.5346524378401227e-05, 9.348185812996235e-06, 8.182429155567661e-06, 6.5973340497293975e-06, 6.271920938161202e-06, 5.544673058466287e-06, 5.299102667777333e-06, 4.855380211665761e-06, 4.506250661506783e-06, 3.949530764657538e-06, 3.730233856913401e-06, 3.297281637060223e-06, 3.0508665531669976e-06, 2.933618134193239e-06, 2.6379277642263332e-06, 2.2992651338427095e-06]}\n", + "[]\n", + "1\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'cold destination / winter', 'rainy climate', 'dry / desert-like', 'tropical / humid'], 'scores': [0.5463300943374634, 0.16045652329921722, 0.10073684900999069, 0.07946548610925674, 0.06506938487291336, 0.047941628843545914]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.6965053081512451, 0.11270010471343994, 0.10676420480012894, 0.08403033763170242]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.6362482309341431, 0.22082458436489105, 0.14292724430561066]}\n", + "casual\n", + "4\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['indoor', 'sleeping in a tent', 'huts with half board', 'sleeping in a car'], 'scores': [0.435793399810791, 0.20242486894130707, 0.19281964004039764, 0.16896207630634308]}\n", + "indoor\n", + "5\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9987181425094604, 0.0012818538816645741]}\n", + "no own vehicle\n", + "6\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['travel with children', 'self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'no special conditions to consider', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'pet-friendly', 'high alpine terrain'], 'scores': [0.2443356215953827, 0.20383375883102417, 0.14710737764835358, 0.1429106593132019, 0.09568475931882858, 0.09322812408208847, 0.03845797851681709, 0.03444178029894829]}\n", + "travel with children\n", + "7\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '7 days', '5 days', '3 days', '6 days', '4 days'], 'scores': [0.4730822443962097, 0.1168912723660469, 0.10058756172657013, 0.0991850346326828, 0.05424537882208824, 0.053677864372730255, 0.051554784178733826, 0.050775907933712006]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type micro-adventure / weekend trip \n", + "1 activities [] \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation no own vehicle \n", + "7 special_conditions travel with children \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 beach vacation \n", + "1 [swimming, going to the beach, relaxing, hiking] \n", + "2 warm destination / summer \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.0 NaN\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'festival trip', 'digital nomad trip', 'cultural exploration', 'ski tour / skitour', 'hut trek (summer)', 'hut trek (winter)', 'camping trip (campground)', 'long-distance hike / thru-hike', 'beach vacation', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'road trip (car/camper)', 'nature escape', 'yoga / wellness retreat'], 'scores': [0.7273069024085999, 0.16893576085567474, 0.0374605655670166, 0.013699190691113472, 0.010825436562299728, 0.009758710861206055, 0.007331428118050098, 0.004068635869771242, 0.003749603172764182, 0.003352535655722022, 0.0031235795468091965, 0.0026630775537341833, 0.0025940865743905306, 0.002538869855925441, 0.0018098815344274044, 0.0007818263256922364]}\n", + "city trip\n", + "0\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['relaxing', 'sightseeing', 'photography', 'running', 'yoga', 'hiking', 'ski touring', 'biking', 'going to the beach', 'rafting', 'horseback riding', 'swimming', 'skiing', 'hut-to-hut hiking', 'stand-up paddleboarding (SUP)', 'cross-country skiing', 'kayaking / canoeing', 'paragliding', 'surfing', 'snowshoe hiking', 'scuba diving', 'ice climbing', 'snorkeling', 'rock climbing', 'fishing'], 'scores': [0.8136454820632935, 0.7140676379203796, 0.6170756220817566, 0.05222179368138313, 0.004323678556829691, 0.00038644394953735173, 0.00017300622130278498, 0.00015315462951548398, 0.00010445844964124262, 6.36487384326756e-05, 4.631545380107127e-05, 3.839404962491244e-05, 3.114979335805401e-05, 2.5509923943900503e-05, 2.4492410375387408e-05, 2.280416083522141e-05, 2.255491381220054e-05, 2.068510184471961e-05, 1.266321760340361e-05, 1.1330040251777973e-05, 8.723225619178265e-06, 8.310731573146768e-06, 6.998459411988733e-06, 6.519879661937011e-06, 5.990766112518031e-06]}\n", + "['relaxing', 'sightseeing', 'photography']\n", + "1\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.2882528007030487, 0.2644135057926178, 0.19858866930007935, 0.09457410126924515, 0.09138277918100357, 0.06278812885284424]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'minimalist', 'ultralight'], 'scores': [0.4169069826602936, 0.4114149212837219, 0.12663574516773224, 0.04504229500889778]}\n", + "luxury (including evening wear)\n", + "3\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8982668519020081, 0.06863681226968765, 0.03309635445475578]}\n", + "casual\n", + "4\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.714741587638855, 0.23251301050186157, 0.03547109663486481, 0.017274310812354088]}\n", + "indoor\n", + "5\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9801605343818665, 0.019839433953166008]}\n", + "no own vehicle\n", + "6\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'travel with children', 'self-supported (bring your own cooking gear)', 'no special conditions to consider', 'high alpine terrain', 'off-grid / no electricity', 'snow, ice and avalanche-prone terrain', 'snow and ice'], 'scores': [0.334042489528656, 0.16580866277217865, 0.12393084913492203, 0.10801968723535538, 0.08762889355421066, 0.06602469086647034, 0.06402742117643356, 0.05051736533641815]}\n", + "pet-friendly\n", + "7\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '7+ days', '4 days', '7 days', '5 days', '6 days', '2 days', '1 day'], 'scores': [0.4001774787902832, 0.1674569994211197, 0.09989149123430252, 0.09311039745807648, 0.07716208696365356, 0.06582564115524292, 0.051743343472480774, 0.04463256150484085]}\n", + "3 days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type city trip \n", + "1 activities [relaxing, sightseeing, photography] \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort luxury (including evening wear) \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation no own vehicle \n", + "7 special_conditions pet-friendly \n", + "8 trip_length_days 3 days \n", + "\n", + " true_class \n", + "0 city trip \n", + "1 [sightseeing] \n", + "2 variable weather / spring / autumn \n", + "3 luxury (including evening wear) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 3 days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.0 NaN\n", + "0 0.666667 1.0 0.666667\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['city trip', 'ski tour / skitour', 'micro-adventure / weekend trip', 'festival trip', 'cultural exploration', 'road trip (car/camper)', 'long-distance hike / thru-hike', 'digital nomad trip', 'camping trip (campground)', 'hut trek (winter)', 'beach vacation', 'nature escape', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'hut trek (summer)', 'yoga / wellness retreat'], 'scores': [0.45239609479904175, 0.39182814955711365, 0.03087054006755352, 0.021208807826042175, 0.019435159862041473, 0.01809830032289028, 0.015263390727341175, 0.014824162237346172, 0.01339301560074091, 0.008623503148555756, 0.0034696790389716625, 0.0033059841953217983, 0.0026981434784829617, 0.0023115249350667, 0.0014284384669736028, 0.0008451264584437013]}\n", + "city trip\n", + "0\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['photography', 'running', 'paragliding', 'sightseeing', 'yoga', 'relaxing', 'stand-up paddleboarding (SUP)', 'going to the beach', 'hut-to-hut hiking', 'hiking', 'fishing', 'rock climbing', 'ski touring', 'kayaking / canoeing', 'snorkeling', 'biking', 'horseback riding', 'swimming', 'cross-country skiing', 'ice climbing', 'skiing', 'scuba diving', 'rafting', 'snowshoe hiking', 'surfing'], 'scores': [0.9982200860977173, 0.8451107144355774, 0.8157505989074707, 0.5136172771453857, 0.3555079400539398, 0.10830502957105637, 0.029663724824786186, 0.002340897684916854, 0.0021064123138785362, 0.001811002497561276, 0.001619927235879004, 0.0011951243504881859, 0.0005228804075159132, 0.0003923563053831458, 0.00026167574105784297, 0.00011586806067498401, 6.076138015487231e-05, 4.014953810838051e-05, 3.3960262953769416e-05, 3.057323192479089e-05, 2.75468519248534e-05, 2.5356062906212173e-05, 2.3491949832532555e-05, 1.6574558685533702e-05, 1.540743323857896e-05]}\n", + "['photography', 'running', 'paragliding', 'sightseeing']\n", + "1\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'rainy climate', 'warm destination / summer', 'tropical / humid'], 'scores': [0.9046850800514221, 0.06181586533784866, 0.01785154454410076, 0.007209230214357376, 0.004330475814640522, 0.0041077327914536]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['minimalist', 'luxury (including evening wear)', 'ultralight', 'lightweight (but comfortable)'], 'scores': [0.9266965389251709, 0.02874235063791275, 0.026161089539527893, 0.01839996874332428]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.695661723613739, 0.16892163455486298, 0.13541661202907562]}\n", + "casual\n", + "4\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['indoor', 'huts with half board', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.9643056392669678, 0.034512825310230255, 0.0006053661345504224, 0.0005761855863966048]}\n", + "indoor\n", + "5\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.8479765057563782, 0.15202350914478302]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['travel with children', 'pet-friendly', 'self-supported (bring your own cooking gear)', 'snow and ice', 'no special conditions to consider', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.5751603245735168, 0.08135509490966797, 0.07521982491016388, 0.06849102675914764, 0.06833382695913315, 0.06071845814585686, 0.0428948774933815, 0.0278265792876482]}\n", + "travel with children\n", + "7\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['7+ days', '7 days', '2 days', '5 days', '3 days', '4 days', '6 days', '1 day'], 'scores': [0.24407239258289337, 0.24201279878616333, 0.15072190761566162, 0.14704979956150055, 0.13021770119667053, 0.049783434718847275, 0.0354502871632576, 0.0006916742422617972]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type city trip \n", + "1 activities [photography, running, paragliding, sightseeing] \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation own vehicle \n", + "7 special_conditions travel with children \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 city trip \n", + "1 [relaxing] \n", + "2 cold destination / winter \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.0 NaN\n", + "0 0.666667 1.0 0.666667\n", + "0 0.444444 0.0 1.000000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['long-distance hike / thru-hike', 'cultural exploration', 'micro-adventure / weekend trip', 'ski tour / skitour', 'camping trip (campground)', 'festival trip', 'digital nomad trip', 'hut trek (summer)', 'camping trip (wild camping)', 'city trip', 'beach vacation', 'nature escape', 'yoga / wellness retreat', 'hut trek (winter)', 'road trip (car/camper)', 'snowboard / splitboard trip'], 'scores': [0.6391688585281372, 0.1992405354976654, 0.09796122461557388, 0.018116997554898262, 0.009553882293403149, 0.009360258467495441, 0.008848845027387142, 0.007181849330663681, 0.004239208064973354, 0.002507743425667286, 0.0009007346234284341, 0.0008697589510120451, 0.0005665600765496492, 0.0005454406491480768, 0.000539708009455353, 0.000398428674088791]}\n", + "long-distance hike / thru-hike\n", + "0\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['sightseeing', 'hiking', 'photography', 'running', 'rafting', 'relaxing', 'yoga', 'stand-up paddleboarding (SUP)', 'snorkeling', 'swimming', 'hut-to-hut hiking', 'rock climbing', 'paragliding', 'horseback riding', 'surfing', 'going to the beach', 'ski touring', 'fishing', 'kayaking / canoeing', 'skiing', 'scuba diving', 'ice climbing', 'biking', 'snowshoe hiking', 'cross-country skiing'], 'scores': [0.9999529719352722, 0.9988834857940674, 0.3719910979270935, 0.31013864278793335, 0.30444297194480896, 0.1280682533979416, 0.046863943338394165, 0.017836086452007294, 0.010855655185878277, 0.006217176094651222, 0.003480800660327077, 0.0017547928728163242, 0.0003136920277029276, 0.00019969380809925497, 0.00019650146714411676, 0.00014437627396546304, 7.375824498012662e-05, 6.8435758294072e-05, 6.381970888469368e-05, 3.951123289880343e-05, 3.331455081934109e-05, 1.7446116544306278e-05, 1.3563214452005923e-05, 1.0083023880724795e-05, 6.3861116359476e-06]}\n", + "['sightseeing', 'hiking']\n", + "1\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'rainy climate', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.37135037779808044, 0.3204072415828705, 0.21922175586223602, 0.03517947718501091, 0.02729681320488453, 0.02654428966343403]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight', 'minimalist'], 'scores': [0.31400763988494873, 0.3113711178302765, 0.19337615370750427, 0.18124504387378693]}\n", + "luxury (including evening wear)\n", + "3\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.7345985174179077, 0.21783266961574554, 0.04756878688931465]}\n", + "casual\n", + "4\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.45667150616645813, 0.31709080934524536, 0.1675349920988083, 0.05870261788368225]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.9976876974105835, 0.0023123116698116064]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['self-supported (bring your own cooking gear)', 'pet-friendly', 'travel with children', 'no special conditions to consider', 'off-grid / no electricity', 'snow and ice', 'high alpine terrain', 'snow, ice and avalanche-prone terrain'], 'scores': [0.22990663349628448, 0.19825373589992523, 0.19189415872097015, 0.12580519914627075, 0.07754165679216385, 0.07121263444423676, 0.06273777037858963, 0.04264823719859123]}\n", + "self-supported (bring your own cooking gear)\n", + "7\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['7+ days', '7 days', '3 days', '4 days', '6 days', '5 days', '2 days', '1 day'], 'scores': [0.9156420826911926, 0.04964160546660423, 0.015258747152984142, 0.008262275718152523, 0.0057467143051326275, 0.004083935171365738, 0.0007110430742613971, 0.0006536644068546593]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type long-distance hike / thru-hike \n", + "1 activities [sightseeing, hiking] \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort luxury (including evening wear) \n", + "4 dress_code casual \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions self-supported (bring your own cooking gear) \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 cultural exploration \n", + "1 [sightseeing, hiking, rafting] \n", + "2 variable weather / spring / autumn \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 rainy climate \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['micro-adventure / weekend trip', 'hut trek (summer)', 'cultural exploration', 'camping trip (campground)', 'ski tour / skitour', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'festival trip', 'nature escape', 'digital nomad trip', 'city trip', 'yoga / wellness retreat', 'road trip (car/camper)', 'beach vacation', 'snowboard / splitboard trip', 'hut trek (winter)'], 'scores': [0.399262934923172, 0.11123846471309662, 0.10382843762636185, 0.09988072514533997, 0.04976071044802666, 0.042101696133613586, 0.039874546229839325, 0.029952242970466614, 0.027864206582307816, 0.025919852778315544, 0.024940188974142075, 0.020264005288481712, 0.011593679897487164, 0.01072726957499981, 0.0018079130677506328, 0.0009830890921875834]}\n", + "micro-adventure / weekend trip\n", + "0\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['hiking', 'sightseeing', 'swimming', 'relaxing', 'photography', 'yoga', 'rock climbing', 'running', 'horseback riding', 'paragliding', 'cross-country skiing', 'ice climbing', 'biking', 'hut-to-hut hiking', 'skiing', 'stand-up paddleboarding (SUP)', 'surfing', 'rafting', 'kayaking / canoeing', 'ski touring', 'snorkeling', 'scuba diving', 'fishing', 'snowshoe hiking', 'going to the beach'], 'scores': [0.9999757409095764, 0.9999136328697205, 0.9996724724769592, 0.9950104355812073, 0.9878146648406982, 0.9702362418174744, 0.9684181213378906, 0.9652480483055115, 0.9647860527038574, 0.9470340609550476, 0.9403603672981262, 0.9337814450263977, 0.7944441437721252, 0.7841721773147583, 0.7799363732337952, 0.7348324060440063, 0.4181976914405823, 0.41387978196144104, 0.3358054459095001, 0.2870975732803345, 0.2532541751861572, 0.15205828845500946, 0.08441334962844849, 0.03719170764088631, 0.0015505956253036857]}\n", + "['hiking', 'sightseeing', 'swimming', 'relaxing', 'photography', 'yoga', 'rock climbing', 'running', 'horseback riding', 'paragliding', 'cross-country skiing', 'ice climbing', 'biking', 'hut-to-hut hiking', 'skiing', 'stand-up paddleboarding (SUP)']\n", + "1\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'tropical / humid', 'dry / desert-like', 'rainy climate', 'cold destination / winter'], 'scores': [0.8853303790092468, 0.06323658674955368, 0.0203978531062603, 0.015069224871695042, 0.013677663169801235, 0.002288248622789979]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.28714197874069214, 0.26553791761398315, 0.2564510405063629, 0.19086909294128418]}\n", + "lightweight (but comfortable)\n", + "3\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.950221836566925, 0.03379425033926964, 0.015983905643224716]}\n", + "casual\n", + "4\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['huts with half board', 'sleeping in a tent', 'indoor', 'sleeping in a car'], 'scores': [0.47244933247566223, 0.22768281400203705, 0.17343464493751526, 0.12643319368362427]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.646557092666626, 0.353442907333374]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'pet-friendly', 'travel with children', 'no special conditions to consider', 'snow and ice'], 'scores': [0.24066784977912903, 0.21955342590808868, 0.20271560549736023, 0.13701395690441132, 0.1005372628569603, 0.03759154677391052, 0.031228909268975258, 0.03069145418703556]}\n", + "self-supported (bring your own cooking gear)\n", + "7\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['7+ days', '1 day', '7 days', '2 days', '6 days', '4 days', '3 days', '5 days'], 'scores': [0.925011932849884, 0.0197151992470026, 0.013198123313486576, 0.011958166025578976, 0.008182710967957973, 0.007919016294181347, 0.007132015191018581, 0.006882876623421907]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type micro-adventure / weekend trip \n", + "1 activities [hiking, sightseeing, swimming, relaxing, phot... \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort lightweight (but comfortable) \n", + "4 dress_code casual \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions self-supported (bring your own cooking gear) \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 nature escape \n", + "1 [swimming, relaxing, hiking] \n", + "2 warm destination / summer \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n", + "0 0.444444 1.000000 0.812500\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['long-distance hike / thru-hike', 'snowboard / splitboard trip', 'road trip (car/camper)', 'micro-adventure / weekend trip', 'digital nomad trip', 'hut trek (summer)', 'cultural exploration', 'beach vacation', 'nature escape', 'ski tour / skitour', 'camping trip (wild camping)', 'festival trip', 'yoga / wellness retreat', 'hut trek (winter)', 'camping trip (campground)', 'city trip'], 'scores': [0.307785302400589, 0.21902230381965637, 0.2059311717748642, 0.0918341726064682, 0.0317988395690918, 0.022238966077566147, 0.02077283337712288, 0.016396038234233856, 0.016088521108031273, 0.015115255489945412, 0.011458033695816994, 0.011041054502129555, 0.009128374978899956, 0.008595850318670273, 0.00814863946288824, 0.004644663538783789]}\n", + "long-distance hike / thru-hike\n", + "0\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['hiking', 'going to the beach', 'sightseeing', 'hut-to-hut hiking', 'relaxing', 'photography', 'ski touring', 'running', 'stand-up paddleboarding (SUP)', 'snowshoe hiking', 'yoga', 'rock climbing', 'biking', 'rafting', 'cross-country skiing', 'skiing', 'ice climbing', 'surfing', 'horseback riding', 'fishing', 'kayaking / canoeing', 'swimming', 'paragliding', 'snorkeling', 'scuba diving'], 'scores': [0.9999420046806335, 0.9937199950218201, 0.9705187678337097, 0.807087779045105, 0.7726525664329529, 0.7345634698867798, 0.22688233852386475, 0.19742780923843384, 0.10495136678218842, 0.022291118279099464, 0.01619880646467209, 0.005674958229064941, 0.0020213245879858732, 0.0010871101403608918, 0.000742745294701308, 0.00048393983161076903, 0.0002776516485027969, 0.00026415023603476584, 0.00021324043336790055, 0.0002008231676882133, 0.00011857100616907701, 7.436196028720587e-05, 4.881532731815241e-05, 2.4528446374461055e-05, 8.641897693451028e-06]}\n", + "['hiking', 'going to the beach', 'sightseeing', 'hut-to-hut hiking', 'relaxing', 'photography']\n", + "1\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'warm destination / summer', 'rainy climate', 'tropical / humid', 'dry / desert-like'], 'scores': [0.348645955324173, 0.251813679933548, 0.18834973871707916, 0.09632129967212677, 0.07351076602935791, 0.04135853052139282]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.5279046893119812, 0.26949775218963623, 0.18797814846038818, 0.014619375579059124]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.7808143496513367, 0.1755133420228958, 0.043672334402799606]}\n", + "casual\n", + "4\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.5076353549957275, 0.33340293169021606, 0.09201522171497345, 0.06694648414850235]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.9687432050704956, 0.03125680983066559]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['self-supported (bring your own cooking gear)', 'high alpine terrain', 'pet-friendly', 'travel with children', 'snow and ice', 'no special conditions to consider', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.27305731177330017, 0.18301300704479218, 0.17119400203227997, 0.13855385780334473, 0.07743344455957413, 0.05604451894760132, 0.05048489570617676, 0.05021902546286583]}\n", + "self-supported (bring your own cooking gear)\n", + "7\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['7 days', '6 days', '7+ days', '5 days', '2 days', '3 days', '4 days', '1 day'], 'scores': [0.39104464650154114, 0.2897762060165405, 0.1694536805152893, 0.04283830150961876, 0.03119494393467903, 0.030063502490520477, 0.027407746762037277, 0.018220972269773483]}\n", + "7 days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type long-distance hike / thru-hike \n", + "1 activities [hiking, going to the beach, sightseeing, hut-... \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions self-supported (bring your own cooking gear) \n", + "8 trip_length_days 7 days \n", + "\n", + " true_class \n", + "0 long-distance hike / thru-hike \n", + "1 [going to the beach] \n", + "2 tropical / humid \n", + "3 minimalist \n", + "4 casual \n", + "5 huts with half board \n", + "6 own vehicle \n", + "7 off-grid / no electricity \n", + "8 6 days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n", + "0 0.444444 1.000000 0.812500\n", + "0 0.555556 1.000000 0.833333\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['beach vacation', 'road trip (car/camper)', 'camping trip (campground)', 'micro-adventure / weekend trip', 'camping trip (wild camping)', 'festival trip', 'long-distance hike / thru-hike', 'digital nomad trip', 'ski tour / skitour', 'city trip', 'snowboard / splitboard trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'cultural exploration'], 'scores': [0.514082670211792, 0.21859246492385864, 0.17132116854190826, 0.07659809291362762, 0.00910242274403572, 0.002291250042617321, 0.0018519052537158132, 0.0013648553285747766, 0.0011585818137973547, 0.00088925426825881, 0.0006727487780153751, 0.0005743220681324601, 0.0004519206704571843, 0.00041462210356257856, 0.0003662202216219157, 0.0002674963616300374]}\n", + "beach vacation\n", + "0\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['going to the beach', 'stand-up paddleboarding (SUP)', 'relaxing', 'sightseeing', 'kayaking / canoeing', 'rafting', 'hiking', 'ski touring', 'paragliding', 'hut-to-hut hiking', 'swimming', 'fishing', 'surfing', 'biking', 'running', 'snorkeling', 'skiing', 'yoga', 'snowshoe hiking', 'ice climbing', 'horseback riding', 'rock climbing', 'scuba diving', 'photography', 'cross-country skiing'], 'scores': [0.9951664805412292, 0.0007465911330655217, 0.00012195681483717635, 5.901218537474051e-05, 4.4055559555999935e-05, 4.248578625265509e-05, 3.655617547337897e-05, 2.936698729172349e-05, 2.435299575154204e-05, 1.663279726926703e-05, 1.5113877452677116e-05, 1.4154848940961529e-05, 1.1902168807864655e-05, 1.1185119547008071e-05, 1.0269744052493479e-05, 7.661022209504154e-06, 6.11952600593213e-06, 5.437631898530526e-06, 4.908260507363593e-06, 4.472567525226623e-06, 3.872326033160789e-06, 3.687909611471696e-06, 3.5238058444519993e-06, 3.260090352341649e-06, 3.105657697233255e-06]}\n", + "['going to the beach']\n", + "1\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'warm destination / summer', 'rainy climate', 'tropical / humid', 'dry / desert-like'], 'scores': [0.46722230315208435, 0.16364941000938416, 0.15415365993976593, 0.08851196616888046, 0.07209648191928864, 0.05436616390943527]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'ultralight'], 'scores': [0.4169754087924957, 0.26534488797187805, 0.18320927023887634, 0.13447043299674988]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.8853278160095215, 0.09371301531791687, 0.02095925435423851]}\n", + "casual\n", + "4\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['sleeping in a tent', 'indoor', 'sleeping in a car', 'huts with half board'], 'scores': [0.9975091218948364, 0.0015241053188219666, 0.000863413792103529, 0.0001033771550282836]}\n", + "sleeping in a tent\n", + "5\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.6629492044448853, 0.3370508551597595]}\n", + "no own vehicle\n", + "6\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['travel with children', 'no special conditions to consider', 'self-supported (bring your own cooking gear)', 'snow and ice', 'pet-friendly', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.30429574847221375, 0.25901490449905396, 0.10586199909448624, 0.07926543056964874, 0.0763142853975296, 0.06895460188388824, 0.06407862156629562, 0.04221438243985176]}\n", + "travel with children\n", + "7\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['7+ days', '7 days', '2 days', '3 days', '4 days', '6 days', '1 day', '5 days'], 'scores': [0.4528488516807556, 0.16225562989711761, 0.11383233964443207, 0.06288284808397293, 0.06238923966884613, 0.05307593196630478, 0.04749447479844093, 0.04522067680954933]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type beach vacation \n", + "1 activities [going to the beach] \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation sleeping in a tent \n", + "6 transportation no own vehicle \n", + "7 special_conditions travel with children \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 beach vacation \n", + "1 [stand-up paddleboarding (SUP), surfing] \n", + "2 cold destination / winter \n", + "3 ultralight \n", + "4 casual \n", + "5 sleeping in a tent \n", + "6 own vehicle \n", + "7 off-grid / no electricity \n", + "8 6 days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n", + "0 0.444444 1.000000 0.812500\n", + "0 0.555556 1.000000 0.833333\n", + "0 0.333333 0.000000 1.000000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga / wellness retreat', 'micro-adventure / weekend trip', 'ski tour / skitour', 'cultural exploration', 'city trip', 'nature escape', 'digital nomad trip', 'festival trip', 'long-distance hike / thru-hike', 'camping trip (campground)', 'hut trek (winter)', 'camping trip (wild camping)', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'hut trek (summer)'], 'scores': [0.764270544052124, 0.14882460236549377, 0.01460289116948843, 0.013516460545361042, 0.01233332883566618, 0.01110365241765976, 0.008976204320788383, 0.008688248693943024, 0.0077370391227304935, 0.0027588019147515297, 0.002010364318266511, 0.0018135884311050177, 0.0010747710475698113, 0.0009247296256944537, 0.0008900162065401673, 0.0004748118226416409]}\n", + "yoga / wellness retreat\n", + "0\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga', 'relaxing', 'sightseeing', 'hiking', 'snowshoe hiking', 'ski touring', 'photography', 'hut-to-hut hiking', 'running', 'going to the beach', 'ice climbing', 'stand-up paddleboarding (SUP)', 'skiing', 'biking', 'cross-country skiing', 'rafting', 'paragliding', 'swimming', 'rock climbing', 'horseback riding', 'snorkeling', 'kayaking / canoeing', 'surfing', 'fishing', 'scuba diving'], 'scores': [0.9673612117767334, 0.851227879524231, 0.8119550943374634, 0.6501596570014954, 0.119605652987957, 0.030798301100730896, 0.0016445431392639875, 0.00024797520018182695, 0.00019679528486449271, 0.00017994307563640177, 0.00014823905075900257, 0.00011313055438222364, 0.00010658867540769279, 2.934567237389274e-05, 2.574020800238941e-05, 2.250136276416015e-05, 2.246206895506475e-05, 1.90786668099463e-05, 1.7564769223099574e-05, 1.5156508197833318e-05, 1.5060699297464453e-05, 1.4467946130025666e-05, 1.2958912520844024e-05, 8.721424819668755e-06, 7.419628673233092e-06]}\n", + "['yoga', 'relaxing', 'sightseeing', 'hiking']\n", + "1\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'warm destination / summer', 'tropical / humid', 'rainy climate'], 'scores': [0.7285766005516052, 0.256941556930542, 0.0047937845811247826, 0.003848850727081299, 0.0029669953510165215, 0.002872203476727009]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight', 'minimalist'], 'scores': [0.5102185606956482, 0.21124626696109772, 0.143381267786026, 0.1351538896560669]}\n", + "luxury (including evening wear)\n", + "3\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8451984524726868, 0.13289128243923187, 0.021910231560468674]}\n", + "casual\n", + "4\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['indoor', 'huts with half board', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.9983111023902893, 0.0010714009404182434, 0.00041075368062593043, 0.0002067020977847278]}\n", + "indoor\n", + "5\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9871621131896973, 0.012837963178753853]}\n", + "no own vehicle\n", + "6\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['snow and ice', 'self-supported (bring your own cooking gear)', 'pet-friendly', 'travel with children', 'no special conditions to consider', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity'], 'scores': [0.43503761291503906, 0.2160661667585373, 0.11101733148097992, 0.09975709766149521, 0.04071706160902977, 0.035351455211639404, 0.034011270850896835, 0.028042016550898552]}\n", + "snow and ice\n", + "7\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['7+ days', '7 days', '5 days', '6 days', '1 day', '4 days', '3 days', '2 days'], 'scores': [0.9084722995758057, 0.027727678418159485, 0.013248518109321594, 0.012942418456077576, 0.012128633446991444, 0.011794760823249817, 0.007681164424866438, 0.006004549562931061]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type yoga / wellness retreat \n", + "1 activities [yoga, relaxing, sightseeing, hiking] \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort luxury (including evening wear) \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation no own vehicle \n", + "7 special_conditions snow and ice \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 yoga / wellness retreat \n", + "1 [hut-to-hut hiking, yoga] \n", + "2 cold destination / winter \n", + "3 lightweight (but comfortable) \n", + "4 formal (business trip) \n", + "5 sleeping in a tent \n", + "6 no own vehicle \n", + "7 avalanche-prone terrain \n", + "8 7 days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n", + "0 0.444444 1.000000 0.812500\n", + "0 0.555556 1.000000 0.833333\n", + "0 0.333333 0.000000 1.000000\n", + "0 0.222222 0.500000 0.750000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski tour / skitour', 'micro-adventure / weekend trip', 'cultural exploration', 'digital nomad trip', 'nature escape', 'city trip', 'festival trip', 'long-distance hike / thru-hike', 'hut trek (winter)', 'camping trip (campground)', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'yoga / wellness retreat', 'beach vacation', 'hut trek (summer)', 'road trip (car/camper)'], 'scores': [0.7912495136260986, 0.18457308411598206, 0.006496830843389034, 0.005906335078179836, 0.0022365122567862272, 0.0019783126190304756, 0.001958322012796998, 0.0015622376231476665, 0.0010011475533246994, 0.0008931723423302174, 0.0008437229553237557, 0.0006696251803077757, 0.0003258714859839529, 0.0001465948298573494, 8.767224062466994e-05, 7.109773287083954e-05]}\n", + "ski tour / skitour\n", + "0\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski touring', 'skiing', 'sightseeing', 'photography', 'relaxing', 'cross-country skiing', 'snowshoe hiking', 'running', 'ice climbing', 'yoga', 'hiking', 'hut-to-hut hiking', 'going to the beach', 'paragliding', 'rafting', 'rock climbing', 'biking', 'fishing', 'horseback riding', 'surfing', 'swimming', 'kayaking / canoeing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'scuba diving'], 'scores': [0.9999654293060303, 0.9944596886634827, 0.9757429957389832, 0.7401605844497681, 0.531012237071991, 0.43034660816192627, 0.05276774987578392, 0.023154079914093018, 0.014407726936042309, 0.005799490958452225, 0.0014456392964348197, 0.00032733430271036923, 0.00017197725537698716, 0.00013273980584926903, 6.611074786633253e-05, 6.148772808955982e-05, 2.5040852051461115e-05, 1.2513893125287723e-05, 1.1538132639543619e-05, 1.1156663276779e-05, 9.319897799286991e-06, 6.415570624085376e-06, 4.8607284952595364e-06, 4.313362751418026e-06, 2.94029791803041e-06]}\n", + "['ski touring', 'skiing', 'sightseeing', 'photography', 'relaxing']\n", + "1\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'rainy climate', 'warm destination / summer', 'tropical / humid', 'dry / desert-like'], 'scores': [0.995788037776947, 0.003548521315678954, 0.00025412594550289214, 0.00015224718663375825, 0.00014055441715754569, 0.00011639297736110166]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)'], 'scores': [0.687770664691925, 0.16885720193386078, 0.13132035732269287, 0.012051742523908615]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5839866399765015, 0.29318928718566895, 0.12282407283782959]}\n", + "casual\n", + "4\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['indoor', 'huts with half board', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.9995657801628113, 0.0003081962640862912, 0.00010346570343244821, 2.251639853056986e-05]}\n", + "indoor\n", + "5\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.5097633004188538, 0.49023669958114624]}\n", + "no own vehicle\n", + "6\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['snow and ice', 'travel with children', 'snow, ice and avalanche-prone terrain', 'high alpine terrain', 'off-grid / no electricity', 'no special conditions to consider', 'self-supported (bring your own cooking gear)', 'pet-friendly'], 'scores': [0.8326128721237183, 0.058215875178575516, 0.03803802654147148, 0.037274911999702454, 0.019825320690870285, 0.006256969179958105, 0.003933396656066179, 0.0038426516111940145]}\n", + "snow and ice\n", + "7\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['7+ days', '7 days', '5 days', '6 days', '2 days', '3 days', '4 days', '1 day'], 'scores': [0.8862869739532471, 0.023272352293133736, 0.018582874909043312, 0.017153384163975716, 0.015721378847956657, 0.014918344095349312, 0.013972579501569271, 0.010092118754982948]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type ski tour / skitour \n", + "1 activities [ski touring, skiing, sightseeing, photography... \n", + "2 climate_or_season cold destination / winter \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation no own vehicle \n", + "7 special_conditions snow and ice \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 ski tour / skitour \n", + "1 [ski touring, photography, swimming] \n", + "2 cold destination / winter \n", + "3 minimalist \n", + "4 conservative \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 avalanche-prone terrain \n", + "8 5 days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n", + "0 0.444444 1.000000 0.812500\n", + "0 0.555556 1.000000 0.833333\n", + "0 0.333333 0.000000 1.000000\n", + "0 0.222222 0.500000 0.750000\n", + "0 0.555556 0.666667 0.600000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['camping trip (wild camping)', 'camping trip (campground)', 'road trip (car/camper)', 'micro-adventure / weekend trip', 'beach vacation', 'cultural exploration', 'digital nomad trip', 'festival trip', 'nature escape', 'hut trek (summer)', 'ski tour / skitour', 'city trip', 'yoga / wellness retreat', 'long-distance hike / thru-hike', 'hut trek (winter)', 'snowboard / splitboard trip'], 'scores': [0.4519400894641876, 0.28106340765953064, 0.13299500942230225, 0.119535893201828, 0.006582783069461584, 0.0017220464069396257, 0.001517383847385645, 0.0014019669033586979, 0.001203698804602027, 0.0011794682359322906, 0.0002996847906615585, 0.00015913322567939758, 0.00015873221855144948, 0.00010613033373374492, 7.342447497649118e-05, 6.111798575147986e-05]}\n", + "camping trip (wild camping)\n", + "0\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['kayaking / canoeing', 'relaxing', 'swimming', 'snorkeling', 'going to the beach', 'sightseeing', 'rafting', 'running', 'hut-to-hut hiking', 'hiking', 'biking', 'photography', 'scuba diving', 'fishing', 'stand-up paddleboarding (SUP)', 'ski touring', 'surfing', 'paragliding', 'horseback riding', 'skiing', 'yoga', 'cross-country skiing', 'rock climbing', 'snowshoe hiking', 'ice climbing'], 'scores': [0.9992640614509583, 0.9951056241989136, 0.952499508857727, 0.745958149433136, 0.31057634949684143, 0.007450661156326532, 0.001950735691934824, 0.0017637719865888357, 0.00034216392668895423, 0.0001901666691992432, 0.00014842729433439672, 7.320140139199793e-05, 4.365198401501402e-05, 2.900436447816901e-05, 2.0703428162960336e-05, 1.2638719454116654e-05, 1.2075782251486089e-05, 1.2074711776222102e-05, 1.0869985089811962e-05, 8.656240424897987e-06, 7.343625838984735e-06, 5.0360499699309e-06, 3.929691501980415e-06, 3.7386994335975032e-06, 3.6782789720746223e-06]}\n", + "['kayaking / canoeing', 'relaxing', 'swimming', 'snorkeling']\n", + "1\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['tropical / humid', 'warm destination / summer', 'variable weather / spring / autumn', 'rainy climate', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.8114831447601318, 0.1454213559627533, 0.04021230712532997, 0.0011621474986895919, 0.0009152473649010062, 0.0008057011291384697]}\n", + "tropical / humid\n", + "2\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)'], 'scores': [0.9056079387664795, 0.0562594048678875, 0.03654729574918747, 0.0015853168442845345]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.9951170682907104, 0.003952663391828537, 0.0009303003898821771]}\n", + "casual\n", + "4\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['sleeping in a car', 'sleeping in a tent', 'huts with half board', 'indoor'], 'scores': [0.46298423409461975, 0.28609219193458557, 0.13673897087574005, 0.11418462544679642]}\n", + "sleeping in a car\n", + "5\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.9969540238380432, 0.003045988967642188]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['off-grid / no electricity', 'travel with children', 'self-supported (bring your own cooking gear)', 'no special conditions to consider', 'pet-friendly', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'snow and ice'], 'scores': [0.8579566478729248, 0.04456052556633949, 0.036918289959430695, 0.033982858061790466, 0.015213035978376865, 0.0060641285963356495, 0.002715851878747344, 0.00258863833732903]}\n", + "off-grid / no electricity\n", + "7\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['3 days', '4 days', '2 days', '7+ days', '5 days', '6 days', '7 days', '1 day'], 'scores': [0.9772002100944519, 0.00542174419388175, 0.004143798258155584, 0.004068906418979168, 0.0026373467408120632, 0.002349153393879533, 0.002291932003572583, 0.001886898186057806]}\n", + "3 days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type camping trip (wild camping) \n", + "1 activities [kayaking / canoeing, relaxing, swimming, snor... \n", + "2 climate_or_season tropical / humid \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation sleeping in a car \n", + "6 transportation own vehicle \n", + "7 special_conditions off-grid / no electricity \n", + "8 trip_length_days 3 days \n", + "\n", + " true_class \n", + "0 camping trip (wild camping) \n", + "1 [scuba diving, kayaking / canoeing] \n", + "2 tropical / humid \n", + "3 lightweight (but comfortable) \n", + "4 conservative \n", + "5 sleeping in a tent \n", + "6 own vehicle \n", + "7 no special conditions to consider \n", + "8 3 days \n", + " accuracy true_ident false_pred\n", + "0 0.444444 0.000000 NaN\n", + "0 0.666667 1.000000 0.666667\n", + "0 0.444444 0.000000 1.000000\n", + "0 0.333333 0.666667 0.000000\n", + "0 0.444444 1.000000 0.812500\n", + "0 0.555556 1.000000 0.833333\n", + "0 0.333333 0.000000 1.000000\n", + "0 0.222222 0.500000 0.750000\n", + "0 0.555556 0.666667 0.600000\n", + "0 0.444444 0.500000 0.750000\n", + " superclass same_value same_value same_value same_value \\\n", + "0 activity_type False True True False \n", + "1 activities False False False False \n", + "2 climate_or_season False False False True \n", + "3 style_or_comfort False True False False \n", + "4 dress_code True True True True \n", + "5 accommodation True True True False \n", + "6 transportation True True False False \n", + "7 special_conditions False False False False \n", + "8 trip_length_days True True True True \n", + "\n", + " same_value same_value same_value same_value same_value same_value \n", + "0 False True True True True True \n", + "1 False False False False False False \n", + "2 True False False False True True \n", + "3 True True False False True False \n", + "4 True True True False False False \n", + "5 False True True False True False \n", + "6 False True False True True True \n", + "7 False False False False False False \n", + "8 True False False False False True \n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.0\n", + "2 climate_or_season 0.4\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.6\n", + "6 transportation 0.6\n", + "7 special_conditions 0.0\n", + "8 trip_length_days 0.6\n", + "accuracy 0.444444\n", + "true_ident 0.533333\n", + "false_pred 0.712500\n", + "dtype: float64\n", + "\n", + "Using model: joeddav/bart-large-mnli-yahoo-answers\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['cultural exploration', 'micro-adventure / weekend trip', 'beach vacation', 'city trip', 'road trip (car/camper)', 'long-distance hike / thru-hike', 'festival trip', 'nature escape', 'digital nomad trip', 'ski tour / skitour', 'hut trek (summer)', 'camping trip (campground)', 'camping trip (wild camping)', 'hut trek (winter)', 'snowboard / splitboard trip', 'yoga / wellness retreat'], 'scores': [0.16716161370277405, 0.12716785073280334, 0.1101449728012085, 0.08154628425836563, 0.06655469536781311, 0.05304424837231636, 0.04946322366595268, 0.0479649193584919, 0.04717966169118881, 0.04617271572351456, 0.039695873856544495, 0.03630887717008591, 0.03551309555768967, 0.03350067511200905, 0.02996276691555977, 0.028618555516004562]}\n", + "cultural exploration\n", + "0\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['sightseeing', 'relaxing', 'going to the beach', 'hiking', 'kayaking / canoeing', 'rafting', 'ski touring', 'hut-to-hut hiking', 'photography', 'biking', 'skiing', 'scuba diving', 'snorkeling', 'fishing', 'surfing', 'horseback riding', 'swimming', 'rock climbing', 'paragliding', 'ice climbing', 'cross-country skiing', 'running', 'snowshoe hiking', 'stand-up paddleboarding (SUP)', 'yoga'], 'scores': [0.8850327730178833, 0.7176618576049805, 0.6749467253684998, 0.42652514576911926, 0.32720306515693665, 0.25558674335479736, 0.2530333697795868, 0.24432694911956787, 0.23511365056037903, 0.22848117351531982, 0.182534322142601, 0.17652571201324463, 0.17509806156158447, 0.1716732233762741, 0.1655716449022293, 0.16310735046863556, 0.15896931290626526, 0.1521538496017456, 0.14194028079509735, 0.1316554993391037, 0.12896256148815155, 0.12777365744113922, 0.12260609865188599, 0.1141638234257698, 0.09925767034292221]}\n", + "['sightseeing', 'relaxing', 'going to the beach']\n", + "1\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'rainy climate'], 'scores': [0.266559362411499, 0.17630772292613983, 0.16403718292713165, 0.15154631435871124, 0.13040785491466522, 0.11114154011011124]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.38021835684776306, 0.23342055082321167, 0.22524654865264893, 0.16111454367637634]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.44398602843284607, 0.2991285026073456, 0.25688546895980835]}\n", + "conservative\n", + "4\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.3143824338912964, 0.24525196850299835, 0.22517447173595428, 0.21519118547439575]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5519587993621826, 0.4480411410331726]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no special conditions to consider', 'travel with children', 'high alpine terrain', 'self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'snow and ice', 'pet-friendly', 'snow, ice and avalanche-prone terrain'], 'scores': [0.20332522690296173, 0.13691647350788116, 0.12470469623804092, 0.12075766921043396, 0.11970027536153793, 0.10545651614665985, 0.09536156803369522, 0.09377763420343399]}\n", + "no special conditions to consider\n", + "7\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '6 days', '7 days', '4 days', '5 days', '2 days', '3 days', '1 day'], 'scores': [0.18392924964427948, 0.1266929656267166, 0.12513120472431183, 0.1190633624792099, 0.11783891916275024, 0.11224181950092316, 0.11214782297611237, 0.10295464098453522]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type cultural exploration \n", + "1 activities [sightseeing, relaxing, going to the beach] \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort minimalist \n", + "4 dress_code conservative \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions no special conditions to consider \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 beach vacation \n", + "1 [swimming, going to the beach, relaxing, hiking] \n", + "2 warm destination / summer \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.5 0.333333\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'cultural exploration', 'micro-adventure / weekend trip', 'road trip (car/camper)', 'festival trip', 'ski tour / skitour', 'long-distance hike / thru-hike', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'beach vacation', 'snowboard / splitboard trip', 'hut trek (winter)', 'camping trip (campground)', 'camping trip (wild camping)', 'yoga / wellness retreat'], 'scores': [0.25980284810066223, 0.16085410118103027, 0.11896767467260361, 0.05226515233516693, 0.050702739506959915, 0.046058136969804764, 0.0418943352997303, 0.04128628969192505, 0.031528014689683914, 0.030673017725348473, 0.029140915721654892, 0.02851775847375393, 0.028151461854577065, 0.02802700735628605, 0.027383984997868538, 0.024746567010879517]}\n", + "city trip\n", + "0\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'relaxing', 'photography', 'ski touring', 'kayaking / canoeing', 'horseback riding', 'biking', 'running', 'hut-to-hut hiking', 'skiing', 'hiking', 'rafting', 'snowshoe hiking', 'cross-country skiing', 'going to the beach', 'paragliding', 'ice climbing', 'stand-up paddleboarding (SUP)', 'rock climbing', 'yoga', 'fishing', 'scuba diving', 'snorkeling', 'surfing', 'swimming'], 'scores': [0.8883329033851624, 0.3308798372745514, 0.27078673243522644, 0.2502721846103668, 0.18221960961818695, 0.17400631308555603, 0.1706402450799942, 0.16008920967578888, 0.15355552732944489, 0.15223640203475952, 0.14949491620063782, 0.14705154299736023, 0.12970532476902008, 0.12721051275730133, 0.12559349834918976, 0.11049619317054749, 0.10980241000652313, 0.10505887120962143, 0.09921692311763763, 0.09889169037342072, 0.09842774271965027, 0.08242142200469971, 0.07435522973537445, 0.06917035579681396, 0.05980757251381874]}\n", + "['sightseeing']\n", + "1\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like', 'tropical / humid', 'rainy climate'], 'scores': [0.20907093584537506, 0.19385375082492828, 0.18452785909175873, 0.14411833882331848, 0.13630695641040802, 0.13212208449840546]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.33152344822883606, 0.2675602436065674, 0.21385043859481812, 0.18706588447093964]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.4617535471916199, 0.2691788673400879, 0.26906755566596985]}\n", + "conservative\n", + "4\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.3076592981815338, 0.2513667345046997, 0.22900241613388062, 0.21197155117988586]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5231750011444092, 0.4768249988555908]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['no special conditions to consider', 'travel with children', 'self-supported (bring your own cooking gear)', 'high alpine terrain', 'off-grid / no electricity', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'pet-friendly'], 'scores': [0.18486706912517548, 0.13879624009132385, 0.12936383485794067, 0.1200103908777237, 0.11849591881036758, 0.10969463735818863, 0.1023821234703064, 0.0963897556066513]}\n", + "no special conditions to consider\n", + "7\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '7+ days', '4 days', '7 days', '5 days', '6 days', '2 days', '1 day'], 'scores': [0.26189228892326355, 0.12783558666706085, 0.12143480032682419, 0.10889916121959686, 0.1056910902261734, 0.1056862473487854, 0.0874469056725502, 0.08111389726400375]}\n", + "3 days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type city trip \n", + "1 activities [sightseeing] \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort minimalist \n", + "4 dress_code conservative \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions no special conditions to consider \n", + "8 trip_length_days 3 days \n", + "\n", + " true_class \n", + "0 city trip \n", + "1 [sightseeing] \n", + "2 variable weather / spring / autumn \n", + "3 luxury (including evening wear) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 3 days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.5 0.333333\n", + "0 0.333333 1.0 0.000000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['festival trip', 'cultural exploration', 'city trip', 'micro-adventure / weekend trip', 'hut trek (winter)', 'road trip (car/camper)', 'ski tour / skitour', 'digital nomad trip', 'hut trek (summer)', 'beach vacation', 'long-distance hike / thru-hike', 'snowboard / splitboard trip', 'camping trip (campground)', 'nature escape', 'camping trip (wild camping)', 'yoga / wellness retreat'], 'scores': [0.293078750371933, 0.16062624752521515, 0.06345170736312866, 0.06158151477575302, 0.056430768221616745, 0.04617263004183769, 0.040666013956069946, 0.03946645185351372, 0.03829963505268097, 0.03487568348646164, 0.03402161970734596, 0.02967722713947296, 0.02956923469901085, 0.027611277997493744, 0.025715729221701622, 0.01875552535057068]}\n", + "festival trip\n", + "0\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'hut-to-hut hiking', 'ski touring', 'going to the beach', 'snowshoe hiking', 'rafting', 'skiing', 'horseback riding', 'hiking', 'biking', 'cross-country skiing', 'kayaking / canoeing', 'ice climbing', 'rock climbing', 'stand-up paddleboarding (SUP)', 'paragliding', 'fishing', 'scuba diving', 'snorkeling', 'surfing', 'yoga', 'swimming'], 'scores': [0.2844759225845337, 0.14781935513019562, 0.1255393922328949, 0.061169520020484924, 0.059364836663007736, 0.05813053250312805, 0.055929142981767654, 0.05124993249773979, 0.04971772059798241, 0.04930657893419266, 0.04415588453412056, 0.039289798587560654, 0.03719090297818184, 0.036852315068244934, 0.03645915165543556, 0.032679203897714615, 0.031043078750371933, 0.02770671620965004, 0.026979653164744377, 0.024992449209094048, 0.020528962835669518, 0.017404912039637566, 0.013790704309940338, 0.012935450300574303, 0.01148306392133236]}\n", + "[]\n", + "1\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['cold destination / winter', 'warm destination / summer', 'variable weather / spring / autumn', 'tropical / humid', 'dry / desert-like', 'rainy climate'], 'scores': [0.3128221333026886, 0.21224693953990936, 0.14469023048877716, 0.12454197555780411, 0.10379233956336975, 0.10190633684396744]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight'], 'scores': [0.3766309320926666, 0.21288399398326874, 0.2106471210718155, 0.19983801245689392]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.4758940637111664, 0.35429829359054565, 0.16980759799480438]}\n", + "conservative\n", + "4\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['huts with half board', 'sleeping in a tent', 'indoor', 'sleeping in a car'], 'scores': [0.3428862690925598, 0.22737044095993042, 0.22447851300239563, 0.20526479184627533]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5038818717002869, 0.49611806869506836]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['no special conditions to consider', 'travel with children', 'snow and ice', 'self-supported (bring your own cooking gear)', 'off-grid / no electricity', 'high alpine terrain', 'snow, ice and avalanche-prone terrain', 'pet-friendly'], 'scores': [0.23147523403167725, 0.18651336431503296, 0.11385881155729294, 0.10224857926368713, 0.10020803660154343, 0.09738393872976303, 0.08595966547727585, 0.08235230296850204]}\n", + "no special conditions to consider\n", + "7\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['7+ days', '2 days', '6 days', '7 days', '4 days', '1 day', '5 days', '3 days'], 'scores': [0.1346655935049057, 0.13231344521045685, 0.12829753756523132, 0.12639833986759186, 0.12144803255796432, 0.12076283246278763, 0.11963488906621933, 0.11647934466600418]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type festival trip \n", + "1 activities [] \n", + "2 climate_or_season cold destination / winter \n", + "3 style_or_comfort minimalist \n", + "4 dress_code conservative \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions no special conditions to consider \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 city trip \n", + "1 [relaxing] \n", + "2 cold destination / winter \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.5 0.333333\n", + "0 0.333333 1.0 0.000000\n", + "0 0.333333 0.0 NaN\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['cultural exploration', 'micro-adventure / weekend trip', 'city trip', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'festival trip', 'beach vacation', 'nature escape', 'digital nomad trip', 'ski tour / skitour', 'hut trek (summer)', 'camping trip (wild camping)', 'camping trip (campground)', 'hut trek (winter)', 'snowboard / splitboard trip', 'yoga / wellness retreat'], 'scores': [0.2301025688648224, 0.09925426542758942, 0.08985505998134613, 0.06585080176591873, 0.05669157952070236, 0.05446624383330345, 0.04960283637046814, 0.04747692868113518, 0.04661855101585388, 0.04570435360074043, 0.04439116269350052, 0.03897939622402191, 0.03885677829384804, 0.03418416902422905, 0.03050987981259823, 0.027455391362309456]}\n", + "cultural exploration\n", + "0\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['sightseeing', 'hiking', 'rafting', 'kayaking / canoeing', 'hut-to-hut hiking', 'photography', 'ski touring', 'relaxing', 'going to the beach', 'rock climbing', 'horseback riding', 'snowshoe hiking', 'biking', 'fishing', 'skiing', 'ice climbing', 'cross-country skiing', 'scuba diving', 'running', 'snorkeling', 'paragliding', 'stand-up paddleboarding (SUP)', 'surfing', 'yoga', 'swimming'], 'scores': [0.9237843751907349, 0.5807417035102844, 0.36438122391700745, 0.35156574845314026, 0.31867438554763794, 0.31593140959739685, 0.251972496509552, 0.23514169454574585, 0.2322484701871872, 0.1928747147321701, 0.19096393883228302, 0.19053521752357483, 0.17830251157283783, 0.1695105880498886, 0.1686009168624878, 0.16153772175312042, 0.1443871408700943, 0.1430586725473404, 0.13869552314281464, 0.13344153761863708, 0.13196821510791779, 0.11570252478122711, 0.11023450642824173, 0.10557413846254349, 0.06943294405937195]}\n", + "['sightseeing', 'hiking']\n", + "1\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'rainy climate', 'cold destination / winter'], 'scores': [0.2094230055809021, 0.1916349083185196, 0.16284117102622986, 0.15685588121414185, 0.14797377586364746, 0.13127130270004272]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.31595101952552795, 0.24356427788734436, 0.23434904217720032, 0.20613564550876617]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['conservative', 'formal (business trip)', 'casual'], 'scores': [0.37413230538368225, 0.325387179851532, 0.30048051476478577]}\n", + "conservative\n", + "4\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['huts with half board', 'sleeping in a tent', 'sleeping in a car', 'indoor'], 'scores': [0.3308664560317993, 0.24956747889518738, 0.21383841335773468, 0.20572762191295624]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5778870582580566, 0.42211291193962097]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['no special conditions to consider', 'high alpine terrain', 'travel with children', 'self-supported (bring your own cooking gear)', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.16755643486976624, 0.16390444338321686, 0.1370989829301834, 0.12557697296142578, 0.12270595878362656, 0.11366964131593704, 0.0997702106833458, 0.06971736252307892]}\n", + "no special conditions to consider\n", + "7\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['7+ days', '3 days', '7 days', '6 days', '5 days', '4 days', '2 days', '1 day'], 'scores': [0.21186265349388123, 0.1408892422914505, 0.1314566731452942, 0.1299559772014618, 0.11523696780204773, 0.1068982481956482, 0.08361256867647171, 0.08008760213851929]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type cultural exploration \n", + "1 activities [sightseeing, hiking] \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort minimalist \n", + "4 dress_code conservative \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions no special conditions to consider \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 cultural exploration \n", + "1 [sightseeing, hiking, rafting] \n", + "2 variable weather / spring / autumn \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 rainy climate \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['micro-adventure / weekend trip', 'nature escape', 'cultural exploration', 'long-distance hike / thru-hike', 'hut trek (summer)', 'road trip (car/camper)', 'ski tour / skitour', 'beach vacation', 'camping trip (wild camping)', 'yoga / wellness retreat', 'camping trip (campground)', 'city trip', 'festival trip', 'digital nomad trip', 'snowboard / splitboard trip', 'hut trek (winter)'], 'scores': [0.1256595253944397, 0.11564762890338898, 0.0818299949169159, 0.0732298418879509, 0.06507544964551926, 0.06311747431755066, 0.06167558953166008, 0.05981043726205826, 0.05292873829603195, 0.052205272018909454, 0.0516391284763813, 0.05140812322497368, 0.04123023897409439, 0.03586934134364128, 0.03446359559893608, 0.03420962020754814]}\n", + "micro-adventure / weekend trip\n", + "0\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['sightseeing', 'relaxing', 'hiking', 'going to the beach', 'ski touring', 'kayaking / canoeing', 'swimming', 'snowshoe hiking', 'biking', 'skiing', 'hut-to-hut hiking', 'rafting', 'horseback riding', 'cross-country skiing', 'rock climbing', 'fishing', 'photography', 'snorkeling', 'ice climbing', 'scuba diving', 'running', 'paragliding', 'yoga', 'stand-up paddleboarding (SUP)', 'surfing'], 'scores': [0.9057115316390991, 0.8961816430091858, 0.8563272953033447, 0.560343325138092, 0.5547003149986267, 0.5404509902000427, 0.4798630177974701, 0.44734299182891846, 0.4323567748069763, 0.42824774980545044, 0.4198780655860901, 0.4178984761238098, 0.39238718152046204, 0.3922390639781952, 0.3457918167114258, 0.32880064845085144, 0.28747114539146423, 0.2871841490268707, 0.2843594551086426, 0.2745117247104645, 0.25936663150787354, 0.255580872297287, 0.25076478719711304, 0.2368549406528473, 0.21448370814323425]}\n", + "['sightseeing', 'relaxing', 'hiking', 'going to the beach', 'ski touring', 'kayaking / canoeing']\n", + "1\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.5326037406921387, 0.1439884454011917, 0.09808021783828735, 0.08567545562982559, 0.07123921066522598, 0.06841281056404114]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['luxury (including evening wear)', 'minimalist', 'ultralight', 'lightweight (but comfortable)'], 'scores': [0.2719852030277252, 0.25683045387268066, 0.2543821632862091, 0.2168021947145462]}\n", + "luxury (including evening wear)\n", + "3\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.367921382188797, 0.3297698199748993, 0.3023088574409485]}\n", + "conservative\n", + "4\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['huts with half board', 'sleeping in a tent', 'indoor', 'sleeping in a car'], 'scores': [0.2885679304599762, 0.2731105387210846, 0.22541317343711853, 0.21290835738182068]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5603166222572327, 0.43968331813812256]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['high alpine terrain', 'no special conditions to consider', 'snow and ice', 'travel with children', 'snow, ice and avalanche-prone terrain', 'pet-friendly', 'off-grid / no electricity', 'self-supported (bring your own cooking gear)'], 'scores': [0.17922939360141754, 0.14795276522636414, 0.14044788479804993, 0.1273242086172104, 0.12166408449411392, 0.10294044762849808, 0.09357009083032608, 0.08687112480401993]}\n", + "high alpine terrain\n", + "7\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['7+ days', '7 days', '6 days', '5 days', '1 day', '4 days', '2 days', '3 days'], 'scores': [0.43496060371398926, 0.09060744941234589, 0.08739206194877625, 0.0825117751955986, 0.08092711120843887, 0.07746576517820358, 0.07315219938755035, 0.07298304885625839]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type micro-adventure / weekend trip \n", + "1 activities [sightseeing, relaxing, hiking, going to the b... \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort luxury (including evening wear) \n", + "4 dress_code conservative \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions high alpine terrain \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 nature escape \n", + "1 [swimming, relaxing, hiking] \n", + "2 warm destination / summer \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions to consider \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n", + "0 0.222222 0.666667 0.666667\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['long-distance hike / thru-hike', 'micro-adventure / weekend trip', 'nature escape', 'camping trip (wild camping)', 'road trip (car/camper)', 'cultural exploration', 'beach vacation', 'ski tour / skitour', 'camping trip (campground)', 'snowboard / splitboard trip', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'digital nomad trip', 'festival trip', 'yoga / wellness retreat'], 'scores': [0.20863620936870575, 0.09685744345188141, 0.07517095655202866, 0.07343076914548874, 0.0706576257944107, 0.06391564011573792, 0.06255688518285751, 0.053629063069820404, 0.050872139632701874, 0.04593609273433685, 0.03691982477903366, 0.03505941480398178, 0.03402595594525337, 0.032621342688798904, 0.030087171122431755, 0.029623446986079216]}\n", + "long-distance hike / thru-hike\n", + "0\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['hiking', 'sightseeing', 'hut-to-hut hiking', 'kayaking / canoeing', 'biking', 'snowshoe hiking', 'rock climbing', 'running', 'going to the beach', 'ski touring', 'horseback riding', 'cross-country skiing', 'rafting', 'photography', 'skiing', 'relaxing', 'ice climbing', 'stand-up paddleboarding (SUP)', 'paragliding', 'fishing', 'snorkeling', 'surfing', 'scuba diving', 'swimming', 'yoga'], 'scores': [0.9707403779029846, 0.9418103694915771, 0.7376925349235535, 0.7047153115272522, 0.6968525648117065, 0.6724464893341064, 0.6657483577728271, 0.639492392539978, 0.6352409720420837, 0.622490406036377, 0.6204463243484497, 0.5850474834442139, 0.5416201949119568, 0.5212154984474182, 0.4965360760688782, 0.47773101925849915, 0.4552563726902008, 0.4388185143470764, 0.36490294337272644, 0.35453176498413086, 0.3505079746246338, 0.34379279613494873, 0.33917883038520813, 0.29816576838493347, 0.22803360223770142]}\n", + "['hiking', 'sightseeing', 'hut-to-hut hiking', 'kayaking / canoeing', 'biking', 'snowshoe hiking', 'rock climbing', 'running', 'going to the beach', 'ski touring', 'horseback riding', 'cross-country skiing', 'rafting', 'photography']\n", + "1\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['cold destination / winter', 'warm destination / summer', 'variable weather / spring / autumn', 'dry / desert-like', 'tropical / humid', 'rainy climate'], 'scores': [0.21317142248153687, 0.19148282706737518, 0.1802588552236557, 0.1510961800813675, 0.1343575417995453, 0.12963321805000305]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['ultralight', 'minimalist', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.3694746792316437, 0.2801797389984131, 0.23808696866035461, 0.11225863546133041]}\n", + "ultralight\n", + "3\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.34530097246170044, 0.3344888389110565, 0.32021021842956543]}\n", + "casual\n", + "4\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['huts with half board', 'sleeping in a tent', 'sleeping in a car', 'indoor'], 'scores': [0.41636165976524353, 0.25336143374443054, 0.19501948356628418, 0.13525746762752533]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5455801486968994, 0.454419881105423]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['high alpine terrain', 'snow, ice and avalanche-prone terrain', 'self-supported (bring your own cooking gear)', 'snow and ice', 'no special conditions to consider', 'off-grid / no electricity', 'travel with children', 'pet-friendly'], 'scores': [0.23942454159259796, 0.17255951464176178, 0.14906182885169983, 0.12937109172344208, 0.10819944739341736, 0.07577616721391678, 0.065253347158432, 0.060354046523571014]}\n", + "high alpine terrain\n", + "7\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['7+ days', '6 days', '7 days', '5 days', '4 days', '1 day', '2 days', '3 days'], 'scores': [0.22824247181415558, 0.218679741024971, 0.15772362053394318, 0.09058724343776703, 0.08163046836853027, 0.07612431794404984, 0.073652483522892, 0.07335961610078812]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type long-distance hike / thru-hike \n", + "1 activities [hiking, sightseeing, hut-to-hut hiking, kayak... \n", + "2 climate_or_season cold destination / winter \n", + "3 style_or_comfort ultralight \n", + "4 dress_code casual \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions high alpine terrain \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 long-distance hike / thru-hike \n", + "1 [going to the beach] \n", + "2 tropical / humid \n", + "3 minimalist \n", + "4 casual \n", + "5 huts with half board \n", + "6 own vehicle \n", + "7 off-grid / no electricity \n", + "8 6 days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n", + "0 0.222222 0.666667 0.666667\n", + "0 0.444444 1.000000 0.928571\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'road trip (car/camper)', 'nature escape', 'cultural exploration', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'camping trip (campground)', 'festival trip', 'ski tour / skitour', 'snowboard / splitboard trip', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'digital nomad trip', 'yoga / wellness retreat'], 'scores': [0.23744942247867584, 0.10603270679712296, 0.06524186581373215, 0.06422917544841766, 0.06201164796948433, 0.0533960796892643, 0.05292251333594322, 0.04764849692583084, 0.04592280834913254, 0.044455721974372864, 0.04425935447216034, 0.042198047041893005, 0.03631977364420891, 0.034582093358039856, 0.03345293551683426, 0.029877403751015663]}\n", + "beach vacation\n", + "0\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['going to the beach', 'stand-up paddleboarding (SUP)', 'sightseeing', 'kayaking / canoeing', 'surfing', 'swimming', 'relaxing', 'rafting', 'fishing', 'scuba diving', 'biking', 'snorkeling', 'photography', 'hiking', 'hut-to-hut hiking', 'paragliding', 'running', 'ski touring', 'rock climbing', 'horseback riding', 'skiing', 'yoga', 'cross-country skiing', 'ice climbing', 'snowshoe hiking'], 'scores': [0.9471756219863892, 0.8122013211250305, 0.8093580603599548, 0.7983085513114929, 0.7912724018096924, 0.6105694770812988, 0.5944762229919434, 0.5742869973182678, 0.47236502170562744, 0.3782857060432434, 0.33895358443260193, 0.32937514781951904, 0.3061094880104065, 0.2849915027618408, 0.2622394263744354, 0.2508765459060669, 0.24640551209449768, 0.24543659389019012, 0.22789046168327332, 0.2231861650943756, 0.2161550670862198, 0.19668278098106384, 0.19172737002372742, 0.17304891347885132, 0.1477421224117279]}\n", + "['going to the beach', 'stand-up paddleboarding (SUP)', 'sightseeing', 'kayaking / canoeing', 'surfing', 'swimming', 'relaxing', 'rafting']\n", + "1\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['warm destination / summer', 'cold destination / winter', 'variable weather / spring / autumn', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.3070872128009796, 0.1844758838415146, 0.15898537635803223, 0.13669373095035553, 0.11911879479885101, 0.09363904595375061]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['ultralight', 'minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.28144413232803345, 0.2764531075954437, 0.23644311726093292, 0.20565970242023468]}\n", + "ultralight\n", + "3\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.358445405960083, 0.33785077929496765, 0.30370378494262695]}\n", + "conservative\n", + "4\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.3697204291820526, 0.2906339168548584, 0.20863069593906403, 0.1310148984193802]}\n", + "sleeping in a tent\n", + "5\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5295110940933228, 0.47048884630203247]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['no special conditions to consider', 'snow and ice', 'travel with children', 'self-supported (bring your own cooking gear)', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity', 'high alpine terrain', 'pet-friendly'], 'scores': [0.205083966255188, 0.13198444247245789, 0.13119913637638092, 0.12617307901382446, 0.11661110073328018, 0.10581637173891068, 0.0973207950592041, 0.08581113070249557]}\n", + "no special conditions to consider\n", + "7\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['7+ days', '7 days', '6 days', '2 days', '5 days', '4 days', '3 days', '1 day'], 'scores': [0.19788584113121033, 0.1333414614200592, 0.13238824903964996, 0.12004666030406952, 0.11875136196613312, 0.10994188487529755, 0.1035337820649147, 0.08411075174808502]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type beach vacation \n", + "1 activities [going to the beach, stand-up paddleboarding (... \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort ultralight \n", + "4 dress_code conservative \n", + "5 accommodation sleeping in a tent \n", + "6 transportation own vehicle \n", + "7 special_conditions no special conditions to consider \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 beach vacation \n", + "1 [stand-up paddleboarding (SUP), surfing] \n", + "2 cold destination / winter \n", + "3 ultralight \n", + "4 casual \n", + "5 sleeping in a tent \n", + "6 own vehicle \n", + "7 off-grid / no electricity \n", + "8 6 days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n", + "0 0.222222 0.666667 0.666667\n", + "0 0.444444 1.000000 0.928571\n", + "0 0.444444 1.000000 0.750000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga / wellness retreat', 'micro-adventure / weekend trip', 'nature escape', 'long-distance hike / thru-hike', 'cultural exploration', 'ski tour / skitour', 'hut trek (winter)', 'city trip', 'beach vacation', 'road trip (car/camper)', 'hut trek (summer)', 'festival trip', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'camping trip (campground)', 'digital nomad trip'], 'scores': [0.2606178820133209, 0.08046605437994003, 0.06843063235282898, 0.059995006769895554, 0.059469204396009445, 0.05855844169855118, 0.055849116295576096, 0.047889091074466705, 0.045752931386232376, 0.04353173449635506, 0.04008011892437935, 0.038273148238658905, 0.03779057413339615, 0.03708784282207489, 0.03450765833258629, 0.03170054778456688]}\n", + "yoga / wellness retreat\n", + "0\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga', 'relaxing', 'hiking', 'ski touring', 'sightseeing', 'snowshoe hiking', 'running', 'hut-to-hut hiking', 'skiing', 'going to the beach', 'kayaking / canoeing', 'cross-country skiing', 'swimming', 'ice climbing', 'biking', 'rafting', 'rock climbing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'horseback riding', 'scuba diving', 'paragliding', 'photography', 'surfing', 'fishing'], 'scores': [0.8216512799263, 0.7652244567871094, 0.6132642030715942, 0.5138745307922363, 0.44325223565101624, 0.4208028316497803, 0.37471672892570496, 0.37093672156333923, 0.3666746914386749, 0.3648392856121063, 0.345426082611084, 0.3357292115688324, 0.3067779541015625, 0.3034307062625885, 0.2911964952945709, 0.25312700867652893, 0.24941785633563995, 0.23824645578861237, 0.2241792529821396, 0.213203564286232, 0.20734399557113647, 0.17350167036056519, 0.17043103277683258, 0.15861929953098297, 0.14433901011943817]}\n", + "['yoga', 'relaxing', 'hiking', 'ski touring']\n", + "1\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'rainy climate', 'dry / desert-like'], 'scores': [0.36021333932876587, 0.19872936606407166, 0.1792670488357544, 0.0946045070886612, 0.09094184637069702, 0.07624392211437225]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['lightweight (but comfortable)', 'ultralight', 'minimalist', 'luxury (including evening wear)'], 'scores': [0.3093704581260681, 0.2733272314071655, 0.2592032551765442, 0.15809905529022217]}\n", + "lightweight (but comfortable)\n", + "3\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.40370842814445496, 0.3690830171108246, 0.22720862925052643]}\n", + "casual\n", + "4\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['indoor', 'sleeping in a tent', 'huts with half board', 'sleeping in a car'], 'scores': [0.2969803810119629, 0.26551374793052673, 0.22557803988456726, 0.21192780137062073]}\n", + "indoor\n", + "5\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5150290727615356, 0.48497089743614197]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['snow and ice', 'no special conditions to consider', 'snow, ice and avalanche-prone terrain', 'high alpine terrain', 'self-supported (bring your own cooking gear)', 'travel with children', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.17463071644306183, 0.16196538507938385, 0.14370520412921906, 0.13748210668563843, 0.11387145519256592, 0.1002817153930664, 0.09386476129293442, 0.07419868558645248]}\n", + "snow and ice\n", + "7\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['7+ days', '7 days', '6 days', '5 days', '1 day', '4 days', '2 days', '3 days'], 'scores': [0.16799123585224152, 0.12651269137859344, 0.12625618278980255, 0.11859724670648575, 0.11564400792121887, 0.11562533676624298, 0.11541663110256195, 0.11395667493343353]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type yoga / wellness retreat \n", + "1 activities [yoga, relaxing, hiking, ski touring] \n", + "2 climate_or_season cold destination / winter \n", + "3 style_or_comfort lightweight (but comfortable) \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation own vehicle \n", + "7 special_conditions snow and ice \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 yoga / wellness retreat \n", + "1 [hut-to-hut hiking, yoga] \n", + "2 cold destination / winter \n", + "3 lightweight (but comfortable) \n", + "4 formal (business trip) \n", + "5 sleeping in a tent \n", + "6 no own vehicle \n", + "7 avalanche-prone terrain \n", + "8 7 days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n", + "0 0.222222 0.666667 0.666667\n", + "0 0.444444 1.000000 0.928571\n", + "0 0.444444 1.000000 0.750000\n", + "0 0.333333 0.500000 0.750000\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski tour / skitour', 'micro-adventure / weekend trip', 'cultural exploration', 'road trip (car/camper)', 'city trip', 'snowboard / splitboard trip', 'long-distance hike / thru-hike', 'digital nomad trip', 'hut trek (winter)', 'festival trip', 'hut trek (summer)', 'camping trip (wild camping)', 'nature escape', 'camping trip (campground)', 'beach vacation', 'yoga / wellness retreat'], 'scores': [0.1734267771244049, 0.09546443074941635, 0.08052344620227814, 0.07985977828502655, 0.06759097427129745, 0.06277172267436981, 0.054686594754457474, 0.05254476144909859, 0.0503639318048954, 0.044427838176488876, 0.043578390032052994, 0.043481748551130295, 0.04278255254030228, 0.04047577455639839, 0.038092684000730515, 0.029928630217909813]}\n", + "ski tour / skitour\n", + "0\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski touring', 'sightseeing', 'skiing', 'cross-country skiing', 'kayaking / canoeing', 'photography', 'snowshoe hiking', 'rafting', 'hiking', 'hut-to-hut hiking', 'relaxing', 'biking', 'paragliding', 'stand-up paddleboarding (SUP)', 'ice climbing', 'rock climbing', 'surfing', 'horseback riding', 'running', 'scuba diving', 'going to the beach', 'fishing', 'snorkeling', 'yoga', 'swimming'], 'scores': [0.8142338395118713, 0.7842962741851807, 0.6903234124183655, 0.6132006645202637, 0.5646158456802368, 0.5321369171142578, 0.4776653051376343, 0.47481176257133484, 0.4403829574584961, 0.4385501444339752, 0.43699926137924194, 0.424324631690979, 0.41724103689193726, 0.4036017656326294, 0.39129355549812317, 0.3776353597640991, 0.374114453792572, 0.3706415891647339, 0.3287637531757355, 0.3272634446620941, 0.31675824522972107, 0.30254125595092773, 0.30229055881500244, 0.21720251441001892, 0.20738299190998077]}\n", + "['ski touring', 'sightseeing', 'skiing', 'cross-country skiing', 'kayaking / canoeing', 'photography']\n", + "1\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'dry / desert-like', 'rainy climate'], 'scores': [0.31022897362709045, 0.20760662853717804, 0.1636965423822403, 0.11239969730377197, 0.10346854478120804, 0.10259959101676941]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.3154253363609314, 0.27500393986701965, 0.2093629390001297, 0.20020779967308044]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['formal (business trip)', 'conservative', 'casual'], 'scores': [0.42883870005607605, 0.2967377007007599, 0.27442359924316406]}\n", + "formal (business trip)\n", + "4\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.268301784992218, 0.2666485011577606, 0.23450568318367004, 0.2305440604686737]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5153052806854248, 0.4846946895122528]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['snow, ice and avalanche-prone terrain', 'high alpine terrain', 'no special conditions to consider', 'snow and ice', 'self-supported (bring your own cooking gear)', 'travel with children', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.19052204489707947, 0.15655279159545898, 0.13949212431907654, 0.13879263401031494, 0.11442805081605911, 0.10863885283470154, 0.08574623614549637, 0.06582723557949066]}\n", + "snow, ice and avalanche-prone terrain\n", + "7\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['7+ days', '7 days', '6 days', '5 days', '1 day', '4 days', '2 days', '3 days'], 'scores': [0.2278742790222168, 0.12380822747945786, 0.12119485437870026, 0.11229623854160309, 0.1085328683257103, 0.10332215577363968, 0.10219617187976837, 0.10077515244483948]}\n", + "7+ days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type ski tour / skitour \n", + "1 activities [ski touring, sightseeing, skiing, cross-count... \n", + "2 climate_or_season cold destination / winter \n", + "3 style_or_comfort minimalist \n", + "4 dress_code formal (business trip) \n", + "5 accommodation huts with half board \n", + "6 transportation own vehicle \n", + "7 special_conditions snow, ice and avalanche-prone terrain \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 ski tour / skitour \n", + "1 [ski touring, photography, swimming] \n", + "2 cold destination / winter \n", + "3 minimalist \n", + "4 conservative \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 avalanche-prone terrain \n", + "8 5 days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n", + "0 0.222222 0.666667 0.666667\n", + "0 0.444444 1.000000 0.928571\n", + "0 0.444444 1.000000 0.750000\n", + "0 0.333333 0.500000 0.750000\n", + "0 0.333333 0.666667 0.666667\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['camping trip (wild camping)', 'camping trip (campground)', 'micro-adventure / weekend trip', 'road trip (car/camper)', 'nature escape', 'beach vacation', 'long-distance hike / thru-hike', 'cultural exploration', 'festival trip', 'ski tour / skitour', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'snowboard / splitboard trip', 'digital nomad trip', 'yoga / wellness retreat'], 'scores': [0.24850936233997345, 0.14938758313655853, 0.09667350351810455, 0.08339172601699829, 0.05508505925536156, 0.051402922719717026, 0.044685814529657364, 0.03972415253520012, 0.03578963875770569, 0.03319094330072403, 0.03277123346924782, 0.029747819527983665, 0.02797492779791355, 0.027441974729299545, 0.023192668333649635, 0.021030662581324577]}\n", + "camping trip (wild camping)\n", + "0\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['kayaking / canoeing', 'sightseeing', 'going to the beach', 'snorkeling', 'relaxing', 'hiking', 'rafting', 'hut-to-hut hiking', 'fishing', 'swimming', 'surfing', 'cross-country skiing', 'horseback riding', 'stand-up paddleboarding (SUP)', 'scuba diving', 'ski touring', 'rock climbing', 'photography', 'biking', 'skiing', 'snowshoe hiking', 'ice climbing', 'running', 'paragliding', 'yoga'], 'scores': [0.88539719581604, 0.8517834544181824, 0.6639761924743652, 0.6536601781845093, 0.6192843914031982, 0.5907655358314514, 0.5902426242828369, 0.5398754477500916, 0.522949755191803, 0.40187832713127136, 0.3998588025569916, 0.36464253067970276, 0.36373376846313477, 0.3598483204841614, 0.35947346687316895, 0.3562069237232208, 0.355800062417984, 0.34865936636924744, 0.32515498995780945, 0.3181168735027313, 0.31806549429893494, 0.3143276572227478, 0.2735307514667511, 0.2715666592121124, 0.17215368151664734]}\n", + "['kayaking / canoeing', 'sightseeing', 'going to the beach', 'snorkeling', 'relaxing', 'hiking', 'rafting', 'hut-to-hut hiking', 'fishing']\n", + "1\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'cold destination / winter', 'rainy climate'], 'scores': [0.32865503430366516, 0.1498994529247284, 0.14973486959934235, 0.1377931833267212, 0.12470144778490067, 0.10921601951122284]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.3909915089607239, 0.22962640225887299, 0.21160008013248444, 0.1677819937467575]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.37736961245536804, 0.3252304494380951, 0.29739996790885925]}\n", + "casual\n", + "4\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.42764899134635925, 0.22646835446357727, 0.18703599274158478, 0.1588466912508011]}\n", + "sleeping in a tent\n", + "5\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['own vehicle', 'no own vehicle'], 'scores': [0.5207383036613464, 0.47926169633865356]}\n", + "own vehicle\n", + "6\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['no special conditions to consider', 'self-supported (bring your own cooking gear)', 'travel with children', 'high alpine terrain', 'snow and ice', 'snow, ice and avalanche-prone terrain', 'off-grid / no electricity', 'pet-friendly'], 'scores': [0.16231811046600342, 0.15695218741893768, 0.1284862905740738, 0.12074963748455048, 0.11439701169729233, 0.11109456419944763, 0.10983186215162277, 0.09617031365633011]}\n", + "no special conditions to consider\n", + "7\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['3 days', '7+ days', '2 days', '4 days', '6 days', '1 day', '7 days', '5 days'], 'scores': [0.3021169900894165, 0.10651747137308121, 0.10220468044281006, 0.10134027898311615, 0.10006321221590042, 0.09801313281059265, 0.09622228145599365, 0.09352197498083115]}\n", + "3 days\n", + "8\n", + " superclass pred_class \\\n", + "0 activity_type camping trip (wild camping) \n", + "1 activities [kayaking / canoeing, sightseeing, going to th... \n", + "2 climate_or_season warm destination / summer \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation sleeping in a tent \n", + "6 transportation own vehicle \n", + "7 special_conditions no special conditions to consider \n", + "8 trip_length_days 3 days \n", + "\n", + " true_class \n", + "0 camping trip (wild camping) \n", + "1 [scuba diving, kayaking / canoeing] \n", + "2 tropical / humid \n", + "3 lightweight (but comfortable) \n", + "4 conservative \n", + "5 sleeping in a tent \n", + "6 own vehicle \n", + "7 no special conditions to consider \n", + "8 3 days \n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.500000 0.333333\n", + "0 0.333333 1.000000 0.000000\n", + "0 0.333333 0.000000 NaN\n", + "0 0.222222 0.666667 0.000000\n", + "0 0.222222 0.666667 0.666667\n", + "0 0.444444 1.000000 0.928571\n", + "0 0.444444 1.000000 0.750000\n", + "0 0.333333 0.500000 0.750000\n", + "0 0.333333 0.666667 0.666667\n", + "0 0.555556 0.500000 0.888889\n", + " superclass same_value same_value same_value same_value \\\n", + "0 activity_type False True False True \n", + "1 activities False True False False \n", + "2 climate_or_season True False True False \n", + "3 style_or_comfort False False False False \n", + "4 dress_code False False False False \n", + "5 accommodation False False False False \n", + "6 transportation False False False False \n", + "7 special_conditions True True True False \n", + "8 trip_length_days True True True True \n", + "\n", + " same_value same_value same_value same_value same_value same_value \n", + "0 False True True True True True \n", + "1 False False False False False False \n", + "2 True False False True True False \n", + "3 False False True True True False \n", + "4 False True False False False False \n", + "5 False True True False False True \n", + "6 False True True False False True \n", + "7 False False False False False True \n", + "8 True False False False False True \n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.1\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.1\n", + "5 accommodation 0.3\n", + "6 transportation 0.3\n", + "7 special_conditions 0.4\n", + "8 trip_length_days 0.6\n", + "accuracy 0.355556\n", + "true_ident 0.650000\n", + "false_pred 0.553792\n", + "dtype: float64\n" + ] + } + ], + "source": [ + "# List of Hugging Face model names\n", + "model_names = [\n", + " \"facebook/bart-large-mnli\",\n", + " \"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\",\n", + " ##\"cross-encoder/nli-deberta-v3-base\",\n", + " \"cross-encoder/nli-deberta-v3-large\",\n", + " \"MoritzLaurer/mDeBERTa-v3-base-mnli-xnli\",\n", + " ##\"joeddav/bart-large-mnli-yahoo-answers\",\n", + " \"MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli\",\n", + " \"MoritzLaurer/deberta-v3-large-zeroshot-v2.0\",\n", + " \"valhalla/distilbart-mnli-12-1\",\n", + " #\"joeddav/xlm-roberta-large-xnli\" # keeps giving errors\n", + "]\n", + "\n", + "# Apply each model to the test data\n", + "for model_name in model_names:\n", + " print(f\"\\nUsing model: {model_name}\")\n", + " result_list = []\n", + " performance = pd.DataFrame(columns=['accuracy', 'true_ident', 'false_pred'])\n", + " \n", + " start_time = time.time()\n", + " for i in range(len(trip_descriptions)):\n", + " current_trip = trip_descriptions[i]\n", + " current_type = trip_types[i]\n", + " df = pred_trip(model_name, current_trip, current_type, cut_off = 0.5)\n", + " print(df)\n", + " # accuracy, perc true classes identified and perc wrong pred classes\n", + " performance = pd.concat([performance, perf_measure(df)])\n", + " print(performance)\n", + " \n", + " result_list.append(df)\n", + " end_time = time.time()\n", + " elapsed_time = end_time - start_time\n", + " # Extract \"same_value\" column from each DataFrame\n", + " sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", + " sv_columns.insert(0, result_list[0]['superclass'])\n", + " # Combine into a new DataFrame (columns side-by-side)\n", + " sv_df = pd.concat(sv_columns, axis=1)\n", + " print(sv_df)\n", + " # Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", + " row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", + " df_row_means = pd.DataFrame({\n", + " 'superclass': sv_df['superclass'],\n", + " 'accuracy': row_means\n", + " })\n", + " print(df_row_means)\n", + " # Compute performance measures per trip (mean for each column of performance table)\n", + " column_means = performance.mean()\n", + " print(column_means)\n", + " # save results\n", + " model = model_name.replace(\"/\", \"-\")\n", + " model_result = {\n", + " 'model': model,\n", + " 'predictions': result_list,\n", + " 'performance': performance,\n", + " 'perf_summary': column_means,\n", + " 'perf_superclass': df_row_means,\n", + " 'elapsed_time': elapsed_time\n", + " }\n", + " # File path with folder\n", + " filename = os.path.join('results', f'{model}_results.pkl')\n", + " # Save the object\n", + " with open(filename, 'wb') as f:\n", + " pickle.dump(model_result, f)\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "e1cbb54e-abe6-49b6-957e-0683196f3199", + "metadata": {}, + "source": [ + "## Load and compare results" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: cross-encoder-nli-deberta-v3-base\n", + "Performance Summary:\n", + "accuracy 0.444444\n", + "true_ident 0.533333\n", + "false_pred 0.712500\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: joeddav-bart-large-mnli-yahoo-answers\n", + "Performance Summary:\n", + "accuracy 0.344444\n", + "true_ident 0.650000\n", + "false_pred 0.553792\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: cross-encoder-nli-deberta-v3-large\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.566667\n", + "false_pred 0.541667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", + "Performance Summary:\n", + "accuracy 0.566667\n", + "true_ident 0.841667\n", + "false_pred 0.546667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.408333\n", + "false_pred 0.481250\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", + "Performance Summary:\n", + "accuracy 0.455556\n", + "true_ident 0.325000\n", + "false_pred 0.500000\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: facebook-bart-large-mnli\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.708333\n", + "false_pred 0.400000\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: valhalla-distilbart-mnli-12-1\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.300000\n", + "false_pred 0.533333\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.841667\n", + "false_pred 0.572381\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: cross-encoder-nli-deberta-v3-base\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.0\n", + "2 climate_or_season 0.4\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.6\n", + "6 transportation 0.6\n", + "7 special_conditions 0.0\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", + "Model: joeddav-bart-large-mnli-yahoo-answers\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.1\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.1\n", + "5 accommodation 0.3\n", + "6 transportation 0.3\n", + "7 special_conditions 0.3\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", + "Model: cross-encoder-nli-deberta-v3-large\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.6\n", + "1 activities 0.1\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.7\n", + "6 transportation 0.4\n", + "7 special_conditions 0.3\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.7\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.8\n", + "6 transportation 0.9\n", + "7 special_conditions 0.2\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", + "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.9\n", + "1 activities 0.0\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.5\n", + "4 dress_code 0.6\n", + "5 accommodation 0.3\n", + "6 transportation 0.8\n", + "7 special_conditions 0.1\n", + "8 trip_length_days 0.4\n", + "----------------------------------------\n", + "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.0\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.7\n", + "5 accommodation 0.5\n", + "6 transportation 0.8\n", + "7 special_conditions 0.0\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", + "Model: facebook-bart-large-mnli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.3\n", + "6 transportation 0.8\n", + "7 special_conditions 0.0\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", + "Model: valhalla-distilbart-mnli-12-1\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.1\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.4\n", + "6 transportation 0.9\n", + "7 special_conditions 0.3\n", + "8 trip_length_days 0.7\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.8\n", + "5 accommodation 0.8\n", + "6 transportation 0.7\n", + "7 special_conditions 0.2\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n" + ] + } + ], + "source": [ + "# Folder where .pkl files are saved\n", + "results_dir = 'results/before'\n", + "\n", + "# Dictionary to store all loaded results\n", + "all_results = {}\n", + "\n", + "# Loop through all .pkl files in the folder\n", + "for filename in os.listdir(results_dir):\n", + " if filename.endswith('.pkl'):\n", + " model_name = filename.replace('_results.pkl', '') # Extract model name\n", + " file_path = os.path.join(results_dir, filename)\n", + " \n", + " # Load the result\n", + " with open(file_path, 'rb') as f:\n", + " result = pickle.load(f)\n", + " all_results[model_name] = result\n", + "\n", + "# Compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", + " print(\"-\" * 40)\n", + "\n", + "# Compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", + " print(\"-\" * 40)" + ] + }, + { + "cell_type": "markdown", + "id": "2f65e5b1-bc32-42c2-bbe9-9e3a6ffc72c1", + "metadata": {}, + "source": [ + "**Identify trips that are difficult to predict**" + ] + }, + { + "cell_type": "markdown", + "id": "040055c9-5df4-49b0-921a-5bf98ff01a69", + "metadata": {}, + "source": [ + "Per model" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "57fd150d-1cda-4be5-806b-ef380469243a", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cross-encoder-nli-deberta-v3-base: Index([0, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64')\n", + "\n", + "joeddav-bart-large-mnli-yahoo-answers: RangeIndex(start=0, stop=10, step=1)\n", + "\n", + "cross-encoder-nli-deberta-v3-large: Index([0, 1, 2, 3, 4, 6, 7, 8, 9], dtype='int64')\n", + "\n", + "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: Index([2, 5, 6, 7, 8, 9], dtype='int64')\n", + "\n", + "MoritzLaurer-mDeBERTa-v3-base-mnli-xnli: RangeIndex(start=0, stop=10, step=1)\n", + "\n", + "MoritzLaurer-deberta-v3-large-zeroshot-v2.0: Index([0, 1, 2, 3, 4, 5, 6, 7, 9], dtype='int64')\n", + "\n", + "facebook-bart-large-mnli: RangeIndex(start=0, stop=10, step=1)\n", + "\n", + "valhalla-distilbart-mnli-12-1: Index([0, 1, 2, 3, 4, 7, 9], dtype='int64')\n", + "\n", + "MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli: Index([0, 2, 3, 4, 6, 7], dtype='int64')\n", + "\n" + ] + } + ], + "source": [ + "def get_difficult_trips(model_result, cut_off = 0.6):\n", + " # model_result is a dict with dict_keys(['model', 'predictions', \n", + " # 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", + " # get performance dataframe and repair index\n", + " df = model_result['performance'].reset_index(drop=True)\n", + " # find index of trips whose accuracy is below cut_off\n", + " index_result = df[df['accuracy'] < cut_off].index\n", + " return(index_result)\n", + "\n", + "# dictionary of trips that have accuracy below cut_off default\n", + "difficult_trips_dict = {}\n", + "for model, data in all_results.items():\n", + " difficult_trips_dict[data[\"model\"]] = get_difficult_trips(data)\n", + "\n", + "for key, value in difficult_trips_dict.items():\n", + " print(f\"{key}: {value}\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "d91fb932-c5aa-472a-9b8d-a0cfc83a87f8", + "metadata": {}, + "source": [ + "For all models" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "a2754cb7-59b9-4f1d-ab74-1bf711b3eba2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2 . My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany. \n", + "\n", + "city trip\n", + "['relaxing']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "7 . We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels. \n", + "\n", + "yoga / wellness retreat\n", + "['hut-to-hut hiking', 'yoga']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "formal (business trip)\n", + "sleeping in a tent\n", + "no own vehicle\n", + "avalanche-prone terrain\n", + "7 days\n", + "\n", + "\n" + ] + } + ], + "source": [ + "# Which trips are difficult for all models\n", + "common = set.intersection(*(set(v) for v in difficult_trips_dict.values()))\n", + "for index in common:\n", + " print(index, \".\", trip_descriptions[index], \"\\n\")\n", + " for item in trip_types[index]:\n", + " print(item)\n", + " print(\"\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "be58d66f-a491-4f47-98df-2c0aa4af38e7", + "metadata": {}, + "source": [ + "**Identify superclasses that are difficult to predict**" + ] + }, + { + "cell_type": "markdown", + "id": "7e833c2d-9356-4d40-9b20-0a1eb6628a30", + "metadata": {}, + "source": [ + "Per model" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "adb491b1-3ac3-4c32-934f-5eb6171f2ec9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cross-encoder-nli-deberta-v3-base: ['activities', 'climate_or_season', 'style_or_comfort', 'special_conditions']\n", + "\n", + "joeddav-bart-large-mnli-yahoo-answers: ['activities', 'climate_or_season', 'style_or_comfort', 'dress_code', 'accommodation', 'transportation', 'special_conditions']\n", + "\n", + "cross-encoder-nli-deberta-v3-large: ['activities', 'climate_or_season', 'style_or_comfort', 'transportation', 'special_conditions']\n", + "\n", + "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: ['activities', 'style_or_comfort', 'special_conditions']\n", + "\n", + "MoritzLaurer-mDeBERTa-v3-base-mnli-xnli: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions', 'trip_length_days']\n", + "\n", + "MoritzLaurer-deberta-v3-large-zeroshot-v2.0: ['activities', 'climate_or_season', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "\n", + "facebook-bart-large-mnli: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "\n", + "valhalla-distilbart-mnli-12-1: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "\n", + "MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli: ['activities', 'climate_or_season', 'style_or_comfort', 'special_conditions']\n", + "\n" + ] + } + ], + "source": [ + "def get_difficult_superclasses(model_result, cut_off = 0.6):\n", + " # model_result is a dict with dict_keys(['model', 'predictions', \n", + " # 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", + " df = model_result[\"perf_superclass\"]\n", + " # find superclass whose accuracy is below cut_off\n", + " diff_spc = list(df[df['accuracy'] < cut_off][\"superclass\"])\n", + " return(diff_spc)\n", + "\n", + "# make dictionary of superclasses that have accuracy below cut_off default\n", + "difficult_superclass_dict = {}\n", + "for model, data in all_results.items():\n", + " difficult_superclass_dict[data[\"model\"]] = get_difficult_superclasses(data)\n", + "\n", + "for key, value in difficult_superclass_dict.items():\n", + " print(f\"{key}: {value}\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "fbcebdf8-0975-45cb-96f5-15b4645aa7f6", + "metadata": {}, + "source": [ + "For all models" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "4e51c11b-9a0a-4f9d-b20c-a6feda2d5a3b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'style_or_comfort', 'activities', 'special_conditions'}\n" + ] + } + ], + "source": [ + "# Which trips are difficult for all models\n", + "common = set.intersection(*(set(v) for v in difficult_superclass_dict.values()))\n", + "print(common)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "f0e31e2c-e87d-4776-b781-991919492430", + "metadata": {}, + "outputs": [], + "source": [ + "# Look at particular predicitons in detail\n", + "# print(all_results[\"joeddav-bart-large-mnli-yahoo-answers\"])" + ] + }, + { + "cell_type": "markdown", + "id": "01e24355-4aac-4ad6-b50c-96f75585ce45", + "metadata": {}, + "source": [ + "**Comparing models**" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "b020f584-1468-4c84-9dac-7ca7fac6e8ca", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "dict_keys(['model', 'predictions', 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", + "\n", + "accuracy 0.522222\n", + "true_ident 0.841667\n", + "false_pred 0.572381\n", + "dtype: float64\n", + "0.5222222222222223\n" + ] + } + ], + "source": [ + "# Make table of 'perf_summary' for all models inlcude time elapsed\n", + "print(type(all_results))\n", + "print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"]))\n", + "print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"].keys())\n", + "print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"]))\n", + "print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"])\n", + "print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"][\"accuracy\"])\n", + "# make empty data frame\n", + "# fill in for loop with perf_summary per model\n", + "\n", + "\n", + "# Make ranking from that table for each category\n" + ] + }, + { + "cell_type": "markdown", + "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", + "metadata": {}, + "source": [ + "# Use gradio for user input" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "cb7fd425-d0d6-458d-97ca-2150dc55f206", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7861\n", + "Running on public URL: https://aa06d5d85ffadaa92b.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n" + ] + } + ], + "source": [ + "# use model with gradio\n", + "from transformers import pipeline\n", + "import gradio as gr\n", + "\n", + "# make a function for what I am doing\n", + "def classify(text):\n", + " df = pd.DataFrame(columns=['Superclass', 'class'])\n", + " for i, key in enumerate(keys_list):\n", + " # Run the classification (ca 30 seconds classifying)\n", + " if key == 'activities':\n", + " result = classifier(text, candidate_labels[key], multi_label=True)\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(text, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + "\n", + " return df\n", + "\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=\"text\",\n", + " outputs=\"dataframe\",\n", + " title=\"Zero-Shot Classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", + "\n", + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch(share=True)" + ] + }, + { + "cell_type": "markdown", + "id": "8e856a9c-a66c-4c4b-b7cf-8c52abbbc6fa", + "metadata": {}, + "source": [ + "Use model with gradio" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7861\n", + "Running on public URL: https://0f70ba5369d721cf8f.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Define the Gradio interface\n", + "def classify(text):\n", + " return classifier(text, class_labels)\n", + "\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=\"text\",\n", + " outputs=\"json\",\n", + " title=\"Zero-Shot Classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", + "\n", + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch(share=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c8da1c90-d3a3-4b08-801c-b3afa17b2633", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python (huggingface_env)", + "language": "python", + "name": "huggingface_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.20" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/space/space/space/app.py b/space/space/space/app.py index 948b66b2b3571417237381958a3e5ee68345a6a8..65ade26e36daa2a02cc5ca99911b135306d2e7c9 100644 --- a/space/space/space/app.py +++ b/space/space/space/app.py @@ -1,22 +1,48 @@ +# Prerequisites from transformers import pipeline +import json +import pandas as pd import gradio as gr -# Load the model and create a pipeline for zero-shot classification -classifier = pipeline("zero-shot-classification", model="facebook/bart-base") +# get candidate labels +with open("packing_label_structure.json", "r") as file: + candidate_labels = json.load(file) +keys_list = list(candidate_labels.keys()) -# Load labels from a txt file -with open("labels.txt", "r", encoding="utf-8") as f: - class_labels = [line.strip() for line in f if line.strip()] +# Load test data (in list of dictionaries) +with open("test_data.json", "r") as file: + packing_data = json.load(file) -# Define the Gradio interface -def classify(text): - return classifier(text, class_labels) +# function and gradio app +model_name = "facebook/bart-large-mnli" +classifier = pipeline("zero-shot-classification", model=model_name) +cut_off = 0.5 # used to choose which activities are relevant + +def classify(#model_name, + trip_descr, cut_off): + + # Create an empty DataFrame with specified columns + df = pd.DataFrame(columns=['superclass', 'pred_class']) + for i, key in enumerate(keys_list): + if key == 'activities': + result = classifier(trip_descr, candidate_labels[key], multi_label=True) + indices = [i for i, score in enumerate(result['scores']) if score > cut_off] + classes = [result['labels'][i] for i in indices] + else: + result = classifier(trip_descr, candidate_labels[key]) + classes = result["labels"][0] + df.loc[i] = [key, classes] + return df demo = gr.Interface( fn=classify, - inputs="text", - outputs="json", - title="Zero-Shot Classification", + inputs=[ + #gr.Textbox(label="Model name", value = "facebook/bart-large-mnli"), + gr.Textbox(label="Trip description"), + gr.Number(label="Activity cut-off", value = 0.5), + ], + outputs="dataframe", + title="Trip classification", description="Enter a text describing your trip", ) diff --git a/space/space/space/main_model.ipynb b/space/space/space/main_model.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..8f217f037282ada92bc7c413aed21eb6626fcbc1 --- /dev/null +++ b/space/space/space/main_model.ipynb @@ -0,0 +1,1115 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e25090fa-f990-4f1a-84f3-b12159eedae8", + "metadata": {}, + "source": [ + "# Implement and test prediciton model" + ] + }, + { + "cell_type": "markdown", + "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", + "metadata": {}, + "source": [ + "## Prerequisites" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", + "metadata": {}, + "outputs": [], + "source": [ + "# Prerequisites\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", + "import json\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import pickle\n", + "import os\n", + "import time\n", + "import math\n", + "\n", + "# get candidate labels\n", + "with open(\"packing_label_structure.json\", \"r\") as file:\n", + " candidate_labels = json.load(file)\n", + "keys_list = list(candidate_labels.keys())\n", + "\n", + "# Load test data (in list of dictionaries)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Extract all trip descriptions and trip_types\n", + "trip_descriptions = [trip['description'] for trip in packing_data]\n", + "trip_types = [trip['trip_types'] for trip in packing_data]\n", + "\n", + "# Access the first trip description\n", + "first_trip = trip_descriptions[0]\n", + "# Get the packing list for the secondfirst trip\n", + "first_trip_type = trip_types[0]\n", + "\n", + "# print(f\"First trip: {first_trip} \\n\")\n", + "# print(f\"Trip type: {first_trip_type}\")" + ] + }, + { + "cell_type": "markdown", + "id": "5cf4f76f-0035-44e8-93af-52eafaec686e", + "metadata": {}, + "source": [ + "**All trip descriptions**" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "89d42ca7-e871-4eda-b428-69e9bd965428", + "metadata": { + "jupyter": { + "source_hidden": true + }, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0 . I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands. \n", + "\n", + "beach vacation\n", + "['swimming', 'going to the beach', 'relaxing', 'hiking']\n", + "warm destination / summer\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "1 . We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train. \n", + "\n", + "city trip\n", + "['sightseeing']\n", + "variable weather / spring / autumn\n", + "luxury (including evening wear)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "3 days\n", + "\n", + "\n", + "2 . My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany. \n", + "\n", + "city trip\n", + "['relaxing']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "3 . I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August. \n", + "\n", + "cultural exploration\n", + "['sightseeing', 'hiking', 'rafting']\n", + "variable weather / spring / autumn\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "rainy climate\n", + "7+ days\n", + "\n", + "\n", + "4 . We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation. \n", + "\n", + "nature escape\n", + "['swimming', 'relaxing', 'hiking']\n", + "warm destination / summer\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "5 . I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days. \n", + "\n", + "long-distance hike / thru-hike\n", + "['going to the beach']\n", + "tropical / humid\n", + "minimalist\n", + "casual\n", + "huts with half board\n", + "own vehicle\n", + "off-grid / no electricity\n", + "6 days\n", + "\n", + "\n", + "6 . I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks. \n", + "\n", + "beach vacation\n", + "['stand-up paddleboarding (SUP)', 'surfing']\n", + "cold destination / winter\n", + "ultralight\n", + "casual\n", + "sleeping in a tent\n", + "own vehicle\n", + "off-grid / no electricity\n", + "6 days\n", + "\n", + "\n", + "7 . We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels. \n", + "\n", + "yoga / wellness retreat\n", + "['hiking', 'yoga']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "snow and ice\n", + "7 days\n", + "\n", + "\n", + "8 . I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days. \n", + "\n", + "ski tour / skitour\n", + "['ski touring', 'photography', 'swimming']\n", + "cold destination / winter\n", + "minimalist\n", + "conservative\n", + "indoor\n", + "no own vehicle\n", + "avalanche-prone terrain\n", + "5 days\n", + "\n", + "\n", + "9 . We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days. \n", + "\n", + "camping trip (wild camping)\n", + "['scuba diving', 'kayaking / canoeing']\n", + "tropical / humid\n", + "lightweight (but comfortable)\n", + "conservative\n", + "sleeping in a tent\n", + "own vehicle\n", + "no special conditions to consider\n", + "3 days\n", + "\n", + "\n" + ] + } + ], + "source": [ + "for i, item in enumerate(trip_descriptions):\n", + " print(i, \".\", item, \"\\n\")\n", + " for elem in trip_types[i]:\n", + " print(elem)\n", + " print(\"\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "0f60c54b-affc-4d9a-acf1-da70f68c5578", + "metadata": {}, + "source": [ + "**Functions**" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "fac51224-9575-4b4b-8567-4ad4e759ecc9", + "metadata": {}, + "outputs": [], + "source": [ + "# function that returns pandas data frame with predictions and true values\n", + "\n", + "cut_off = 0.5 # used to choose which activities are relevant\n", + "\n", + "def pred_trip(model_name, trip_descr, trip_type, cut_off):\n", + " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", + " # Create an empty DataFrame with specified columns\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(result)\n", + " print(classes)\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + " df['true_class'] = trip_type\n", + " return df" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "b36ab806-2f35-4950-ac5a-7c192190cba7", + "metadata": {}, + "outputs": [], + "source": [ + "# function for accuracy, perc true classes identified and perc wrong pred classes\n", + "\n", + "def perf_measure(df):\n", + " df['same_value'] = df['pred_class'] == df['true_class']\n", + " correct = sum(df.loc[df.index != 1, 'same_value'])\n", + " total = len(df['same_value'])\n", + " accuracy = correct/total\n", + " pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + " true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + " correct = [label for label in pred_class if label in true_class]\n", + " num_correct = len(correct)\n", + " correct_perc = num_correct/len(true_class)\n", + " num_pred = len(pred_class)\n", + " if num_pred == 0:\n", + " wrong_perc = math.nan\n", + " else:\n", + " wrong_perc = (num_pred - num_correct)/num_pred\n", + " df_perf = pd.DataFrame({\n", + " 'accuracy': [accuracy],\n", + " 'true_ident': [correct_perc],\n", + " 'false_pred': [wrong_perc]\n", + " })\n", + " return(df_perf)" + ] + }, + { + "cell_type": "markdown", + "id": "c10aa57d-d7ed-45c7-bdf5-29af193c7fd5", + "metadata": {}, + "source": [ + "## Make predictions for many models and trip descriptions\n", + "\n", + "Provide a list of candidate models and apply them to the test data." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "dd7869a8-b436-40de-9ea0-28eb4b7d3248", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Using model: facebook/bart-large-mnli\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 25\u001b[0m\n\u001b[1;32m 23\u001b[0m current_trip \u001b[38;5;241m=\u001b[39m trip_descriptions[i]\n\u001b[1;32m 24\u001b[0m current_type \u001b[38;5;241m=\u001b[39m trip_types[i]\n\u001b[0;32m---> 25\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpred_trip\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_trip\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcut_off\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 26\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 27\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n", + "Cell \u001b[0;32mIn[3], line 15\u001b[0m, in \u001b[0;36mpred_trip\u001b[0;34m(model_name, trip_descr, trip_type, cut_off)\u001b[0m\n\u001b[1;32m 13\u001b[0m classes \u001b[38;5;241m=\u001b[39m [result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m'\u001b[39m][i] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m indices]\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 15\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mclassifier\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrip_descr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcandidate_labels\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 16\u001b[0m classes \u001b[38;5;241m=\u001b[39m result[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 17\u001b[0m \u001b[38;5;28mprint\u001b[39m(result)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:206\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline.__call__\u001b[0;34m(self, sequences, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to understand extra arguments \u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msequences\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1294\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miterate(inputs, preprocess_params, forward_params, postprocess_params)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mframework \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpt\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ChunkPipeline):\n\u001b[0;32m-> 1294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1295\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43miter\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1296\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_iterator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1297\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43minputs\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnum_workers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbatch_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpreprocess_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforward_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostprocess_params\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:124\u001b[0m, in \u001b[0;36mPipelineIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_item()\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# We're out of items within a batch\u001b[39;00m\n\u001b[0;32m--> 124\u001b[0m item \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfer(item, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparams)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;66;03m# We now have a batch of \"inferred things\".\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:269\u001b[0m, in \u001b[0;36mPipelinePackIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m accumulator\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_last:\n\u001b[0;32m--> 269\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(processed, torch\u001b[38;5;241m.\u001b[39mTensor):\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1209\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1207\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1208\u001b[0m model_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdevice)\n\u001b[0;32m-> 1209\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mforward_params\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mdevice(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcpu\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 1211\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:229\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline._forward\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(model_forward)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 228\u001b[0m model_inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 229\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 231\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 232\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcandidate_label\u001b[39m\u001b[38;5;124m\"\u001b[39m: candidate_label,\n\u001b[1;32m 233\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msequence\u001b[39m\u001b[38;5;124m\"\u001b[39m: sequence,\n\u001b[1;32m 234\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m: inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 235\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moutputs,\n\u001b[1;32m 236\u001b[0m }\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m model_outputs\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:1763\u001b[0m, in \u001b[0;36mBartForSequenceClassification.forward\u001b[0;34m(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, inputs_embeds, decoder_inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1758\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m input_ids \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m inputs_embeds \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1759\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 1760\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPassing input embeddings is currently not supported for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1761\u001b[0m )\n\u001b[0;32m-> 1763\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1764\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1765\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1766\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_input_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_input_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1767\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_attention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_attention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1768\u001b[0m \u001b[43m \u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhead_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1769\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1770\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1771\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_outputs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_outputs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1772\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1773\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecoder_inputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_inputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1774\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cache\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cache\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1775\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1776\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1777\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1778\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1779\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m outputs[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;66;03m# last hidden state\u001b[39;00m\n\u001b[1;32m 1781\u001b[0m eos_mask \u001b[38;5;241m=\u001b[39m input_ids\u001b[38;5;241m.\u001b[39meq(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39meos_token_id)\u001b[38;5;241m.\u001b[39mto(hidden_states\u001b[38;5;241m.\u001b[39mdevice)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:1528\u001b[0m, in \u001b[0;36mBartModel.forward\u001b[0;34m(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, past_key_values, inputs_embeds, decoder_inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1521\u001b[0m encoder_outputs \u001b[38;5;241m=\u001b[39m BaseModelOutput(\n\u001b[1;32m 1522\u001b[0m last_hidden_state\u001b[38;5;241m=\u001b[39mencoder_outputs[\u001b[38;5;241m0\u001b[39m],\n\u001b[1;32m 1523\u001b[0m hidden_states\u001b[38;5;241m=\u001b[39mencoder_outputs[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(encoder_outputs) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1524\u001b[0m attentions\u001b[38;5;241m=\u001b[39mencoder_outputs[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(encoder_outputs) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m2\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1525\u001b[0m )\n\u001b[1;32m 1527\u001b[0m \u001b[38;5;66;03m# decoder outputs consists of (dec_features, past_key_value, dec_hidden, dec_attn)\u001b[39;00m\n\u001b[0;32m-> 1528\u001b[0m decoder_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecoder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1529\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_input_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1530\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_attention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1531\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_outputs\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1532\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_attention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1533\u001b[0m \u001b[43m \u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1534\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1535\u001b[0m \u001b[43m \u001b[49m\u001b[43mpast_key_values\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpast_key_values\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1536\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecoder_inputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1537\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cache\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cache\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1538\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1539\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1540\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1541\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1543\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m return_dict:\n\u001b[1;32m 1544\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m decoder_outputs \u001b[38;5;241m+\u001b[39m encoder_outputs\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:1380\u001b[0m, in \u001b[0;36mBartDecoder.forward\u001b[0;34m(self, input_ids, attention_mask, encoder_hidden_states, encoder_attention_mask, head_mask, cross_attn_head_mask, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1367\u001b[0m layer_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_gradient_checkpointing_func(\n\u001b[1;32m 1368\u001b[0m decoder_layer\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__call__\u001b[39m,\n\u001b[1;32m 1369\u001b[0m hidden_states,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1377\u001b[0m use_cache,\n\u001b[1;32m 1378\u001b[0m )\n\u001b[1;32m 1379\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1380\u001b[0m layer_outputs \u001b[38;5;241m=\u001b[39m \u001b[43mdecoder_layer\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1381\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1382\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1383\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1384\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoder_attention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencoder_attention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1385\u001b[0m \u001b[43m \u001b[49m\u001b[43mlayer_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[43m[\u001b[49m\u001b[43midx\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mhead_mask\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mis\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mnot\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1386\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_layer_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1387\u001b[0m \u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m[\u001b[49m\u001b[43midx\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mcross_attn_head_mask\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mis\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mnot\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\n\u001b[1;32m 1388\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1389\u001b[0m \u001b[43m \u001b[49m\u001b[43mpast_key_value\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpast_key_value\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1390\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1391\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cache\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cache\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1392\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1393\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m layer_outputs[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1395\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m use_cache:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:666\u001b[0m, in \u001b[0;36mBartDecoderLayer.forward\u001b[0;34m(self, hidden_states, attention_mask, encoder_hidden_states, encoder_attention_mask, layer_head_mask, cross_attn_layer_head_mask, past_key_value, output_attentions, use_cache)\u001b[0m\n\u001b[1;32m 664\u001b[0m self_attn_past_key_value \u001b[38;5;241m=\u001b[39m past_key_value[:\u001b[38;5;241m2\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m past_key_value \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 665\u001b[0m \u001b[38;5;66;03m# add present self-attn cache to positions 1,2 of present_key_value tuple\u001b[39;00m\n\u001b[0;32m--> 666\u001b[0m hidden_states, self_attn_weights, present_key_value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mself_attn\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 667\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[43mpast_key_value\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mself_attn_past_key_value\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43mlayer_head_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlayer_head_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 673\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m nn\u001b[38;5;241m.\u001b[39mfunctional\u001b[38;5;241m.\u001b[39mdropout(hidden_states, p\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdropout, training\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtraining)\n\u001b[1;32m 674\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m residual \u001b[38;5;241m+\u001b[39m hidden_states\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/bart/modeling_bart.py:450\u001b[0m, in \u001b[0;36mBartSdpaAttention.forward\u001b[0;34m(self, hidden_states, key_value_states, past_key_value, attention_mask, layer_head_mask, output_attentions)\u001b[0m\n\u001b[1;32m 447\u001b[0m bsz, tgt_len, _ \u001b[38;5;241m=\u001b[39m hidden_states\u001b[38;5;241m.\u001b[39msize()\n\u001b[1;32m 449\u001b[0m \u001b[38;5;66;03m# get query proj\u001b[39;00m\n\u001b[0;32m--> 450\u001b[0m query_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mq_proj\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 451\u001b[0m \u001b[38;5;66;03m# get key, value proj\u001b[39;00m\n\u001b[1;32m 452\u001b[0m \u001b[38;5;66;03m# `past_key_value[0].shape[2] == key_value_states.shape[1]`\u001b[39;00m\n\u001b[1;32m 453\u001b[0m \u001b[38;5;66;03m# is checking that the `sequence_length` of the `past_key_value` is the same as\u001b[39;00m\n\u001b[1;32m 454\u001b[0m \u001b[38;5;66;03m# the provided `key_value_states` to support prefix tuning\u001b[39;00m\n\u001b[1;32m 455\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 456\u001b[0m is_cross_attention\n\u001b[1;32m 457\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m past_key_value \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 458\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m past_key_value[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;241m==\u001b[39m key_value_states\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 459\u001b[0m ):\n\u001b[1;32m 460\u001b[0m \u001b[38;5;66;03m# reuse k,v, cross_attentions\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/linear.py:116\u001b[0m, in \u001b[0;36mLinear.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m: Tensor) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Tensor:\n\u001b[0;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mF\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinear\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mweight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbias\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], + "source": [ + "# List of Hugging Face model names\n", + "model_names = [\n", + " \"facebook/bart-large-mnli\",\n", + " \"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\",\n", + " ##\"cross-encoder/nli-deberta-v3-base\",\n", + " \"cross-encoder/nli-deberta-v3-large\",\n", + " \"MoritzLaurer/mDeBERTa-v3-base-mnli-xnli\",\n", + " ##\"joeddav/bart-large-mnli-yahoo-answers\",\n", + " \"MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli\",\n", + " \"MoritzLaurer/deberta-v3-large-zeroshot-v2.0\",\n", + " \"valhalla/distilbart-mnli-12-1\",\n", + " #\"joeddav/xlm-roberta-large-xnli\" # keeps giving errors\n", + "]\n", + "\n", + "# Apply each model to the test data\n", + "for model_name in model_names:\n", + " print(f\"\\nUsing model: {model_name}\")\n", + " result_list = []\n", + " performance = pd.DataFrame(columns=['accuracy', 'true_ident', 'false_pred'])\n", + " \n", + " start_time = time.time()\n", + " for i in range(len(trip_descriptions)):\n", + " current_trip = trip_descriptions[i]\n", + " current_type = trip_types[i]\n", + " df = pred_trip(model_name, current_trip, current_type, cut_off = 0.5)\n", + " print(df)\n", + " # accuracy, perc true classes identified and perc wrong pred classes\n", + " performance = pd.concat([performance, perf_measure(df)])\n", + " print(performance)\n", + " \n", + " result_list.append(df)\n", + " end_time = time.time()\n", + " elapsed_time = end_time - start_time\n", + " # Extract \"same_value\" column from each DataFrame\n", + " sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", + " sv_columns.insert(0, result_list[0]['superclass'])\n", + " # Combine into a new DataFrame (columns side-by-side)\n", + " sv_df = pd.concat(sv_columns, axis=1)\n", + " print(sv_df)\n", + " # Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", + " row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", + " df_row_means = pd.DataFrame({\n", + " 'superclass': sv_df['superclass'],\n", + " 'accuracy': row_means\n", + " })\n", + " print(df_row_means)\n", + " # Compute performance measures per trip (mean for each column of performance table)\n", + " column_means = performance.mean()\n", + " print(column_means)\n", + " # save results\n", + " model = model_name.replace(\"/\", \"-\")\n", + " model_result = {\n", + " 'model': model,\n", + " 'predictions': result_list,\n", + " 'performance': performance,\n", + " 'perf_summary': column_means,\n", + " 'perf_superclass': df_row_means,\n", + " 'elapsed_time': elapsed_time\n", + " }\n", + " # File path with folder\n", + " filename = os.path.join('results', f'{model}_results.pkl')\n", + " # Save the object\n", + " with open(filename, 'wb') as f:\n", + " pickle.dump(model_result, f)\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "e1cbb54e-abe6-49b6-957e-0683196f3199", + "metadata": {}, + "source": [ + "## Load and compare results" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: cross-encoder-nli-deberta-v3-base\n", + "Performance Summary:\n", + "accuracy 0.444444\n", + "true_ident 0.533333\n", + "false_pred 0.712500\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: joeddav-bart-large-mnli-yahoo-answers\n", + "Performance Summary:\n", + "accuracy 0.344444\n", + "true_ident 0.650000\n", + "false_pred 0.553792\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: cross-encoder-nli-deberta-v3-large\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.566667\n", + "false_pred 0.541667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", + "Performance Summary:\n", + "accuracy 0.566667\n", + "true_ident 0.841667\n", + "false_pred 0.546667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.408333\n", + "false_pred 0.481250\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", + "Performance Summary:\n", + "accuracy 0.455556\n", + "true_ident 0.325000\n", + "false_pred 0.500000\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: facebook-bart-large-mnli\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.708333\n", + "false_pred 0.400000\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: valhalla-distilbart-mnli-12-1\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.300000\n", + "false_pred 0.533333\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.841667\n", + "false_pred 0.572381\n", + "dtype: float64\n", + "----------------------------------------\n" + ] + } + ], + "source": [ + "# Folder where .pkl files are saved\n", + "results_dir = 'results/before'\n", + "\n", + "# Dictionary to store all loaded results\n", + "all_results = {}\n", + "\n", + "# Loop through all .pkl files in the folder\n", + "for filename in os.listdir(results_dir):\n", + " if filename.endswith('.pkl'):\n", + " model_name = filename.replace('_results.pkl', '') # Extract model name\n", + " file_path = os.path.join(results_dir, filename)\n", + " \n", + " # Load the result\n", + " with open(file_path, 'rb') as f:\n", + " result = pickle.load(f)\n", + " all_results[model_name] = result\n", + "\n", + "# Compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", + " print(\"-\" * 40)\n", + "\n", + "# Compare performance across models\n", + "#for model, data in all_results.items():\n", + "# print(f\"Model: {model}\")\n", + "# print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", + "# print(\"-\" * 40)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "37849e0b-864e-4377-b06c-0ac70c3861f9", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: cross-encoder-nli-deberta-v3-base\n", + "Performance Summary:\n", + "accuracy 0.444444\n", + "true_ident 0.533333\n", + "false_pred 0.712500\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: joeddav-bart-large-mnli-yahoo-answers\n", + "Performance Summary:\n", + "accuracy 0.355556\n", + "true_ident 0.650000\n", + "false_pred 0.553792\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: cross-encoder-nli-deberta-v3-large\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.566667\n", + "false_pred 0.541667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli\n", + "Performance Summary:\n", + "accuracy 0.611111\n", + "true_ident 0.841667\n", + "false_pred 0.546667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-mDeBERTa-v3-base-mnli-xnli\n", + "Performance Summary:\n", + "accuracy 0.455556\n", + "true_ident 0.408333\n", + "false_pred 0.481250\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-deberta-v3-large-zeroshot-v2.0\n", + "Performance Summary:\n", + "accuracy 0.500\n", + "true_ident 0.325\n", + "false_pred 0.500\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: facebook-bart-large-mnli\n", + "Performance Summary:\n", + "accuracy 0.466667\n", + "true_ident 0.708333\n", + "false_pred 0.400000\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: valhalla-distilbart-mnli-12-1\n", + "Performance Summary:\n", + "accuracy 0.500000\n", + "true_ident 0.300000\n", + "false_pred 0.533333\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.841667\n", + "false_pred 0.572381\n", + "dtype: float64\n", + "----------------------------------------\n" + ] + } + ], + "source": [ + "# Folder where .pkl files are saved\n", + "results_dir = 'results'\n", + "\n", + "# Dictionary to store all loaded results\n", + "all_results = {}\n", + "\n", + "# Loop through all .pkl files in the folder\n", + "for filename in os.listdir(results_dir):\n", + " if filename.endswith('.pkl'):\n", + " model_name = filename.replace('_results.pkl', '') # Extract model name\n", + " file_path = os.path.join(results_dir, filename)\n", + " \n", + " # Load the result\n", + " with open(file_path, 'rb') as f:\n", + " result = pickle.load(f)\n", + " all_results[model_name] = result\n", + "\n", + "# Compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", + " print(\"-\" * 40)\n" + ] + }, + { + "cell_type": "markdown", + "id": "2f65e5b1-bc32-42c2-bbe9-9e3a6ffc72c1", + "metadata": {}, + "source": [ + "**Identify trips that are difficult to predict**" + ] + }, + { + "cell_type": "markdown", + "id": "040055c9-5df4-49b0-921a-5bf98ff01a69", + "metadata": {}, + "source": [ + "Per model" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "57fd150d-1cda-4be5-806b-ef380469243a", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cross-encoder-nli-deberta-v3-base: Index([0, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64')\n", + "\n", + "joeddav-bart-large-mnli-yahoo-answers: RangeIndex(start=0, stop=10, step=1)\n", + "\n", + "cross-encoder-nli-deberta-v3-large: Index([0, 1, 2, 3, 4, 6, 7, 8, 9], dtype='int64')\n", + "\n", + "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: Index([2, 3, 5, 6, 7, 8, 9], dtype='int64')\n", + "\n", + "MoritzLaurer-mDeBERTa-v3-base-mnli-xnli: RangeIndex(start=0, stop=10, step=1)\n", + "\n", + "MoritzLaurer-deberta-v3-large-zeroshot-v2.0: Index([1, 2, 3, 5, 6, 7, 9], dtype='int64')\n", + "\n", + "facebook-bart-large-mnli: RangeIndex(start=0, stop=10, step=1)\n", + "\n", + "valhalla-distilbart-mnli-12-1: Index([0, 1, 2, 3, 4, 7, 9], dtype='int64')\n", + "\n", + "MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli: Index([0, 2, 3, 4, 6, 7], dtype='int64')\n", + "\n" + ] + } + ], + "source": [ + "def get_difficult_trips(model_result, cut_off = 0.6):\n", + " # model_result is a dict with dict_keys(['model', 'predictions', \n", + " # 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", + " # get performance dataframe and repair index\n", + " df = model_result['performance'].reset_index(drop=True)\n", + " # find index of trips whose accuracy is below cut_off\n", + " index_result = df[df['accuracy'] < cut_off].index\n", + " return(index_result)\n", + "\n", + "# dictionary of trips that have accuracy below cut_off default\n", + "difficult_trips_dict = {}\n", + "for model, data in all_results.items():\n", + " difficult_trips_dict[data[\"model\"]] = get_difficult_trips(data)\n", + "\n", + "for key, value in difficult_trips_dict.items():\n", + " print(f\"{key}: {value}\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "d91fb932-c5aa-472a-9b8d-a0cfc83a87f8", + "metadata": {}, + "source": [ + "For all models" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "a2754cb7-59b9-4f1d-ab74-1bf711b3eba2", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2 . My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany. \n", + "\n", + "city trip\n", + "['relaxing']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "no special conditions to consider\n", + "7+ days\n", + "\n", + "\n", + "3 . I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August. \n", + "\n", + "cultural exploration\n", + "['sightseeing', 'hiking', 'rafting']\n", + "variable weather / spring / autumn\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "rainy climate\n", + "7+ days\n", + "\n", + "\n", + "7 . We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels. \n", + "\n", + "yoga / wellness retreat\n", + "['hiking', 'yoga']\n", + "cold destination / winter\n", + "lightweight (but comfortable)\n", + "casual\n", + "indoor\n", + "no own vehicle\n", + "snow and ice\n", + "7 days\n", + "\n", + "\n" + ] + } + ], + "source": [ + "# Which trips are difficult for all models\n", + "common = set.intersection(*(set(v) for v in difficult_trips_dict.values()))\n", + "for index in common:\n", + " print(index, \".\", trip_descriptions[index], \"\\n\")\n", + " for item in trip_types[index]:\n", + " print(item)\n", + " print(\"\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "be58d66f-a491-4f47-98df-2c0aa4af38e7", + "metadata": {}, + "source": [ + "**Identify superclasses that are difficult to predict**" + ] + }, + { + "cell_type": "markdown", + "id": "7e833c2d-9356-4d40-9b20-0a1eb6628a30", + "metadata": {}, + "source": [ + "Per model" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "adb491b1-3ac3-4c32-934f-5eb6171f2ec9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cross-encoder-nli-deberta-v3-base: ['activities', 'climate_or_season', 'style_or_comfort', 'special_conditions']\n", + "\n", + "joeddav-bart-large-mnli-yahoo-answers: ['activities', 'climate_or_season', 'style_or_comfort', 'dress_code', 'accommodation', 'transportation', 'special_conditions']\n", + "\n", + "cross-encoder-nli-deberta-v3-large: ['activities', 'climate_or_season', 'style_or_comfort', 'transportation', 'special_conditions']\n", + "\n", + "MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli: ['activities', 'style_or_comfort']\n", + "\n", + "MoritzLaurer-mDeBERTa-v3-base-mnli-xnli: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions', 'trip_length_days']\n", + "\n", + "MoritzLaurer-deberta-v3-large-zeroshot-v2.0: ['activities', 'climate_or_season', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "\n", + "facebook-bart-large-mnli: ['activities', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "\n", + "valhalla-distilbart-mnli-12-1: ['activities', 'climate_or_season', 'style_or_comfort', 'accommodation', 'special_conditions']\n", + "\n", + "MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli: ['activities', 'climate_or_season', 'style_or_comfort', 'special_conditions']\n", + "\n" + ] + } + ], + "source": [ + "def get_difficult_superclasses(model_result, cut_off = 0.6):\n", + " # model_result is a dict with dict_keys(['model', 'predictions', \n", + " # 'performance', 'perf_summary', 'perf_superclass', 'elapsed_time'])\n", + " df = model_result[\"perf_superclass\"]\n", + " # find superclass whose accuracy is below cut_off\n", + " diff_spc = list(df[df['accuracy'] < cut_off][\"superclass\"])\n", + " return(diff_spc)\n", + "\n", + "# make dictionary of superclasses that have accuracy below cut_off default\n", + "difficult_superclass_dict = {}\n", + "for model, data in all_results.items():\n", + " difficult_superclass_dict[data[\"model\"]] = get_difficult_superclasses(data)\n", + "\n", + "for key, value in difficult_superclass_dict.items():\n", + " print(f\"{key}: {value}\\n\")" + ] + }, + { + "cell_type": "markdown", + "id": "fbcebdf8-0975-45cb-96f5-15b4645aa7f6", + "metadata": {}, + "source": [ + "For all models" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "4e51c11b-9a0a-4f9d-b20c-a6feda2d5a3b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'style_or_comfort', 'activities'}\n" + ] + } + ], + "source": [ + "# Which trips are difficult for all models\n", + "common = set.intersection(*(set(v) for v in difficult_superclass_dict.values()))\n", + "print(common)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "f0e31e2c-e87d-4776-b781-991919492430", + "metadata": {}, + "outputs": [], + "source": [ + "# Look at particular predicitons in detail\n", + "# print(all_results[\"joeddav-bart-large-mnli-yahoo-answers\"])" + ] + }, + { + "cell_type": "markdown", + "id": "01e24355-4aac-4ad6-b50c-96f75585ce45", + "metadata": {}, + "source": [ + "**Comparing models**" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "b020f584-1468-4c84-9dac-7ca7fac6e8ca", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[]\n", + "\n", + " accuracy true_ident false_pred \\\n", + "0 0.444444 0.533333 0.7125 \n", + "1 0.355556 0.65 0.553792 \n", + "2 0.466667 0.566667 0.541667 \n", + "3 0.611111 0.841667 0.546667 \n", + "4 0.455556 0.408333 0.48125 \n", + "5 0.5 0.325 0.5 \n", + "6 0.466667 0.708333 0.4 \n", + "7 0.5 0.3 0.533333 \n", + "8 0.522222 0.841667 0.572381 \n", + "\n", + " model \n", + "0 cross-encoder-nli-deberta-v3-base \n", + "1 joeddav-bart-large-mnli-yahoo-answers \n", + "2 cross-encoder-nli-deberta-v3-large \n", + "3 MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-... \n", + "4 MoritzLaurer-mDeBERTa-v3-base-mnli-xnli \n", + "5 MoritzLaurer-deberta-v3-large-zeroshot-v2.0 \n", + "6 facebook-bart-large-mnli \n", + "7 valhalla-distilbart-mnli-12-1 \n", + "8 MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli \n" + ] + } + ], + "source": [ + "# Make table of 'perf_summary' for all models inlcude time elapsed\n", + "#print(type(all_results))\n", + "#print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"]))\n", + "#print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"].keys())\n", + "#print(type(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"]))\n", + "#print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"])\n", + "#print(all_results[\"MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\"][\"perf_summary\"][\"accuracy\"])\n", + "# make empty data frame\n", + "perf_table = []\n", + "print(perf_table)\n", + "\n", + "# fill in for loop with perf_summary per model\n", + "for model, result in all_results.items():\n", + " row = pd.DataFrame(result[\"perf_summary\"]).T\n", + " #print(row.shape)\n", + " row[\"model\"] = model\n", + " perf_table.append(row)\n", + "# Concatenate all into one table\n", + "df_all = pd.concat(perf_table, ignore_index=True)\n", + "\n", + "print(df_all)\n", + "#print(type(df_all))\n", + " \n", + "\n", + "# Make ranking from that table for each category\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "0f7376bd-a50b-47cc-8055-48a6de5dfee6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "print(type(all_results))" + ] + }, + { + "cell_type": "markdown", + "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", + "metadata": {}, + "source": [ + "# Use gradio for user input" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "5bf23e10-0a93-4b2f-9508-34bb0974d24c", + "metadata": {}, + "outputs": [], + "source": [ + "# Prerequisites\n", + "from transformers import pipeline\n", + "import json\n", + "import pandas as pd\n", + "import gradio as gr\n", + "\n", + "# get candidate labels\n", + "with open(\"packing_label_structure.json\", \"r\") as file:\n", + " candidate_labels = json.load(file)\n", + "keys_list = list(candidate_labels.keys())\n", + "\n", + "# Load test data (in list of dictionaries)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Extract all trip descriptions and trip_types\n", + "# trip_descriptions = [trip['description'] for trip in packing_data]\n", + "# trip_types = [trip['trip_types'] for trip in packing_data]" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "61ebbe99-2563-4c99-ba65-d2312c9d5844", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7860\n", + "Running on public URL: https://91493051ab28db8a5a.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + } + ], + "source": [ + "# function and gradio app\n", + "cut_off = 0.5 # used to choose which activities are relevant\n", + "\n", + "def classify(model_name, trip_descr, cut_off):\n", + " classifier = pipeline(\"zero-shot-classification\", model=model_name)\n", + " # Create an empty DataFrame with specified columns\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " df.loc[i] = [key, classes]\n", + " return df\n", + "\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=[\n", + " gr.Textbox(label=\"Model name\", value = \"facebook/bart-large-mnli\"),\n", + " gr.Textbox(label=\"Trip description\"),\n", + " gr.Number(label=\"Activity cut-off\", value = 0.5),\n", + " ],\n", + " outputs=\"dataframe\",\n", + " title=\"Trip classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", + "\n", + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch(share=True)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python (huggingface_env)", + "language": "python", + "name": "huggingface_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.20" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/space/space/space/results/.DS_Store b/space/space/space/results/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..455a41f0b358a9cbbbeec878b8c3bfcd96faf45e Binary files /dev/null and b/space/space/space/results/.DS_Store differ diff --git a/space/space/space/results/MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl b/space/space/space/results/MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..337cdd5d0ad3a4ebc570202d29ef64c5b3c1c3c2 --- /dev/null +++ b/space/space/space/results/MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ff7524d88a78292aac59dd808d6409da3094dca6c480e702c723de033a64fee +size 9616 diff --git a/space/space/space/results/MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli_results.pkl b/space/space/space/results/MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..0447449d4f3547de1661b2cc91ee1847961f00ba --- /dev/null +++ b/space/space/space/results/MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20bab421410028527f62eb5dafe383c6062dcdef4f335f99079283a5c77700e5 +size 9526 diff --git a/space/space/space/results/MoritzLaurer-deberta-v3-large-zeroshot-v2.0_results.pkl b/space/space/space/results/MoritzLaurer-deberta-v3-large-zeroshot-v2.0_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..bb56a807f0bcaeaaff84c4d50d2ec97e4ad2e649 --- /dev/null +++ b/space/space/space/results/MoritzLaurer-deberta-v3-large-zeroshot-v2.0_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37383ba39c8fbf9fa4e0f5ab2f263a94044d30fa55c7002f2dde059371e2744a +size 9424 diff --git a/space/space/space/results/MoritzLaurer-mDeBERTa-v3-base-mnli-xnli_results.pkl b/space/space/space/results/MoritzLaurer-mDeBERTa-v3-base-mnli-xnli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..0d8fdee1da648c2ea9ffb828729c75a50f69537b --- /dev/null +++ b/space/space/space/results/MoritzLaurer-mDeBERTa-v3-base-mnli-xnli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eaa0e36c292a34907b242d890251cb378e113852a472711e469d6dd246a50a7 +size 9544 diff --git a/space/space/space/results/before/MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl b/space/space/space/results/before/MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..55ec9830cf71927c9c350696320b83e6c27fca3b --- /dev/null +++ b/space/space/space/results/before/MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af6a30fdc19d830ebe35e091878231b84618663781d1ed86b1f53507065d20e5 +size 9533 diff --git a/space/space/space/results/before/MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli_results.pkl b/space/space/space/results/before/MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..07a31a107988141a142b7905b575a22797052e84 --- /dev/null +++ b/space/space/space/results/before/MoritzLaurer-DeBERTa-v3-large-mnli-fever-anli-ling-wanli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e11eadfa64ac378e24c1df9c8f952b19fcca05ca634068506713d25ef1461e2 +size 9509 diff --git a/space/space/space/results/before/MoritzLaurer-deberta-v3-large-zeroshot-v2.0_results.pkl b/space/space/space/results/before/MoritzLaurer-deberta-v3-large-zeroshot-v2.0_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..811e646b6484af7307943057092614e64ce9dab8 --- /dev/null +++ b/space/space/space/results/before/MoritzLaurer-deberta-v3-large-zeroshot-v2.0_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c1b48262c7ff16332488e83aaa29703469463fae39fb950aeb055cfb6bdbc70 +size 9356 diff --git a/space/space/space/results/before/MoritzLaurer-mDeBERTa-v3-base-mnli-xnli_results.pkl b/space/space/space/results/before/MoritzLaurer-mDeBERTa-v3-base-mnli-xnli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..04811322553a20b2cfe3edc4f9434246562a773e --- /dev/null +++ b/space/space/space/results/before/MoritzLaurer-mDeBERTa-v3-base-mnli-xnli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55172023628edf78e2663cdfb75f18852fbb1979d74332140176bcad4017a98d +size 9562 diff --git a/space/space/space/results/before/cross-encoder-nli-deberta-v3-base_results.pkl b/space/space/space/results/before/cross-encoder-nli-deberta-v3-base_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..2712be88ccb399229120dd0dd1c266659908dad5 --- /dev/null +++ b/space/space/space/results/before/cross-encoder-nli-deberta-v3-base_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5116d85a6fd3d1669b8c307934df35aa87bdbb8e89573a05851dcdf6078a4db +size 9643 diff --git a/space/space/space/results/before/cross-encoder-nli-deberta-v3-large_results.pkl b/space/space/space/results/before/cross-encoder-nli-deberta-v3-large_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..b0ca00d18cf7ca90eacc049aa31cd357426558b0 --- /dev/null +++ b/space/space/space/results/before/cross-encoder-nli-deberta-v3-large_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b354f0cb55f0b398614195155e66a537d5b12f9dd657a370bfbf7f6c2c9ca5bd +size 9463 diff --git a/space/space/space/results/before/facebook-bart-large-mnli_results.pkl b/space/space/space/results/before/facebook-bart-large-mnli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..426f39a0ad6c2b3e94c904dfbf3e94fc18855bff --- /dev/null +++ b/space/space/space/results/before/facebook-bart-large-mnli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bee4588344312e7c93436e88f58257935a273f90ec7422a9a0fab77b57540a2e +size 9427 diff --git a/space/space/space/results/before/joeddav-bart-large-mnli-yahoo-answers_results.pkl b/space/space/space/results/before/joeddav-bart-large-mnli-yahoo-answers_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..750ad85081fd8ccab8238d9d1dc085f987422062 --- /dev/null +++ b/space/space/space/results/before/joeddav-bart-large-mnli-yahoo-answers_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c17c9d623753ad38339bdf9e4204ff34b2ddf6ffc11b8077617da6349aff816 +size 9718 diff --git a/space/space/space/results/before/valhalla-distilbart-mnli-12-1_results.pkl b/space/space/space/results/before/valhalla-distilbart-mnli-12-1_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..24a3229f2e521bbc286eb8ad3fc93710432c12c6 --- /dev/null +++ b/space/space/space/results/before/valhalla-distilbart-mnli-12-1_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45d4d12f3880836626c96e5dddad7293aa8124abec5eb187845a0637cdd93df1 +size 9277 diff --git a/space/space/space/results/cross-encoder-nli-deberta-v3-base_results.pkl b/space/space/space/results/cross-encoder-nli-deberta-v3-base_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..d9482982a3014192b5f4f1896377819da381fb45 --- /dev/null +++ b/space/space/space/results/cross-encoder-nli-deberta-v3-base_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce310367d9c5baec72cef673cf1608ee1b11fc7239c459b38f4ffb86cbe7ddff +size 9670 diff --git a/space/space/space/results/cross-encoder-nli-deberta-v3-large_results.pkl b/space/space/space/results/cross-encoder-nli-deberta-v3-large_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..c72c8ca6ac06c2f10ad211bbfe9932ae48558dd5 --- /dev/null +++ b/space/space/space/results/cross-encoder-nli-deberta-v3-large_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b363db77b85d99ed32e0daa026f31cfdd7d001ab5f4782abecd2f11f2a06281 +size 9602 diff --git a/space/space/space/results/facebook-bart-large-mnli_results.pkl b/space/space/space/results/facebook-bart-large-mnli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..19eea9de61c6c0126d979d1bdc0406410538e30e --- /dev/null +++ b/space/space/space/results/facebook-bart-large-mnli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e00867ad478907a6e514e97d342ef8915ee2c486912ff7056e6dfc5faa11278 +size 9489 diff --git a/space/space/space/results/joeddav-bart-large-mnli-yahoo-answers_results.pkl b/space/space/space/results/joeddav-bart-large-mnli-yahoo-answers_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..0559113be487370394766a19d9d225f9db0c6707 --- /dev/null +++ b/space/space/space/results/joeddav-bart-large-mnli-yahoo-answers_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:175935f34f69404b1662d4572a543ddd77938bc5ee53751034e2ddb07f6b4d49 +size 9694 diff --git a/space/space/space/results/valhalla-distilbart-mnli-12-1_results.pkl b/space/space/space/results/valhalla-distilbart-mnli-12-1_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..c581b71537a2fb56ae176cc994b0d13cb2730ffb --- /dev/null +++ b/space/space/space/results/valhalla-distilbart-mnli-12-1_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:779ac1118c668f3c090dafe28608c624b0acac270bff55ddb7babff36ee33f09 +size 9374 diff --git a/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb b/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb index 85420852989fd29e5b51c59357ad16b90b56fd8f..c2824851ceaec67fcffb77be40e91bb4d946bb6d 100644 --- a/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb +++ b/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb @@ -19,113 +19,15 @@ "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", "metadata": {}, "source": [ - "**Load and try the model**" + "**Load prerequisites**" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 57, "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", "metadata": {}, "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "9ec45d8fb4e247e4b1188972547ebb7f", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "config.json: 0%| | 0.00/1.09k [00:00 7\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpred_trip\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcurrent_trip\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcut_off\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n", - "Cell \u001b[0;32mIn[37], line 14\u001b[0m, in \u001b[0;36mpred_trip\u001b[0;34m(trip_descr, trip_type, cut_off)\u001b[0m\n\u001b[1;32m 12\u001b[0m classes \u001b[38;5;241m=\u001b[39m [result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m'\u001b[39m][i] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m indices]\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 14\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mclassifier\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrip_descr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcandidate_labels\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 15\u001b[0m classes \u001b[38;5;241m=\u001b[39m result[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28mprint\u001b[39m(result)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:206\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline.__call__\u001b[0;34m(self, sequences, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to understand extra arguments \u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msequences\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1294\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miterate(inputs, preprocess_params, forward_params, postprocess_params)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mframework \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpt\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ChunkPipeline):\n\u001b[0;32m-> 1294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1295\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43miter\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1296\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_iterator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1297\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43minputs\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnum_workers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbatch_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpreprocess_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforward_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostprocess_params\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:124\u001b[0m, in \u001b[0;36mPipelineIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_item()\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# We're out of items within a batch\u001b[39;00m\n\u001b[0;32m--> 124\u001b[0m item \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfer(item, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparams)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;66;03m# We now have a batch of \"inferred things\".\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:269\u001b[0m, in \u001b[0;36mPipelinePackIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m accumulator\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_last:\n\u001b[0;32m--> 269\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(processed, torch\u001b[38;5;241m.\u001b[39mTensor):\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1209\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1207\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1208\u001b[0m model_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdevice)\n\u001b[0;32m-> 1209\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mforward_params\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mdevice(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcpu\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 1211\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:229\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline._forward\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(model_forward)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 228\u001b[0m model_inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 229\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 231\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 232\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcandidate_label\u001b[39m\u001b[38;5;124m\"\u001b[39m: candidate_label,\n\u001b[1;32m 233\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msequence\u001b[39m\u001b[38;5;124m\"\u001b[39m: sequence,\n\u001b[1;32m 234\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m: inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 235\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moutputs,\n\u001b[1;32m 236\u001b[0m }\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m model_outputs\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1297\u001b[0m, in \u001b[0;36mDebertaV2ForSequenceClassification.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1289\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;124;03mlabels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;124;03m Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,\u001b[39;00m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;124;03m config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If\u001b[39;00m\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;124;03m `config.num_labels > 1` a classification loss is computed (Cross-Entropy).\u001b[39;00m\n\u001b[1;32m 1294\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1295\u001b[0m return_dict \u001b[38;5;241m=\u001b[39m return_dict \u001b[38;5;28;01mif\u001b[39;00m return_dict \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39muse_return_dict\n\u001b[0;32m-> 1297\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeberta\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken_type_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken_type_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[43m \u001b[49m\u001b[43mposition_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mposition_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1302\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1303\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1304\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1305\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1306\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1308\u001b[0m encoder_layer \u001b[38;5;241m=\u001b[39m outputs[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1309\u001b[0m pooled_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpooler(encoder_layer)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1063\u001b[0m, in \u001b[0;36mDebertaV2Model.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1053\u001b[0m token_type_ids \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mzeros(input_shape, dtype\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mlong, device\u001b[38;5;241m=\u001b[39mdevice)\n\u001b[1;32m 1055\u001b[0m embedding_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39membeddings(\n\u001b[1;32m 1056\u001b[0m input_ids\u001b[38;5;241m=\u001b[39minput_ids,\n\u001b[1;32m 1057\u001b[0m token_type_ids\u001b[38;5;241m=\u001b[39mtoken_type_ids,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1060\u001b[0m inputs_embeds\u001b[38;5;241m=\u001b[39minputs_embeds,\n\u001b[1;32m 1061\u001b[0m )\n\u001b[0;32m-> 1063\u001b[0m encoder_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1064\u001b[0m \u001b[43m \u001b[49m\u001b[43membedding_output\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1065\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1066\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 1067\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1068\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1069\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1070\u001b[0m encoded_layers \u001b[38;5;241m=\u001b[39m encoder_outputs[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 1072\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_steps \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:507\u001b[0m, in \u001b[0;36mDebertaV2Encoder.forward\u001b[0;34m(self, hidden_states, attention_mask, output_hidden_states, output_attentions, query_states, relative_pos, return_dict)\u001b[0m\n\u001b[1;32m 497\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_gradient_checkpointing_func(\n\u001b[1;32m 498\u001b[0m layer_module\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__call__\u001b[39m,\n\u001b[1;32m 499\u001b[0m next_kv,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 504\u001b[0m output_attentions,\n\u001b[1;32m 505\u001b[0m )\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 507\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[43mlayer_module\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 508\u001b[0m \u001b[43m \u001b[49m\u001b[43mnext_kv\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 510\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 511\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 512\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 513\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 514\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 517\u001b[0m output_states, att_m \u001b[38;5;241m=\u001b[39m output_states\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:366\u001b[0m, in \u001b[0;36mDebertaV2Layer.forward\u001b[0;34m(self, hidden_states, attention_mask, query_states, relative_pos, rel_embeddings, output_attentions)\u001b[0m\n\u001b[1;32m 364\u001b[0m attention_output, att_matrix \u001b[38;5;241m=\u001b[39m attention_output\n\u001b[1;32m 365\u001b[0m intermediate_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mintermediate(attention_output)\n\u001b[0;32m--> 366\u001b[0m layer_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moutput\u001b[49m\u001b[43m(\u001b[49m\u001b[43mintermediate_output\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mattention_output\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 367\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 368\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (layer_output, att_matrix)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:332\u001b[0m, in \u001b[0;36mDebertaV2Output.forward\u001b[0;34m(self, hidden_states, input_tensor)\u001b[0m\n\u001b[1;32m 331\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, hidden_states, input_tensor):\n\u001b[0;32m--> 332\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdense\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 333\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdropout(hidden_states)\n\u001b[1;32m 334\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mLayerNorm(hidden_states \u001b[38;5;241m+\u001b[39m input_tensor)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/linear.py:116\u001b[0m, in \u001b[0;36mLinear.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m: Tensor) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Tensor:\n\u001b[0;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mF\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinear\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mweight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbias\u001b[49m\u001b[43m)\u001b[49m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[60], line 13\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 12\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n\u001b[0;32m---> 13\u001b[0m performance \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mconcat([performance, \u001b[43mperf_measure\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf\u001b[49m\u001b[43m)\u001b[49m])\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28mprint\u001b[39m(performance)\n\u001b[1;32m 16\u001b[0m result_list\u001b[38;5;241m.\u001b[39mappend(df)\n", + "Cell \u001b[0;32mIn[59], line 14\u001b[0m, in \u001b[0;36mperf_measure\u001b[0;34m(df)\u001b[0m\n\u001b[1;32m 12\u001b[0m correct_perc \u001b[38;5;241m=\u001b[39m num_correct\u001b[38;5;241m/\u001b[39m\u001b[38;5;28mlen\u001b[39m(true_class)\n\u001b[1;32m 13\u001b[0m num_pred \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(pred_class)\n\u001b[0;32m---> 14\u001b[0m wrong_perc \u001b[38;5;241m=\u001b[39m \u001b[43m(\u001b[49m\u001b[43mnum_pred\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mnum_correct\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43mnum_pred\u001b[49m\n\u001b[1;32m 15\u001b[0m df_perf \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mDataFrame({\n\u001b[1;32m 16\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124maccuracy\u001b[39m\u001b[38;5;124m'\u001b[39m: [accuracy],\n\u001b[1;32m 17\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtrue_ident\u001b[39m\u001b[38;5;124m'\u001b[39m: [correct_perc],\n\u001b[1;32m 18\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfalse_pred\u001b[39m\u001b[38;5;124m'\u001b[39m: [wrong_perc]\n\u001b[1;32m 19\u001b[0m })\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m(df_perf)\n", + "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" ] } ], "source": [ "result_list = []\n", "performance = pd.DataFrame(columns=['accuracy', 'true_ident', 'false_pred'])\n", - " \n", + "\n", + "start_time = time.time()\n", + "\n", "for i in range(len(trip_descriptions)):\n", " current_trip = trip_descriptions[i]\n", " current_type = trip_types[i]\n", @@ -340,7 +244,11 @@ " performance = pd.concat([performance, perf_measure(df)])\n", " print(performance)\n", " \n", - " result_list.append(df)" + " result_list.append(df)\n", + "\n", + "end_time = time.time()\n", + "\n", + "elapsed_time = end_time - start_time" ] }, { @@ -353,10 +261,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 61, "id": "eb33fd31-94e6-40b5-9c36-a32effe77c01", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[61], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Extract \"same_value\" column from each DataFrame\u001b[39;00m\n\u001b[1;32m 2\u001b[0m sv_columns \u001b[38;5;241m=\u001b[39m [df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msame_value\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m df \u001b[38;5;129;01min\u001b[39;00m result_list] \u001b[38;5;66;03m# 'same' needs to be changed\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m sv_columns\u001b[38;5;241m.\u001b[39minsert(\u001b[38;5;241m0\u001b[39m, \u001b[43mresult_list\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msuperclass\u001b[39m\u001b[38;5;124m'\u001b[39m])\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Combine into a new DataFrame (columns side-by-side)\u001b[39;00m\n\u001b[1;32m 6\u001b[0m sv_df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mconcat(sv_columns, axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m)\n", + "\u001b[0;31mIndexError\u001b[0m: list index out of range" + ] + } + ], "source": [ "# Extract \"same_value\" column from each DataFrame\n", "sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", @@ -370,10 +290,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 62, "id": "bf7546cb-79ce-49ad-8cee-54d02239220c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.8\n", + "5 accommodation 0.8\n", + "6 transportation 0.7\n", + "7 special_conditions 0.2\n", + "8 trip_length_days 0.6\n" + ] + } + ], "source": [ "# Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", "row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", @@ -413,15 +350,14 @@ "outputs": [], "source": [ "# save results\n", - "# Example data for one model\n", - "model_name = 'model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli'\n", "# Structure to save\n", "model_result = {\n", " 'model': model_name,\n", " 'predictions': result_list,\n", " 'performance': performance,\n", " 'perf_summary': column_means,\n", - " 'perf_superclass': df_row_means\n", + " 'perf_superclass': df_row_means,\n", + " 'elapsed_time': elapsed_time\n", "}\n", "\n", "# File path with folder\n", @@ -432,6 +368,16 @@ " pickle.dump(model_result, f)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "f38d0924-30b6-43cd-9bfc-fe5b0dc80411", + "metadata": {}, + "outputs": [], + "source": [ + "print(elapsed_time/60)" + ] + }, { "cell_type": "markdown", "id": "e1cbb54e-abe6-49b6-957e-0683196f3199", @@ -442,14 +388,23 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 54, "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Model: model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.841667\n", + "false_pred 0.572381\n", + "dtype: float64\n", + "----------------------------------------\n", "Model: model_a_facebook-bart-large-mnli\n", "Performance Summary:\n", "accuracy 0.454545\n", @@ -464,6 +419,19 @@ "false_pred 0.551667\n", "dtype: float64\n", "----------------------------------------\n", + "Model: model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.8\n", + "5 accommodation 0.8\n", + "6 transportation 0.7\n", + "7 special_conditions 0.2\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", "Model: model_a_facebook-bart-large-mnli\n", "Performance Summary:\n", " superclass accuracy\n", @@ -511,20 +479,57 @@ " result = pickle.load(f)\n", " all_results[model_name] = result\n", "\n", - "# Now you can compare performance across models\n", + "# Compare performance across models\n", "for model, data in all_results.items():\n", " print(f\"Model: {model}\")\n", " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", " print(\"-\" * 40)\n", "\n", "\n", - "# Now you can compare performance across models\n", + "# Compare performance across models\n", "for model, data in all_results.items():\n", " print(f\"Model: {model}\")\n", " print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", " print(\"-\" * 40)" ] }, + { + "cell_type": "code", + "execution_count": 69, + "id": "57fd150d-1cda-4be5-806b-ef380469243a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Time in minutes for 10 trips:\n", + "83.45150986512502\n", + "----------------------------------------\n", + "Model: model_a_facebook-bart-large-mnli\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'elapsed_time'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[69], line 4\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m model, data \u001b[38;5;129;01min\u001b[39;00m all_results\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mModel: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodel\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mTime in minutes for 10 trips:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;132;01m{\u001b[39;00mdata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124melapsed_time\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m60\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m40\u001b[39m)\n", + "\u001b[0;31mKeyError\u001b[0m: 'elapsed_time'" + ] + } + ], + "source": [ + "# Compare across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Time in minutes for 10 trips:\\n{data['elapsed_time']/60}\")\n", + " print(\"-\" * 40)" + ] + }, { "cell_type": "markdown", "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", diff --git a/space/space/space/space/gradio_tryout.ipynb b/space/space/space/space/gradio_tryout.ipynb index fde7eaf2f24c4dda9de0cba61ffdf3dcfe0fcdbc..c2824851ceaec67fcffb77be40e91bb4d946bb6d 100644 --- a/space/space/space/space/gradio_tryout.ipynb +++ b/space/space/space/space/gradio_tryout.ipynb @@ -19,12 +19,12 @@ "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", "metadata": {}, "source": [ - "**Load and try the model**" + "**Load prerequisites**" ] }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 57, "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", "metadata": {}, "outputs": [ @@ -57,8 +57,11 @@ "import time\n", "\n", "# Load the model and create a pipeline for zero-shot classification (1min loading + classifying with 89 labels)\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\")\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"cross-encoder/nli-deberta-v3-base\")\n", + "model_name = 'model_cross-encoder-nli-deberta-v3-base'\n", "# tried:\n", + "# cross-encoder/nli-deberta-v3-large gave error\n", + "# MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\n", "# facebook/bart-large-mnli\n", "# sileod/deberta-v3-base-tasksource-nli\n", "\n", @@ -85,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 58, "id": "3a762755-872d-43a6-b666-874d6133488c", "metadata": {}, "outputs": [], @@ -115,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 59, "id": "3b4f3193-3bdd-453c-8664-df84f955600c", "metadata": {}, "outputs": [], @@ -152,60 +155,53 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 60, "id": "4dd01755-be8d-4904-8494-ac28aba2fee7", "metadata": { "scrolled": true }, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" - ] - }, { "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'cultural exploration', 'nature escape', 'digital nomad trip', 'camping trip (campground)', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'ski tour / skitour', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'road trip (car/camper)', 'festival trip', 'yoga / wellness retreat', 'snowboard / splitboard trip'], 'scores': [0.37198853492736816, 0.31496119499206543, 0.10890532284975052, 0.09102731198072433, 0.0735681876540184, 0.012933704070746899, 0.009422042407095432, 0.0051276967860758305, 0.004056071396917105, 0.0017408831045031548, 0.001503779087215662, 0.0014244643971323967, 0.0013752576196566224, 0.0009292717440985143, 0.0006881792796775699, 0.0003480584127828479]}\n", - "beach vacation\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['micro-adventure / weekend trip', 'digital nomad trip', 'beach vacation', 'festival trip', 'city trip', 'cultural exploration', 'road trip (car/camper)', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'hut trek (winter)', 'ski tour / skitour', 'snowboard / splitboard trip', 'nature escape', 'yoga / wellness retreat', 'hut trek (summer)', 'camping trip (campground)'], 'scores': [0.9722680449485779, 0.007802918087691069, 0.0075571718625724316, 0.0022959215566515923, 0.0021305829286575317, 0.001222927705384791, 0.0009879637509584427, 0.000805296644102782, 0.0007946204277686775, 0.0007107199053280056, 0.0007009899127297103, 0.0006353880744427443, 0.0005838185315951705, 0.0005424902774393559, 0.0004807499353773892, 0.0004804217896889895]}\n", + "micro-adventure / weekend trip\n", "0\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['relaxing', 'hiking', 'going to the beach', 'photography', 'sightseeing', 'hut-to-hut hiking', 'snorkeling', 'snowshoe hiking', 'yoga', 'stand-up paddleboarding (SUP)', 'kayaking / canoeing', 'horseback riding', 'swimming', 'paragliding', 'rafting', 'biking', 'rock climbing', 'surfing', 'running', 'ice climbing', 'cross-country skiing', 'fishing', 'ski touring', 'skiing', 'scuba diving'], 'scores': [0.9943736791610718, 0.9631249308586121, 0.9454535841941833, 0.7538902759552002, 0.4525446593761444, 0.1696157604455948, 0.05957728251814842, 0.04234873503446579, 0.01991761103272438, 0.016971556469798088, 0.006959819234907627, 0.00411367928609252, 0.0030609173700213432, 0.00186573073733598, 0.0017515394138172269, 0.00142807571683079, 0.0005748369731009007, 0.00037779140984639525, 0.0003097739245276898, 0.00030914091621525586, 0.0002725012309383601, 0.00027050732751376927, 0.00024376016517635435, 0.00017392759036738425, 0.00014787293912377208]}\n", - "['relaxing', 'hiking', 'going to the beach', 'photography']\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'sightseeing', 'relaxing', 'hiking', 'hut-to-hut hiking', 'stand-up paddleboarding (SUP)', 'photography', 'biking', 'running', 'ski touring', 'snowshoe hiking', 'yoga', 'kayaking / canoeing', 'horseback riding', 'rafting', 'paragliding', 'cross-country skiing', 'surfing', 'skiing', 'ice climbing', 'fishing', 'snorkeling', 'swimming', 'rock climbing', 'scuba diving'], 'scores': [0.4660525321960449, 0.007281942293047905, 0.003730606520548463, 0.0001860307966126129, 0.00014064949937164783, 0.00011034693307010457, 5.2949126256862655e-05, 3.828677654382773e-05, 3.396756437723525e-05, 1.5346524378401227e-05, 9.348185812996235e-06, 8.182429155567661e-06, 6.5973340497293975e-06, 6.271920938161202e-06, 5.544673058466287e-06, 5.299102667777333e-06, 4.855380211665761e-06, 4.506250661506783e-06, 3.949530764657538e-06, 3.730233856913401e-06, 3.297281637060223e-06, 3.0508665531669976e-06, 2.933618134193239e-06, 2.6379277642263332e-06, 2.2992651338427095e-06]}\n", + "[]\n", "1\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['tropical / humid', 'warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.4895477890968323, 0.25917261838912964, 0.24829530715942383, 0.0017174285603687167, 0.0012668712297454476]}\n", - "tropical / humid\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'cold destination / winter', 'dry / desert-like', 'tropical / humid'], 'scores': [0.5934922695159912, 0.17430798709392548, 0.10943299531936646, 0.07068652659654617, 0.05208020657300949]}\n", + "variable weather / spring / autumn\n", "2\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight'], 'scores': [0.7574900984764099, 0.09964746236801147, 0.07804173231124878, 0.06482075154781342]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'luxury (including evening wear)', 'lightweight (but comfortable)'], 'scores': [0.6965053081512451, 0.11270010471343994, 0.10676420480012894, 0.08403033763170242]}\n", "minimalist\n", "3\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8163393139839172, 0.11898067593574524, 0.06467998772859573]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'formal (business trip)', 'conservative'], 'scores': [0.6362482309341431, 0.22082458436489105, 0.14292724430561066]}\n", "casual\n", "4\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.6389047503471375, 0.18624886870384216, 0.13902997970581055, 0.03581654652953148]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['indoor', 'sleeping in a tent', 'huts with half board', 'sleeping in a car'], 'scores': [0.435793399810791, 0.20242486894130707, 0.19281964004039764, 0.16896207630634308]}\n", "indoor\n", "5\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9990958571434021, 0.0009041387238539755]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9987181425094604, 0.0012818538816645741]}\n", "no own vehicle\n", "6\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'child-friendly', 'no special conditions', 'pet-friendly', 'rainy climate', 'avalanche-prone terrain', 'high alpine terrain', 'snow and ice'], 'scores': [0.7414510250091553, 0.07683143764734268, 0.055722303688526154, 0.054133761674165726, 0.04852374270558357, 0.006977608893066645, 0.005693929269909859, 0.005599685944616795, 0.005066512618213892]}\n", - "off-grid / no electricity\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['self-supported (bring your own food/cooking)', 'no special conditions', 'off-grid / no electricity', 'rainy climate', 'child-friendly', 'snow and ice', 'pet-friendly', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.1984991431236267, 0.1695038080215454, 0.16221018135547638, 0.13200421631336212, 0.12101645022630692, 0.10550825297832489, 0.042406272143125534, 0.03797775134444237, 0.030873913317918777]}\n", + "self-supported (bring your own food/cooking)\n", "7\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '7 days', '3 days', '4 days', '6 days', '5 days', '1 day'], 'scores': [0.29225289821624756, 0.20232954621315002, 0.1837582290172577, 0.13940994441509247, 0.06562349200248718, 0.04916509613394737, 0.040249694138765335, 0.0272111464291811]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '7 days', '5 days', '3 days', '6 days', '4 days'], 'scores': [0.4730822443962097, 0.1168912723660469, 0.10058756172657013, 0.0991850346326828, 0.05424537882208824, 0.053677864372730255, 0.051554784178733826, 0.050775907933712006]}\n", "7+ days\n", "8\n", - " superclass pred_class \\\n", - "0 activity_type beach vacation \n", - "1 activities [relaxing, hiking, going to the beach, photogr... \n", - "2 climate_or_season tropical / humid \n", - "3 style_or_comfort minimalist \n", - "4 dress_code casual \n", - "5 accommodation indoor \n", - "6 transportation no own vehicle \n", - "7 special_conditions off-grid / no electricity \n", - "8 trip_length_days 7+ days \n", + " superclass pred_class \\\n", + "0 activity_type micro-adventure / weekend trip \n", + "1 activities [] \n", + "2 climate_or_season variable weather / spring / autumn \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation no own vehicle \n", + "7 special_conditions self-supported (bring your own food/cooking) \n", + "8 trip_length_days 7+ days \n", "\n", " true_class \n", "0 beach vacation \n", @@ -216,51 +212,19 @@ "5 indoor \n", "6 no own vehicle \n", "7 no special conditions \n", - "8 7+ days \n", - " accuracy true_ident false_pred\n", - "0 0.555556 0.75 0.25\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'cultural exploration', 'micro-adventure / weekend trip', 'ski tour / skitour', 'festival trip', 'digital nomad trip', 'hut trek (winter)', 'camping trip (campground)', 'long-distance hike / thru-hike', 'hut trek (summer)', 'nature escape', 'camping trip (wild camping)', 'yoga / wellness retreat', 'road trip (car/camper)', 'beach vacation', 'snowboard / splitboard trip'], 'scores': [0.517789363861084, 0.297355592250824, 0.1621870994567871, 0.006185388192534447, 0.005294559057801962, 0.002764208009466529, 0.001503965351730585, 0.0014866390265524387, 0.0012240204960107803, 0.0012071850942447782, 0.000757778063416481, 0.0006650012801401317, 0.0005547589971683919, 0.00043604226084426045, 0.00031738984398543835, 0.0002710542466957122]}\n", - "city trip\n", - "0\n" + "8 7+ days \n" ] }, { - "ename": "KeyboardInterrupt", - "evalue": "", + "ename": "ZeroDivisionError", + "evalue": "division by zero", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[43], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m current_trip \u001b[38;5;241m=\u001b[39m trip_descriptions[i]\n\u001b[1;32m 6\u001b[0m current_type \u001b[38;5;241m=\u001b[39m trip_types[i]\n\u001b[0;32m----> 7\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpred_trip\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcurrent_trip\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcut_off\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n", - "Cell \u001b[0;32mIn[41], line 10\u001b[0m, in \u001b[0;36mpred_trip\u001b[0;34m(trip_descr, trip_type, cut_off)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, key \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(keys_list):\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mactivities\u001b[39m\u001b[38;5;124m'\u001b[39m:\n\u001b[0;32m---> 10\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mclassifier\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrip_descr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcandidate_labels\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmulti_label\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 11\u001b[0m indices \u001b[38;5;241m=\u001b[39m [i \u001b[38;5;28;01mfor\u001b[39;00m i, score \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mscores\u001b[39m\u001b[38;5;124m'\u001b[39m]) \u001b[38;5;28;01mif\u001b[39;00m score \u001b[38;5;241m>\u001b[39m cut_off]\n\u001b[1;32m 12\u001b[0m classes \u001b[38;5;241m=\u001b[39m [result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m'\u001b[39m][i] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m indices]\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:206\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline.__call__\u001b[0;34m(self, sequences, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to understand extra arguments \u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msequences\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1294\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miterate(inputs, preprocess_params, forward_params, postprocess_params)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mframework \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpt\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ChunkPipeline):\n\u001b[0;32m-> 1294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1295\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43miter\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1296\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_iterator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1297\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43minputs\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnum_workers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbatch_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpreprocess_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforward_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostprocess_params\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:124\u001b[0m, in \u001b[0;36mPipelineIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_item()\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# We're out of items within a batch\u001b[39;00m\n\u001b[0;32m--> 124\u001b[0m item \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfer(item, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparams)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;66;03m# We now have a batch of \"inferred things\".\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:269\u001b[0m, in \u001b[0;36mPipelinePackIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m accumulator\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_last:\n\u001b[0;32m--> 269\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(processed, torch\u001b[38;5;241m.\u001b[39mTensor):\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1209\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1207\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1208\u001b[0m model_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdevice)\n\u001b[0;32m-> 1209\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mforward_params\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mdevice(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcpu\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 1211\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:229\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline._forward\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(model_forward)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 228\u001b[0m model_inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 229\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 231\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 232\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcandidate_label\u001b[39m\u001b[38;5;124m\"\u001b[39m: candidate_label,\n\u001b[1;32m 233\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msequence\u001b[39m\u001b[38;5;124m\"\u001b[39m: sequence,\n\u001b[1;32m 234\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m: inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 235\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moutputs,\n\u001b[1;32m 236\u001b[0m }\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m model_outputs\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1297\u001b[0m, in \u001b[0;36mDebertaV2ForSequenceClassification.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1289\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;124;03mlabels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;124;03m Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,\u001b[39;00m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;124;03m config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If\u001b[39;00m\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;124;03m `config.num_labels > 1` a classification loss is computed (Cross-Entropy).\u001b[39;00m\n\u001b[1;32m 1294\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1295\u001b[0m return_dict \u001b[38;5;241m=\u001b[39m return_dict \u001b[38;5;28;01mif\u001b[39;00m return_dict \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39muse_return_dict\n\u001b[0;32m-> 1297\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeberta\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken_type_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken_type_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[43m \u001b[49m\u001b[43mposition_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mposition_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1302\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1303\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1304\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1305\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1306\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1308\u001b[0m encoder_layer \u001b[38;5;241m=\u001b[39m outputs[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1309\u001b[0m pooled_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpooler(encoder_layer)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1063\u001b[0m, in \u001b[0;36mDebertaV2Model.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1053\u001b[0m token_type_ids \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mzeros(input_shape, dtype\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mlong, device\u001b[38;5;241m=\u001b[39mdevice)\n\u001b[1;32m 1055\u001b[0m embedding_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39membeddings(\n\u001b[1;32m 1056\u001b[0m input_ids\u001b[38;5;241m=\u001b[39minput_ids,\n\u001b[1;32m 1057\u001b[0m token_type_ids\u001b[38;5;241m=\u001b[39mtoken_type_ids,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1060\u001b[0m inputs_embeds\u001b[38;5;241m=\u001b[39minputs_embeds,\n\u001b[1;32m 1061\u001b[0m )\n\u001b[0;32m-> 1063\u001b[0m encoder_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1064\u001b[0m \u001b[43m \u001b[49m\u001b[43membedding_output\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1065\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1066\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 1067\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1068\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1069\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1070\u001b[0m encoded_layers \u001b[38;5;241m=\u001b[39m encoder_outputs[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 1072\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_steps \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:507\u001b[0m, in \u001b[0;36mDebertaV2Encoder.forward\u001b[0;34m(self, hidden_states, attention_mask, output_hidden_states, output_attentions, query_states, relative_pos, return_dict)\u001b[0m\n\u001b[1;32m 497\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_gradient_checkpointing_func(\n\u001b[1;32m 498\u001b[0m layer_module\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__call__\u001b[39m,\n\u001b[1;32m 499\u001b[0m next_kv,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 504\u001b[0m output_attentions,\n\u001b[1;32m 505\u001b[0m )\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 507\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[43mlayer_module\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 508\u001b[0m \u001b[43m \u001b[49m\u001b[43mnext_kv\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 510\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 511\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 512\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 513\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 514\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 517\u001b[0m output_states, att_m \u001b[38;5;241m=\u001b[39m output_states\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:355\u001b[0m, in \u001b[0;36mDebertaV2Layer.forward\u001b[0;34m(self, hidden_states, attention_mask, query_states, relative_pos, rel_embeddings, output_attentions)\u001b[0m\n\u001b[1;32m 346\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 348\u001b[0m hidden_states,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 353\u001b[0m output_attentions\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[1;32m 354\u001b[0m ):\n\u001b[0;32m--> 355\u001b[0m attention_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mattention\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 356\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 357\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 358\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 359\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 360\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 361\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 362\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 363\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 364\u001b[0m attention_output, att_matrix \u001b[38;5;241m=\u001b[39m attention_output\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:286\u001b[0m, in \u001b[0;36mDebertaV2Attention.forward\u001b[0;34m(self, hidden_states, attention_mask, output_attentions, query_states, relative_pos, rel_embeddings)\u001b[0m\n\u001b[1;32m 277\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\n\u001b[1;32m 278\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 279\u001b[0m hidden_states,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 284\u001b[0m rel_embeddings\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 285\u001b[0m ):\n\u001b[0;32m--> 286\u001b[0m self_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mself\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 287\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 288\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 289\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 290\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 291\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 292\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 293\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 295\u001b[0m self_output, att_matrix \u001b[38;5;241m=\u001b[39m self_output\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:700\u001b[0m, in \u001b[0;36mDisentangledSelfAttention.forward\u001b[0;34m(self, hidden_states, attention_mask, output_attentions, query_states, relative_pos, rel_embeddings)\u001b[0m\n\u001b[1;32m 698\u001b[0m query_states \u001b[38;5;241m=\u001b[39m hidden_states\n\u001b[1;32m 699\u001b[0m query_layer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtranspose_for_scores(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquery_proj(query_states), \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_attention_heads)\n\u001b[0;32m--> 700\u001b[0m key_layer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtranspose_for_scores(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey_proj\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m)\u001b[49m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_attention_heads)\n\u001b[1;32m 701\u001b[0m value_layer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtranspose_for_scores(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvalue_proj(hidden_states), \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_attention_heads)\n\u001b[1;32m 703\u001b[0m rel_att \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/linear.py:116\u001b[0m, in \u001b[0;36mLinear.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m: Tensor) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Tensor:\n\u001b[0;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mF\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinear\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mweight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbias\u001b[49m\u001b[43m)\u001b[49m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[60], line 13\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 12\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n\u001b[0;32m---> 13\u001b[0m performance \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mconcat([performance, \u001b[43mperf_measure\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf\u001b[49m\u001b[43m)\u001b[49m])\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28mprint\u001b[39m(performance)\n\u001b[1;32m 16\u001b[0m result_list\u001b[38;5;241m.\u001b[39mappend(df)\n", + "Cell \u001b[0;32mIn[59], line 14\u001b[0m, in \u001b[0;36mperf_measure\u001b[0;34m(df)\u001b[0m\n\u001b[1;32m 12\u001b[0m correct_perc \u001b[38;5;241m=\u001b[39m num_correct\u001b[38;5;241m/\u001b[39m\u001b[38;5;28mlen\u001b[39m(true_class)\n\u001b[1;32m 13\u001b[0m num_pred \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(pred_class)\n\u001b[0;32m---> 14\u001b[0m wrong_perc \u001b[38;5;241m=\u001b[39m \u001b[43m(\u001b[49m\u001b[43mnum_pred\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mnum_correct\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43mnum_pred\u001b[49m\n\u001b[1;32m 15\u001b[0m df_perf \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mDataFrame({\n\u001b[1;32m 16\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124maccuracy\u001b[39m\u001b[38;5;124m'\u001b[39m: [accuracy],\n\u001b[1;32m 17\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtrue_ident\u001b[39m\u001b[38;5;124m'\u001b[39m: [correct_perc],\n\u001b[1;32m 18\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfalse_pred\u001b[39m\u001b[38;5;124m'\u001b[39m: [wrong_perc]\n\u001b[1;32m 19\u001b[0m })\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m(df_perf)\n", + "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" ] } ], @@ -269,6 +233,7 @@ "performance = pd.DataFrame(columns=['accuracy', 'true_ident', 'false_pred'])\n", "\n", "start_time = time.time()\n", + "\n", "for i in range(len(trip_descriptions)):\n", " current_trip = trip_descriptions[i]\n", " current_type = trip_types[i]\n", @@ -279,7 +244,11 @@ " performance = pd.concat([performance, perf_measure(df)])\n", " print(performance)\n", " \n", - " result_list.append(df)" + " result_list.append(df)\n", + "\n", + "end_time = time.time()\n", + "\n", + "elapsed_time = end_time - start_time" ] }, { @@ -292,10 +261,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 61, "id": "eb33fd31-94e6-40b5-9c36-a32effe77c01", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[61], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Extract \"same_value\" column from each DataFrame\u001b[39;00m\n\u001b[1;32m 2\u001b[0m sv_columns \u001b[38;5;241m=\u001b[39m [df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msame_value\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m df \u001b[38;5;129;01min\u001b[39;00m result_list] \u001b[38;5;66;03m# 'same' needs to be changed\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m sv_columns\u001b[38;5;241m.\u001b[39minsert(\u001b[38;5;241m0\u001b[39m, \u001b[43mresult_list\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msuperclass\u001b[39m\u001b[38;5;124m'\u001b[39m])\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Combine into a new DataFrame (columns side-by-side)\u001b[39;00m\n\u001b[1;32m 6\u001b[0m sv_df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mconcat(sv_columns, axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m)\n", + "\u001b[0;31mIndexError\u001b[0m: list index out of range" + ] + } + ], "source": [ "# Extract \"same_value\" column from each DataFrame\n", "sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", @@ -309,10 +290,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 62, "id": "bf7546cb-79ce-49ad-8cee-54d02239220c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.8\n", + "5 accommodation 0.8\n", + "6 transportation 0.7\n", + "7 special_conditions 0.2\n", + "8 trip_length_days 0.6\n" + ] + } + ], "source": [ "# Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", "row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", @@ -352,15 +350,14 @@ "outputs": [], "source": [ "# save results\n", - "# Example data for one model\n", - "model_name = 'model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli'\n", "# Structure to save\n", "model_result = {\n", " 'model': model_name,\n", " 'predictions': result_list,\n", " 'performance': performance,\n", " 'perf_summary': column_means,\n", - " 'perf_superclass': df_row_means\n", + " 'perf_superclass': df_row_means,\n", + " 'elapsed_time': elapsed_time\n", "}\n", "\n", "# File path with folder\n", @@ -371,6 +368,16 @@ " pickle.dump(model_result, f)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "f38d0924-30b6-43cd-9bfc-fe5b0dc80411", + "metadata": {}, + "outputs": [], + "source": [ + "print(elapsed_time/60)" + ] + }, { "cell_type": "markdown", "id": "e1cbb54e-abe6-49b6-957e-0683196f3199", @@ -381,14 +388,23 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 54, "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Model: model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + "accuracy 0.522222\n", + "true_ident 0.841667\n", + "false_pred 0.572381\n", + "dtype: float64\n", + "----------------------------------------\n", "Model: model_a_facebook-bart-large-mnli\n", "Performance Summary:\n", "accuracy 0.454545\n", @@ -403,6 +419,19 @@ "false_pred 0.551667\n", "dtype: float64\n", "----------------------------------------\n", + "Model: model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.5\n", + "3 style_or_comfort 0.3\n", + "4 dress_code 0.8\n", + "5 accommodation 0.8\n", + "6 transportation 0.7\n", + "7 special_conditions 0.2\n", + "8 trip_length_days 0.6\n", + "----------------------------------------\n", "Model: model_a_facebook-bart-large-mnli\n", "Performance Summary:\n", " superclass accuracy\n", @@ -450,20 +479,57 @@ " result = pickle.load(f)\n", " all_results[model_name] = result\n", "\n", - "# Now you can compare performance across models\n", + "# Compare performance across models\n", "for model, data in all_results.items():\n", " print(f\"Model: {model}\")\n", " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", " print(\"-\" * 40)\n", "\n", "\n", - "# Now you can compare performance across models\n", + "# Compare performance across models\n", "for model, data in all_results.items():\n", " print(f\"Model: {model}\")\n", " print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", " print(\"-\" * 40)" ] }, + { + "cell_type": "code", + "execution_count": 69, + "id": "57fd150d-1cda-4be5-806b-ef380469243a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli\n", + "Time in minutes for 10 trips:\n", + "83.45150986512502\n", + "----------------------------------------\n", + "Model: model_a_facebook-bart-large-mnli\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'elapsed_time'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[69], line 4\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m model, data \u001b[38;5;129;01min\u001b[39;00m all_results\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mModel: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodel\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m----> 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mTime in minutes for 10 trips:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;132;01m{\u001b[39;00mdata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124melapsed_time\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m60\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m40\u001b[39m)\n", + "\u001b[0;31mKeyError\u001b[0m: 'elapsed_time'" + ] + } + ], + "source": [ + "# Compare across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Time in minutes for 10 trips:\\n{data['elapsed_time']/60}\")\n", + " print(\"-\" * 40)" + ] + }, { "cell_type": "markdown", "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", diff --git a/space/space/space/space/packing_label_structure.json b/space/space/space/space/packing_label_structure.json index 0de6fb1915aeab9ad590056645801c629cf88a23..459bbb0ef340ee13dcdc3858c7b580ff77bdeb28 100644 --- a/space/space/space/space/packing_label_structure.json +++ b/space/space/space/space/packing_label_structure.json @@ -49,7 +49,8 @@ "warm destination / summer", "variable weather / spring / autumn", "tropical / humid", - "dry / desert-like" + "dry / desert-like", + "rainy climate" ], "style_or_comfort": [ "ultralight", @@ -74,14 +75,13 @@ ], "special_conditions": [ "off-grid / no electricity", - "self-supported (bring your own food/cooking)", - "child-friendly", + "self-supported (bring your own cooking gear)", + "travel with children", "pet-friendly", - "rainy climate", "snow and ice", "high alpine terrain", - "avalanche-prone terrain", - "no special conditions" + "snow, ice and avalanche-prone terrain", + "no special conditions to consider" ], "trip_length_days": [ "1 day", diff --git a/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json b/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json index df7ab8786dde92d3a617243101aa791cc98db5ba..00628832ac08f03085def79d5532f14526016cba 100644 --- a/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json +++ b/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json @@ -535,7 +535,7 @@ "USB-hub (voor meerdere devices)", "verpakking om elektronica droog te houden" ], - "self-supported (bring your own food/cooking)": [ + "self-supported (bring your own cooking gear)": [ "lichtgewicht kooktoestel (gas, benzine of alcohol)", "brandstof (voldoende voor aantal dagen)", "pan of keteltje", @@ -552,7 +552,7 @@ "minstens 2 liter wateropslag per persoon", "food bag of hangzak voor voedsel (wild-safe)" ], - "child-friendly": [ + "travel with children": [ "snacks en speelgoed", "EHBO-set met pleisters", "extra kleding", @@ -606,7 +606,7 @@ "extra voeding", "EHBO-kit" ], - "avalanche-prone terrain": [ + "snow, ice and avalanche-prone terrain": [ "lawinepieper", "schep", "sonde", diff --git a/space/space/space/space/results/model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl b/space/space/space/space/results/model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..a3e9a95985adca48d25f77b8a79695403b6af8bc --- /dev/null +++ b/space/space/space/space/results/model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd1d8f5ed1d8b9a0878aa0e99fa144341c27d48bcf71d77390e28951e4936149 +size 9539 diff --git a/space/space/space/space/space/results/model_b_sileod-deberta-v3-base-tasksource-nli_results.pkl b/space/space/space/space/space/results/model_b_sileod-deberta-v3-base-tasksource-nli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..7835955300aa371df8116e81048ecc668867381e --- /dev/null +++ b/space/space/space/space/space/results/model_b_sileod-deberta-v3-base-tasksource-nli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98f1217c7add9665e814d4ef90a8e1a60e33d53ea81c6c98472bc652aa11ee56 +size 9461 diff --git a/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb b/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb index d6a4fe714db93ed6bb9e29fa72c738e0e4cbbd48..85420852989fd29e5b51c59357ad16b90b56fd8f 100644 --- a/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb +++ b/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb @@ -24,10 +24,108 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 36, "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", "metadata": {}, "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "9ec45d8fb4e247e4b1188972547ebb7f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "config.json: 0%| | 0.00/1.09k [00:00 cutoff]\n", - " classes = [result['labels'][i] for i in indices]\n", - " else:\n", - " result = classifier(first_trip, candidate_labels[key])\n", - " classes = result[\"labels\"][0]\n", - " print(result)\n", - " print(classes)\n", - " print(i)\n", - " df.loc[i] = [key, classes]\n", - "\n", - "df['true_class'] = first_trip_type" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "2ec09e8f-75f5-45b1-b4c0-4fafd685d36b", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " superclass pred_class true_class same\n", - "0 activity_type city trip city trip True\n", - "1 activities [sightseeing, running] [sightseeing] False\n", - "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn True\n", - "3 style_or_comfort ultralight luxury (including evening wear) False\n", - "4 dress_code conservative casual False\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions pet-friendly no special condition False\n", - "8 trip_length_days 3 days 3 days True\n" - ] - } - ], - "source": [ - "pd.set_option('display.width', 1000) \n", - "pd.set_option('display.max_columns', None)\n", - "df['same_value'] = df['pred_class'] == df['true_class']\n", - "print(df)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "82ae19c8-8bb7-4f7f-841b-1cb6501a17a7", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Accuracy (excluding activities): 0.3333333333333333\n" - ] - } - ], - "source": [ - "# accuracy excluding activities\n", - "correct = sum(df.loc[df.index != 1, 'same_value'])\n", - "total = len(df['same_value'])\n", - "accuracy = correct/total\n", - "print(\"Accuracy (excluding activities):\", accuracy)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "16c0a3ae-34ac-49a4-b59f-411a6f0ce947", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Percentage of true classes that were identified: 1.0\n", - "Percentage of predicted classes that were wrong: 0.5\n" - ] - } - ], - "source": [ - "pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", - "true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", - "correct = [label for label in pred_class if label in true_class]\n", - "\n", - "num_correct = len(correct)\n", - "correct_perc = num_correct/len(true_class)\n", - "\n", - "num_pred = len(pred_class)\n", - "wrong_perc = (num_pred - num_correct)/num_pred\n", - "\n", - "print(\"Percentage of true classes that were identified:\", correct_perc)\n", - "print(\"Percentage of predicted classes that were wrong:\", wrong_perc)" - ] - }, - { - "cell_type": "code", - "execution_count": 10, + "execution_count": 37, "id": "3a762755-872d-43a6-b666-874d6133488c", "metadata": {}, "outputs": [], "source": [ - "# write function that returns pandas data frame with predictions\n", + "# function that returns pandas data frame with predictions\n", "\n", "cut_off = 0.5 # used to choose which activities are relevant\n", "\n", @@ -256,56 +212,12 @@ }, { "cell_type": "code", - "execution_count": 7, - "id": "a8087c21-1723-4d8b-b16a-b9a8c4711b3c", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'ski tour / skitour', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'camping trip (campground)', 'camping trip (wild camping)'], 'scores': [0.43876224756240845, 0.28949078917503357, 0.2296781688928604, 0.013231690041720867, 0.006261605303734541, 0.0048823230899870396, 0.004273542668670416, 0.003523954190313816, 0.002200624207034707, 0.0017751322593539953, 0.0012460413854569197, 0.001187920686788857, 0.001103689894080162, 0.0010212253546342254, 0.0007383587071672082, 0.0006226822733879089]}\n", - "city trip\n", - "0\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'stand-up paddleboarding (SUP)', 'yoga', 'swimming', 'horseback riding', 'biking', 'hiking', 'fishing', 'hut-to-hut hiking', 'snowshoe hiking', 'surfing', 'cross-country skiing', 'ice climbing', 'rock climbing', 'skiing', 'paragliding', 'snorkeling', 'kayaking / canoeing', 'rafting', 'ski touring', 'scuba diving', 'going to the beach'], 'scores': [0.993356466293335, 0.6435525417327881, 0.22852905094623566, 0.041904889047145844, 0.016036055982112885, 0.009409126825630665, 0.005277613643556833, 0.0045664007775485516, 0.003934502601623535, 0.0032551318872720003, 0.0029276658315211535, 0.0028460840694606304, 0.002796007553115487, 0.002782624214887619, 0.0026962263509631157, 0.0022985099349170923, 0.0018938799621537328, 0.0014590730424970388, 0.0014523258432745934, 0.0011245544301345944, 0.0010432893177494407, 0.0005298255709931254, 0.0005263364873826504, 0.0003157037717755884, 0.0002174152177758515]}\n", - "['sightseeing', 'running']\n", - "1\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'dry / desert-like', 'cold destination / winter', 'tropical / humid'], 'scores': [0.2885315418243408, 0.26166394352912903, 0.21071799099445343, 0.13520291447639465, 0.10388367623090744]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.33056551218032837, 0.29158779978752136, 0.19290487468242645, 0.18494176864624023]}\n", - "ultralight\n", - "3\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.5861191749572754, 0.37694796919822693, 0.0369328074157238]}\n", - "conservative\n", - "4\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4559071660041809, 0.4436822831630707, 0.05552537366747856, 0.04488520696759224]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9014678001403809, 0.09853222221136093]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'rainy climate', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'snow and ice', 'high alpine terrain', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.19365736842155457, 0.16660872101783752, 0.16359402239322662, 0.1427871584892273, 0.09902289509773254, 0.06602667272090912, 0.06477302312850952, 0.05932661145925522, 0.04420347884297371]}\n", - "pet-friendly\n", - "7\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '4 days', '1 day', '2 days', '7+ days', '5 days', '7 days', '6 days'], 'scores': [0.9385411143302917, 0.012675816193223, 0.009355404414236546, 0.00852197129279375, 0.00844663381576538, 0.00801017601042986, 0.00785527192056179, 0.006593691650778055]}\n", - "3 days\n", - "8\n" - ] - } - ], - "source": [ - "test = pred_trip(first_trip, first_trip_type, cut_off = 0.5)" - ] - }, - { - "cell_type": "code", - "execution_count": 20, + "execution_count": 38, "id": "3b4f3193-3bdd-453c-8664-df84f955600c", "metadata": {}, "outputs": [], "source": [ - "# write function for accuracy, perc true classes identified and perc wrong pred classes\n", + "# function for accuracy, perc true classes identified and perc wrong pred classes\n", "\n", "def perf_measure(df):\n", " df['same_value'] = df['pred_class'] == df['true_class']\n", @@ -327,36 +239,6 @@ " return(df_perf)" ] }, - { - "cell_type": "code", - "execution_count": 22, - "id": "ac8e6536-6b00-40b4-8231-877547926d5b", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " superclass pred_class true_class same\n", - "0 activity_type city trip city trip True\n", - "1 activities [sightseeing, running] [sightseeing] False\n", - "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn True\n", - "3 style_or_comfort ultralight luxury (including evening wear) False\n", - "4 dress_code conservative casual False\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions pet-friendly no special condition False\n", - "8 trip_length_days 3 days 3 days True\n", - " accuracy true_ident false_pred\n", - "0 0.333333 1.0 0.5\n" - ] - } - ], - "source": [ - "print(test)\n", - "print(perf_measure(test))" - ] - }, { "cell_type": "markdown", "id": "62c5c18c-58f4-465c-a188-c57cfa7ffa90", @@ -367,451 +249,80 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 39, "id": "4dd01755-be8d-4904-8494-ac28aba2fee7", "metadata": { "scrolled": true }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'nature escape', 'digital nomad trip', 'cultural exploration', 'yoga / wellness retreat', 'festival trip', 'long-distance hike / thru-hike', 'hut trek (summer)', 'city trip', 'road trip (car/camper)', 'ski tour / skitour', 'camping trip (campground)', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'hut trek (winter)'], 'scores': [0.37631064653396606, 0.35016775131225586, 0.13397355377674103, 0.031636204570531845, 0.031270742416381836, 0.012846449390053749, 0.012699575163424015, 0.009526746347546577, 0.008148356340825558, 0.007793044205754995, 0.006512156222015619, 0.005669699050486088, 0.0044484627433121204, 0.004113250877708197, 0.002713854657486081, 0.002169555053114891]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'cultural exploration', 'nature escape', 'digital nomad trip', 'camping trip (campground)', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'ski tour / skitour', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'road trip (car/camper)', 'festival trip', 'yoga / wellness retreat', 'snowboard / splitboard trip'], 'scores': [0.37198853492736816, 0.31496119499206543, 0.10890532284975052, 0.09102731198072433, 0.0735681876540184, 0.012933704070746899, 0.009422042407095432, 0.0051276967860758305, 0.004056071396917105, 0.0017408831045031548, 0.001503779087215662, 0.0014244643971323967, 0.0013752576196566224, 0.0009292717440985143, 0.0006881792796775699, 0.0003480584127828479]}\n", "beach vacation\n", "0\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'relaxing', 'hiking', 'swimming', 'sightseeing', 'running', 'hut-to-hut hiking', 'biking', 'photography', 'surfing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'yoga', 'kayaking / canoeing', 'rock climbing', 'fishing', 'paragliding', 'rafting', 'horseback riding', 'snowshoe hiking', 'cross-country skiing', 'ice climbing', 'skiing', 'scuba diving', 'ski touring'], 'scores': [0.9914858341217041, 0.9771362543106079, 0.9426282048225403, 0.21901991963386536, 0.17586199939250946, 0.09854521602392197, 0.08370419591665268, 0.03679152950644493, 0.03668990358710289, 0.03099300153553486, 0.025300050154328346, 0.021451234817504883, 0.011070131324231625, 0.0075112744234502316, 0.006306737195700407, 0.0034973458386957645, 0.002655829070135951, 0.00197031581774354, 0.0015599008183926344, 0.001527810120023787, 0.0015017405385151505, 0.0014336870517581701, 0.0011686616344377398, 0.000789369223639369, 0.0004912536824122071]}\n", - "['going to the beach', 'relaxing', 'hiking']\n", - "1\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'cold destination / winter'], 'scores': [0.6468702554702759, 0.19999535381793976, 0.09394325315952301, 0.05279730260372162, 0.0063938056118786335]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.4286234974861145, 0.2564568817615509, 0.2147122174501419, 0.10020739585161209]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.6567223072052002, 0.3034382164478302, 0.039839524775743484]}\n", - "casual\n", - "4\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.5007699728012085, 0.34074831008911133, 0.10416240990161896, 0.05431929975748062]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.7521055936813354, 0.24789436161518097]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'no special conditions', 'pet-friendly', 'rainy climate', 'child-friendly', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.46220096945762634, 0.12957870960235596, 0.10651793330907822, 0.09777138382196426, 0.06722460687160492, 0.0632496327161789, 0.04952802509069443, 0.015049820765852928, 0.008878983557224274]}\n", - "off-grid / no electricity\n", - "7\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '6 days', '3 days', '4 days', '7 days', '5 days'], 'scores': [0.21139054000377655, 0.18512114882469177, 0.14520084857940674, 0.0976138487458229, 0.094282366335392, 0.09376301616430283, 0.09161651134490967, 0.08101171255111694]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type beach vacation beach vacation\n", - "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking]\n", - "2 climate_or_season warm destination / summer warm destination / summer\n", - "3 style_or_comfort minimalist lightweight (but comfortable)\n", - "4 dress_code casual casual\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions off-grid / no electricity no special conditions\n", - "8 trip_length_days 7+ days 7 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.0\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'ski tour / skitour', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'camping trip (campground)', 'camping trip (wild camping)'], 'scores': [0.43876224756240845, 0.28949078917503357, 0.2296781688928604, 0.013231690041720867, 0.006261605303734541, 0.0048823230899870396, 0.004273542668670416, 0.003523954190313816, 0.002200624207034707, 0.0017751322593539953, 0.0012460413854569197, 0.001187920686788857, 0.001103689894080162, 0.0010212253546342254, 0.0007383587071672082, 0.0006226822733879089]}\n", - "city trip\n", - "0\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'stand-up paddleboarding (SUP)', 'yoga', 'swimming', 'horseback riding', 'biking', 'hiking', 'fishing', 'hut-to-hut hiking', 'snowshoe hiking', 'surfing', 'cross-country skiing', 'ice climbing', 'rock climbing', 'skiing', 'paragliding', 'snorkeling', 'kayaking / canoeing', 'rafting', 'ski touring', 'scuba diving', 'going to the beach'], 'scores': [0.993356466293335, 0.6435525417327881, 0.22852905094623566, 0.041904889047145844, 0.016036055982112885, 0.009409126825630665, 0.005277613643556833, 0.0045664007775485516, 0.003934502601623535, 0.0032551318872720003, 0.0029276658315211535, 0.0028460840694606304, 0.002796007553115487, 0.002782624214887619, 0.0026962263509631157, 0.0022985099349170923, 0.0018938799621537328, 0.0014590730424970388, 0.0014523258432745934, 0.0011245544301345944, 0.0010432893177494407, 0.0005298255709931254, 0.0005263364873826504, 0.0003157037717755884, 0.0002174152177758515]}\n", - "['sightseeing', 'running']\n", - "1\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'dry / desert-like', 'cold destination / winter', 'tropical / humid'], 'scores': [0.2885315418243408, 0.26166394352912903, 0.21071799099445343, 0.13520291447639465, 0.10388367623090744]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.33056551218032837, 0.29158779978752136, 0.19290487468242645, 0.18494176864624023]}\n", - "ultralight\n", - "3\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.5861191749572754, 0.37694796919822693, 0.0369328074157238]}\n", - "conservative\n", - "4\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4559071660041809, 0.4436822831630707, 0.05552537366747856, 0.04488520696759224]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9014678001403809, 0.09853222221136093]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'rainy climate', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'snow and ice', 'high alpine terrain', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.19365736842155457, 0.16660872101783752, 0.16359402239322662, 0.1427871584892273, 0.09902289509773254, 0.06602667272090912, 0.06477302312850952, 0.05932661145925522, 0.04420347884297371]}\n", - "pet-friendly\n", - "7\n", - "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '4 days', '1 day', '2 days', '7+ days', '5 days', '7 days', '6 days'], 'scores': [0.9385411143302917, 0.012675816193223, 0.009355404414236546, 0.00852197129279375, 0.00844663381576538, 0.00801017601042986, 0.00785527192056179, 0.006593691650778055]}\n", - "3 days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type city trip city trip\n", - "1 activities [sightseeing, running] [sightseeing]\n", - "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn\n", - "3 style_or_comfort ultralight luxury (including evening wear)\n", - "4 dress_code conservative casual\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions pet-friendly no special condition\n", - "8 trip_length_days 3 days 3 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.0\n", - "1 0.333333 1.00 0.5\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'city trip', 'digital nomad trip', 'hut trek (winter)', 'nature escape', 'ski tour / skitour', 'snowboard / splitboard trip', 'long-distance hike / thru-hike', 'yoga / wellness retreat', 'road trip (car/camper)', 'hut trek (summer)', 'camping trip (campground)', 'beach vacation', 'camping trip (wild camping)'], 'scores': [0.2392912209033966, 0.15534718334674835, 0.13751967251300812, 0.09226146340370178, 0.07452593743801117, 0.06707481294870377, 0.04759081080555916, 0.043233778327703476, 0.028630005195736885, 0.01878121681511402, 0.0180769432336092, 0.017894743010401726, 0.017357835546135902, 0.017217138782143593, 0.01436654757708311, 0.010830691084265709]}\n", - "micro-adventure / weekend trip\n", - "0\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['running', 'sightseeing', 'photography', 'stand-up paddleboarding (SUP)', 'relaxing', 'cross-country skiing', 'skiing', 'biking', 'horseback riding', 'kayaking / canoeing', 'hiking', 'snowshoe hiking', 'rock climbing', 'ice climbing', 'fishing', 'ski touring', 'going to the beach', 'hut-to-hut hiking', 'rafting', 'swimming', 'surfing', 'snorkeling', 'yoga', 'paragliding', 'scuba diving'], 'scores': [0.7003850340843201, 0.11371292173862457, 0.037029631435871124, 0.03360823914408684, 0.02719508484005928, 0.020364845171570778, 0.01584702357649803, 0.015790844336152077, 0.015647919848561287, 0.012953400611877441, 0.010651995427906513, 0.009859885089099407, 0.008985543623566628, 0.008797547779977322, 0.007938007824122906, 0.007290820125490427, 0.006831961218267679, 0.006372789852321148, 0.006293026264756918, 0.004361668601632118, 0.00409139646217227, 0.0032699385192245245, 0.0026200537104159594, 0.0024058902636170387, 0.0014953003264963627]}\n", - "['running']\n", - "1\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['cold destination / winter', 'warm destination / summer', 'dry / desert-like', 'tropical / humid', 'variable weather / spring / autumn'], 'scores': [0.32574304938316345, 0.19408294558525085, 0.17832006514072418, 0.1775846630334854, 0.12426932901144028]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['lightweight (but comfortable)', 'minimalist', 'luxury (including evening wear)', 'ultralight'], 'scores': [0.334703654050827, 0.25336575508117676, 0.2077224999666214, 0.204208105802536]}\n", - "lightweight (but comfortable)\n", - "3\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5872262120246887, 0.3484684228897095, 0.06430540233850479]}\n", - "casual\n", - "4\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.4828520715236664, 0.29535308480262756, 0.13302002847194672, 0.08877479285001755]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9325927495956421, 0.06740719825029373]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['off-grid / no electricity', 'high alpine terrain', 'snow and ice', 'rainy climate', 'self-supported (bring your own food/cooking)', 'pet-friendly', 'avalanche-prone terrain', 'child-friendly', 'no special conditions'], 'scores': [0.2509196698665619, 0.14195245504379272, 0.1384759396314621, 0.13007090985774994, 0.11442799866199493, 0.09318387508392334, 0.04901996999979019, 0.04704733192920685, 0.03490184620022774]}\n", - "off-grid / no electricity\n", - "7\n", - "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['7+ days', '2 days', '5 days', '1 day', '3 days', '6 days', '4 days', '7 days'], 'scores': [0.1944044679403305, 0.15996229648590088, 0.14701354503631592, 0.11328177154064178, 0.11079160124063492, 0.09671943634748459, 0.0910923033952713, 0.08673460781574249]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type micro-adventure / weekend trip city trip\n", - "1 activities [running] [relaxing]\n", - "2 climate_or_season cold destination / winter cold destination / winter\n", - "3 style_or_comfort lightweight (but comfortable) lightweight (but comfortable)\n", - "4 dress_code casual casual\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions off-grid / no electricity no special condition\n", - "8 trip_length_days 7+ days 7+ days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.0\n", - "1 0.333333 1.00 0.5\n", - "2 0.444444 0.00 1.0\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['cultural exploration', 'micro-adventure / weekend trip', 'nature escape', 'hut trek (summer)', 'digital nomad trip', 'city trip', 'long-distance hike / thru-hike', 'festival trip', 'hut trek (winter)', 'yoga / wellness retreat', 'road trip (car/camper)', 'camping trip (campground)', 'beach vacation', 'ski tour / skitour', 'snowboard / splitboard trip', 'camping trip (wild camping)'], 'scores': [0.46336302161216736, 0.1727677881717682, 0.07163920998573303, 0.0506572462618351, 0.04663144052028656, 0.04209558293223381, 0.031931012868881226, 0.025467030704021454, 0.01593252643942833, 0.014883406460285187, 0.013931799679994583, 0.011312623508274555, 0.010983764193952084, 0.01052050944417715, 0.008977973833680153, 0.008905108086764812]}\n", - "cultural exploration\n", - "0\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['hiking', 'rafting', 'sightseeing', 'kayaking / canoeing', 'hut-to-hut hiking', 'running', 'photography', 'horseback riding', 'stand-up paddleboarding (SUP)', 'relaxing', 'swimming', 'biking', 'fishing', 'snowshoe hiking', 'rock climbing', 'going to the beach', 'snorkeling', 'yoga', 'surfing', 'cross-country skiing', 'ice climbing', 'paragliding', 'scuba diving', 'skiing', 'ski touring'], 'scores': [0.972043514251709, 0.9528122544288635, 0.8972923159599304, 0.4682398736476898, 0.32698461413383484, 0.32268962264060974, 0.13095048069953918, 0.08518116176128387, 0.0796419307589531, 0.07568981498479843, 0.05600163713097572, 0.055922020226716995, 0.05140833556652069, 0.043697480112314224, 0.03483415022492409, 0.027331499382853508, 0.024191800504922867, 0.01979714259505272, 0.016146888956427574, 0.014535189606249332, 0.013982715085148811, 0.012163450941443443, 0.007916608825325966, 0.006059339735656977, 0.0032862559892237186]}\n", - "['hiking', 'rafting', 'sightseeing']\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['relaxing', 'hiking', 'going to the beach', 'photography', 'sightseeing', 'hut-to-hut hiking', 'snorkeling', 'snowshoe hiking', 'yoga', 'stand-up paddleboarding (SUP)', 'kayaking / canoeing', 'horseback riding', 'swimming', 'paragliding', 'rafting', 'biking', 'rock climbing', 'surfing', 'running', 'ice climbing', 'cross-country skiing', 'fishing', 'ski touring', 'skiing', 'scuba diving'], 'scores': [0.9943736791610718, 0.9631249308586121, 0.9454535841941833, 0.7538902759552002, 0.4525446593761444, 0.1696157604455948, 0.05957728251814842, 0.04234873503446579, 0.01991761103272438, 0.016971556469798088, 0.006959819234907627, 0.00411367928609252, 0.0030609173700213432, 0.00186573073733598, 0.0017515394138172269, 0.00142807571683079, 0.0005748369731009007, 0.00037779140984639525, 0.0003097739245276898, 0.00030914091621525586, 0.0002725012309383601, 0.00027050732751376927, 0.00024376016517635435, 0.00017392759036738425, 0.00014787293912377208]}\n", + "['relaxing', 'hiking', 'going to the beach', 'photography']\n", "1\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'tropical / humid', 'dry / desert-like', 'cold destination / winter'], 'scores': [0.44384506344795227, 0.2690219581127167, 0.1677556335926056, 0.06238124519586563, 0.056996092200279236]}\n", - "warm destination / summer\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['tropical / humid', 'warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.4895477890968323, 0.25917261838912964, 0.24829530715942383, 0.0017174285603687167, 0.0012668712297454476]}\n", + "tropical / humid\n", "2\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'ultralight'], 'scores': [0.3486657440662384, 0.31562066078186035, 0.18116892874240875, 0.1545446217060089]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight'], 'scores': [0.7574900984764099, 0.09964746236801147, 0.07804173231124878, 0.06482075154781342]}\n", "minimalist\n", "3\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.653571605682373, 0.2889733612537384, 0.057454951107501984]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8163393139839172, 0.11898067593574524, 0.06467998772859573]}\n", "casual\n", "4\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.46777573227882385, 0.2539612352848053, 0.16836754977703094, 0.10989541560411453]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.7252210378646851, 0.27477893233299255]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['self-supported (bring your own food/cooking)', 'rainy climate', 'off-grid / no electricity', 'high alpine terrain', 'snow and ice', 'pet-friendly', 'avalanche-prone terrain', 'no special conditions', 'child-friendly'], 'scores': [0.39003658294677734, 0.20380789041519165, 0.09472139179706573, 0.08575285971164703, 0.07610892504453659, 0.04846395552158356, 0.03600940853357315, 0.0329112708568573, 0.03218770772218704]}\n", - "self-supported (bring your own food/cooking)\n", - "7\n", - "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['7+ days', '3 days', '6 days', '7 days', '5 days', '4 days', '2 days', '1 day'], 'scores': [0.37269166111946106, 0.15968835353851318, 0.1272405982017517, 0.11949551105499268, 0.09665583074092865, 0.07941259443759918, 0.02776406519114971, 0.0170513316988945]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type cultural exploration cultural exploration\n", - "1 activities [hiking, rafting, sightseeing] [sightseeing, hiking, rafting]\n", - "2 climate_or_season warm destination / summer variable weather / spring / autumn\n", - "3 style_or_comfort minimalist lightweight (but comfortable)\n", - "4 dress_code casual casual\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions self-supported (bring your own food/cooking) rainy climate\n", - "8 trip_length_days 7+ days 7+ days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.0\n", - "1 0.333333 1.00 0.5\n", - "2 0.444444 0.00 1.0\n", - "3 0.333333 1.00 0.0\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['nature escape', 'micro-adventure / weekend trip', 'hut trek (summer)', 'festival trip', 'cultural exploration', 'digital nomad trip', 'road trip (car/camper)', 'city trip', 'beach vacation', 'yoga / wellness retreat', 'long-distance hike / thru-hike', 'camping trip (campground)', 'ski tour / skitour', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'hut trek (winter)'], 'scores': [0.47466129064559937, 0.16936436295509338, 0.05788277089595795, 0.05779806524515152, 0.05607228726148605, 0.046175211668014526, 0.03308841958642006, 0.022494975477457047, 0.016859961673617363, 0.01673378236591816, 0.011891375295817852, 0.010220238007605076, 0.009581994265317917, 0.00800924189388752, 0.005885846447199583, 0.003280133241787553]}\n", - "nature escape\n", - "0\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['hiking', 'swimming', 'relaxing', 'hut-to-hut hiking', 'snowshoe hiking', 'photography', 'going to the beach', 'running', 'stand-up paddleboarding (SUP)', 'horseback riding', 'kayaking / canoeing', 'sightseeing', 'snorkeling', 'rafting', 'surfing', 'rock climbing', 'fishing', 'paragliding', 'biking', 'yoga', 'ice climbing', 'scuba diving', 'cross-country skiing', 'ski touring', 'skiing'], 'scores': [0.9834448099136353, 0.9827073216438293, 0.9554252624511719, 0.302951455116272, 0.15803122520446777, 0.07539486140012741, 0.04432662948966026, 0.041922833770513535, 0.037780944257974625, 0.021722102537751198, 0.018872562795877457, 0.015834694728255272, 0.01344585046172142, 0.008506654761731625, 0.008275093510746956, 0.007949848659336567, 0.007900969125330448, 0.006161535624414682, 0.005462693050503731, 0.004551028832793236, 0.004176904447376728, 0.003736245445907116, 0.0031280280090868473, 0.0018006752943620086, 0.0014146548928692937]}\n", - "['hiking', 'swimming', 'relaxing']\n", - "1\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'dry / desert-like', 'tropical / humid', 'cold destination / winter'], 'scores': [0.950709342956543, 0.019234782084822655, 0.01766001060605049, 0.009133369661867619, 0.0032624907325953245]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight', 'minimalist'], 'scores': [0.3035975396633148, 0.29390522837638855, 0.23362991213798523, 0.16886736452579498]}\n", - "luxury (including evening wear)\n", - "3\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5692072510719299, 0.3603260815143585, 0.07046671956777573]}\n", - "casual\n", - "4\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.5352669954299927, 0.21521903574466705, 0.15747497975826263, 0.09203897416591644]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.8241589069366455, 0.1758410781621933]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['pet-friendly', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'no special conditions', 'rainy climate', 'child-friendly', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.2958301901817322, 0.1270701289176941, 0.11052859574556351, 0.10127398371696472, 0.09833040833473206, 0.09256233274936676, 0.08372248709201813, 0.06674295663833618, 0.023938972502946854]}\n", - "pet-friendly\n", - "7\n", - "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['7+ days', '1 day', '4 days', '2 days', '6 days', '5 days', '7 days', '3 days'], 'scores': [0.831832766532898, 0.03202304244041443, 0.02475377917289734, 0.024069445207715034, 0.023275017738342285, 0.022024031728506088, 0.021049346774816513, 0.020972533151507378]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type nature escape nature escape\n", - "1 activities [hiking, swimming, relaxing] [swimming, relaxing, hiking]\n", - "2 climate_or_season warm destination / summer warm destination / summer\n", - "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable)\n", - "4 dress_code casual casual\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions pet-friendly no special conditions\n", - "8 trip_length_days 7+ days 7+ days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.0\n", - "1 0.333333 1.00 0.5\n", - "2 0.444444 0.00 1.0\n", - "3 0.333333 1.00 0.0\n", - "4 0.444444 1.00 0.0\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['nature escape', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'micro-adventure / weekend trip', 'digital nomad trip', 'beach vacation', 'festival trip', 'snowboard / splitboard trip', 'city trip', 'cultural exploration', 'camping trip (wild camping)', 'camping trip (campground)', 'hut trek (summer)', 'ski tour / skitour', 'hut trek (winter)', 'yoga / wellness retreat'], 'scores': [0.2722090780735016, 0.2096298784017563, 0.17115218937397003, 0.11708182096481323, 0.04944751039147377, 0.04696764051914215, 0.028846951201558113, 0.0212775319814682, 0.01632694900035858, 0.015267681330442429, 0.014307969249784946, 0.014053658582270145, 0.0068706972524523735, 0.0060454499907791615, 0.005282019730657339, 0.0052328938618302345]}\n", - "nature escape\n", - "0\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['hiking', 'hut-to-hut hiking', 'going to the beach', 'sightseeing', 'snowshoe hiking', 'running', 'photography', 'rock climbing', 'relaxing', 'stand-up paddleboarding (SUP)', 'surfing', 'horseback riding', 'ice climbing', 'yoga', 'swimming', 'snorkeling', 'rafting', 'paragliding', 'fishing', 'biking', 'ski touring', 'cross-country skiing', 'skiing', 'kayaking / canoeing', 'scuba diving'], 'scores': [0.995924174785614, 0.8107315301895142, 0.6704922914505005, 0.09409588575363159, 0.09048515558242798, 0.03622523695230484, 0.026452651247382164, 0.0221311803907156, 0.018599139526486397, 0.015825064852833748, 0.013440313749015331, 0.007497405633330345, 0.00657653110101819, 0.0036618353333324194, 0.002331383991986513, 0.0009992193663492799, 0.0007957113557495177, 0.0006465379847213626, 0.0006223482778295875, 0.0006145680090412498, 0.000583317712880671, 0.0005684427451342344, 0.0004824084462597966, 0.00034976654569618404, 0.0002721030614338815]}\n", - "['hiking', 'hut-to-hut hiking', 'going to the beach']\n", - "1\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'tropical / humid', 'dry / desert-like'], 'scores': [0.3592403531074524, 0.3246847689151764, 0.12692902982234955, 0.12148210406303406, 0.0676637664437294]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.6689043641090393, 0.15979459881782532, 0.15350840985774994, 0.01779269427061081]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5058596730232239, 0.4563210606575012, 0.0378192737698555]}\n", - "casual\n", - "4\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['huts with half board', 'sleeping in a car', 'indoor', 'sleeping in a tent'], 'scores': [0.9306207895278931, 0.031916361302137375, 0.02436664327979088, 0.01309619378298521]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9628865718841553, 0.037113435566425323]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['self-supported (bring your own food/cooking)', 'off-grid / no electricity', 'high alpine terrain', 'pet-friendly', 'rainy climate', 'snow and ice', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.2806045413017273, 0.20554204285144806, 0.15984709560871124, 0.0722210556268692, 0.06746473163366318, 0.06105376034975052, 0.05754203349351883, 0.05304615572094917, 0.04267856478691101]}\n", - "self-supported (bring your own food/cooking)\n", - "7\n", - "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['7+ days', '6 days', '7 days', '5 days', '1 day', '2 days', '4 days', '3 days'], 'scores': [0.34911271929740906, 0.31416037678718567, 0.25476762652397156, 0.02170025184750557, 0.021649762988090515, 0.014863741584122181, 0.011998875997960567, 0.011746703647077084]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type nature escape long-distance hike / thru-hike\n", - "1 activities [hiking, hut-to-hut hiking, going to the beach] [going to the beach]\n", - "2 climate_or_season warm destination / summer tropical / humid\n", - "3 style_or_comfort minimalist minimalist\n", - "4 dress_code casual casual\n", - "5 accommodation huts with half board huts with half board\n", - "6 transportation vehicle vehicle\n", - "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity\n", - "8 trip_length_days 7+ days 6 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.000000\n", - "1 0.333333 1.00 0.500000\n", - "2 0.444444 0.00 1.000000\n", - "3 0.333333 1.00 0.000000\n", - "4 0.444444 1.00 0.000000\n", - "5 0.444444 1.00 0.666667\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['beach vacation', 'road trip (car/camper)', 'nature escape', 'micro-adventure / weekend trip', 'festival trip', 'digital nomad trip', 'cultural exploration', 'city trip', 'camping trip (campground)', 'hut trek (winter)', 'hut trek (summer)', 'long-distance hike / thru-hike', 'yoga / wellness retreat', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'ski tour / skitour'], 'scores': [0.8424649238586426, 0.052122071385383606, 0.045149654150009155, 0.016546053811907768, 0.00966702401638031, 0.007702015805989504, 0.004779668524861336, 0.004560756962746382, 0.0023846791591495275, 0.0023726094514131546, 0.002371410606428981, 0.00234890915453434, 0.0020649293437600136, 0.0020323314238339663, 0.0018846038728952408, 0.0015484279720112681]}\n", - "beach vacation\n", - "0\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['going to the beach', 'surfing', 'stand-up paddleboarding (SUP)', 'running', 'kayaking / canoeing', 'relaxing', 'swimming', 'photography', 'sightseeing', 'rafting', 'hut-to-hut hiking', 'yoga', 'fishing', 'hiking', 'biking', 'horseback riding', 'snorkeling', 'skiing', 'rock climbing', 'paragliding', 'ice climbing', 'snowshoe hiking', 'ski touring', 'scuba diving', 'cross-country skiing'], 'scores': [0.9920135736465454, 0.9526715278625488, 0.9424984455108643, 0.19494973123073578, 0.02892795391380787, 0.011631068773567677, 0.004414754454046488, 0.0006122476770542562, 0.0005591650260612369, 0.00039036732050590217, 0.0002494072250556201, 0.0002450320462230593, 0.0002269407268613577, 0.000170115425135009, 0.00014811556320637465, 0.00010454187577124685, 0.00010332300735171884, 9.331753244623542e-05, 8.935244841268286e-05, 8.883540431270376e-05, 8.413659816142172e-05, 8.254400745499879e-05, 7.817314326530322e-05, 7.580930832773447e-05, 6.3187864725478e-05]}\n", - "['going to the beach', 'surfing', 'stand-up paddleboarding (SUP)']\n", - "1\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'warm destination / summer', 'tropical / humid', 'dry / desert-like'], 'scores': [0.6218664050102234, 0.14698372781276703, 0.13569146394729614, 0.0680992528796196, 0.027359161525964737]}\n", - "variable weather / spring / autumn\n", - "2\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'minimalist', 'luxury (including evening wear)'], 'scores': [0.530884325504303, 0.24740535020828247, 0.1111086905002594, 0.11060160398483276]}\n", - "ultralight\n", - "3\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5781950354576111, 0.35012683272361755, 0.07167812436819077]}\n", - "casual\n", - "4\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.8374345898628235, 0.14991936087608337, 0.008760198019444942, 0.0038858656771481037]}\n", - "sleeping in a tent\n", - "5\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9654665589332581, 0.03453344106674194]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['self-supported (bring your own food/cooking)', 'off-grid / no electricity', 'no special conditions', 'pet-friendly', 'child-friendly', 'rainy climate', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.2636737525463104, 0.18892917037010193, 0.1361442506313324, 0.13264372944831848, 0.09250619262456894, 0.07673879712820053, 0.04546836018562317, 0.04477165639400482, 0.019124098122119904]}\n", - "self-supported (bring your own food/cooking)\n", - "7\n", - "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['7+ days', '6 days', '7 days', '5 days', '4 days', '2 days', '3 days', '1 day'], 'scores': [0.38457050919532776, 0.1673465073108673, 0.14360207319259644, 0.11416381597518921, 0.06863638758659363, 0.0520939901471138, 0.046323563903570175, 0.0232631154358387]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type beach vacation beach vacation\n", - "1 activities [going to the beach, surfing, stand-up paddleb... [stand-up paddleboarding (SUP), surfing]\n", - "2 climate_or_season variable weather / spring / autumn cold destination / winter\n", - "3 style_or_comfort ultralight ultralight\n", - "4 dress_code casual casual\n", - "5 accommodation sleeping in a tent sleeping in a tent\n", - "6 transportation vehicle vehicle\n", - "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity\n", - "8 trip_length_days 7+ days 6 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.000000\n", - "1 0.333333 1.00 0.500000\n", - "2 0.444444 0.00 1.000000\n", - "3 0.333333 1.00 0.000000\n", - "4 0.444444 1.00 0.000000\n", - "5 0.444444 1.00 0.666667\n", - "6 0.555556 1.00 0.333333\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga / wellness retreat', 'nature escape', 'micro-adventure / weekend trip', 'cultural exploration', 'digital nomad trip', 'festival trip', 'city trip', 'hut trek (winter)', 'road trip (car/camper)', 'beach vacation', 'ski tour / skitour', 'long-distance hike / thru-hike', 'camping trip (campground)', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'hut trek (summer)'], 'scores': [0.74217689037323, 0.09625624120235443, 0.055444952100515366, 0.028388148173689842, 0.02349301613867283, 0.012203863821923733, 0.009713404811918736, 0.006852505728602409, 0.004789318423718214, 0.004382884595543146, 0.003765304572880268, 0.003622791962698102, 0.002603724831715226, 0.0023082902189344168, 0.0022947373799979687, 0.0017039375379681587]}\n", - "yoga / wellness retreat\n", - "0\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga', 'hiking', 'relaxing', 'snowshoe hiking', 'hut-to-hut hiking', 'ice climbing', 'rock climbing', 'horseback riding', 'swimming', 'running', 'sightseeing', 'stand-up paddleboarding (SUP)', 'going to the beach', 'photography', 'snorkeling', 'cross-country skiing', 'biking', 'ski touring', 'surfing', 'fishing', 'skiing', 'kayaking / canoeing', 'paragliding', 'scuba diving', 'rafting'], 'scores': [0.8492046594619751, 0.6415605545043945, 0.48942187428474426, 0.15107616782188416, 0.022720757871866226, 0.005493790376931429, 0.004362862557172775, 0.0035604359582066536, 0.0025915896985679865, 0.0024332485627382994, 0.0021809833124279976, 0.0019110202556475997, 0.0011951607884839177, 0.0010689860209822655, 0.001003915793262422, 0.0008895954233594239, 0.0007194960489869118, 0.000655113544780761, 0.000601101026404649, 0.0004903521039523184, 0.0004634983488358557, 0.0003716421779245138, 0.0003238141362089664, 0.0003046975762117654, 0.0002747876278590411]}\n", - "['yoga', 'hiking']\n", - "1\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'dry / desert-like'], 'scores': [0.9471889138221741, 0.021895499899983406, 0.012388203293085098, 0.009448436088860035, 0.00907894503325224]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['luxury (including evening wear)', 'minimalist', 'ultralight', 'lightweight (but comfortable)'], 'scores': [0.3255053162574768, 0.22910459339618683, 0.22417910397052765, 0.2212110310792923]}\n", - "luxury (including evening wear)\n", - "3\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.642772376537323, 0.3136065900325775, 0.04362105205655098]}\n", - "casual\n", - "4\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.45050886273384094, 0.3199365735054016, 0.13311396539211273, 0.0964406430721283]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.6389047503471375, 0.18624886870384216, 0.13902997970581055, 0.03581654652953148]}\n", "indoor\n", "5\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['no vehicle', 'vehicle'], 'scores': [0.5035094618797302, 0.4964905083179474]}\n", - "no vehicle\n", - "6\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['pet-friendly', 'snow and ice', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'child-friendly', 'rainy climate', 'high alpine terrain', 'no special conditions', 'avalanche-prone terrain'], 'scores': [0.20113274455070496, 0.18143297731876373, 0.1281966269016266, 0.12688273191452026, 0.10568756610155106, 0.09556522965431213, 0.07762978971004486, 0.06777562201023102, 0.015696685761213303]}\n", - "pet-friendly\n", - "7\n", - "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['7+ days', '7 days', '6 days', '4 days', '5 days', '1 day', '3 days', '2 days'], 'scores': [0.19246383011341095, 0.12628361582756042, 0.12603610754013062, 0.11952764540910721, 0.11401552706956863, 0.1101016104221344, 0.10996993631124496, 0.10160179436206818]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type yoga / wellness retreat yoga / wellness retreat\n", - "1 activities [yoga, hiking] [hut-to-hut hiking, yoga]\n", - "2 climate_or_season cold destination / winter cold destination / winter\n", - "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable)\n", - "4 dress_code casual formal (business trip)\n", - "5 accommodation indoor sleeping in a tent\n", - "6 transportation no vehicle no vehicle\n", - "7 special_conditions pet-friendly avalanche-prone terrain\n", - "8 trip_length_days 7+ days 7 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.75 0.000000\n", - "1 0.333333 1.00 0.500000\n", - "2 0.444444 0.00 1.000000\n", - "3 0.333333 1.00 0.000000\n", - "4 0.444444 1.00 0.000000\n", - "5 0.444444 1.00 0.666667\n", - "6 0.555556 1.00 0.333333\n", - "7 0.333333 0.50 0.500000\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski tour / skitour', 'digital nomad trip', 'micro-adventure / weekend trip', 'hut trek (winter)', 'nature escape', 'snowboard / splitboard trip', 'cultural exploration', 'road trip (car/camper)', 'city trip', 'festival trip', 'long-distance hike / thru-hike', 'yoga / wellness retreat', 'beach vacation', 'camping trip (campground)', 'hut trek (summer)', 'camping trip (wild camping)'], 'scores': [0.6277877688407898, 0.10147693753242493, 0.08032911270856857, 0.049313176423311234, 0.03282054141163826, 0.023940999060869217, 0.019064947962760925, 0.016684003174304962, 0.013051704503595829, 0.0089231813326478, 0.0070185353979468346, 0.005841666366904974, 0.004441345110535622, 0.003346299286931753, 0.0030660738702863455, 0.0028937174938619137]}\n", - "ski tour / skitour\n", - "0\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski touring', 'skiing', 'cross-country skiing', 'stand-up paddleboarding (SUP)', 'surfing', 'running', 'photography', 'swimming', 'relaxing', 'snowshoe hiking', 'horseback riding', 'ice climbing', 'biking', 'rock climbing', 'kayaking / canoeing', 'fishing', 'hut-to-hut hiking', 'sightseeing', 'snorkeling', 'going to the beach', 'hiking', 'yoga', 'paragliding', 'scuba diving', 'rafting'], 'scores': [0.9693604111671448, 0.8987270593643188, 0.3836323022842407, 0.0930146872997284, 0.0707859992980957, 0.0568058155477047, 0.054869573563337326, 0.04586975648999214, 0.04119567945599556, 0.0407184436917305, 0.03190801665186882, 0.025626182556152344, 0.01811041496694088, 0.01370724942535162, 0.013295331038534641, 0.012912402860820293, 0.010964828543365002, 0.009949550963938236, 0.00915785226970911, 0.006088017951697111, 0.005409067030996084, 0.004837491549551487, 0.0037431824021041393, 0.003286615712568164, 0.0006043871399015188]}\n", - "['ski touring', 'skiing']\n", - "1\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['cold destination / winter', 'dry / desert-like', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid'], 'scores': [0.990604817867279, 0.004373250529170036, 0.0024099540896713734, 0.0017728792736306787, 0.0008389907306991518]}\n", - "cold destination / winter\n", - "2\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)'], 'scores': [0.39435455203056335, 0.29837822914123535, 0.26335230469703674, 0.04391491040587425]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.4866763949394226, 0.45126742124557495, 0.06205620989203453]}\n", - "conservative\n", - "4\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4471704363822937, 0.4278737008571625, 0.06446021795272827, 0.06049559265375137]}\n", - "huts with half board\n", - "5\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.5295488238334656, 0.4704512059688568]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['high alpine terrain', 'snow and ice', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'rainy climate', 'child-friendly', 'pet-friendly', 'no special conditions', 'avalanche-prone terrain'], 'scores': [0.2215374857187271, 0.20641450583934784, 0.1480192095041275, 0.1283065527677536, 0.087259441614151, 0.06202260032296181, 0.04981611296534538, 0.04899971932172775, 0.04762434586882591]}\n", - "high alpine terrain\n", - "7\n", - "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['7+ days', '6 days', '7 days', '4 days', '5 days', '3 days', '2 days', '1 day'], 'scores': [0.7842941284179688, 0.03461426496505737, 0.03410837799310684, 0.0328315868973732, 0.03218388929963112, 0.029369475319981575, 0.02771950326859951, 0.024878760799765587]}\n", - "7+ days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type ski tour / skitour ski tour / skitour\n", - "1 activities [ski touring, skiing] [ski touring, photography, swimming]\n", - "2 climate_or_season cold destination / winter cold destination / winter\n", - "3 style_or_comfort minimalist minimalist\n", - "4 dress_code conservative conservative\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions high alpine terrain avalanche-prone terrain\n", - "8 trip_length_days 7+ days 5 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.750000 0.000000\n", - "1 0.333333 1.000000 0.500000\n", - "2 0.444444 0.000000 1.000000\n", - "3 0.333333 1.000000 0.000000\n", - "4 0.444444 1.000000 0.000000\n", - "5 0.444444 1.000000 0.666667\n", - "6 0.555556 1.000000 0.333333\n", - "7 0.333333 0.500000 0.500000\n", - "8 0.444444 0.333333 0.500000\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['camping trip (wild camping)', 'micro-adventure / weekend trip', 'nature escape', 'road trip (car/camper)', 'camping trip (campground)', 'cultural exploration', 'digital nomad trip', 'beach vacation', 'festival trip', 'hut trek (summer)', 'city trip', 'long-distance hike / thru-hike', 'hut trek (winter)', 'ski tour / skitour', 'yoga / wellness retreat', 'snowboard / splitboard trip'], 'scores': [0.5653408169746399, 0.16596493124961853, 0.1550244241952896, 0.06219211965799332, 0.02012023888528347, 0.006907567847520113, 0.00554176140576601, 0.0039147986099123955, 0.0036774182226508856, 0.0029754680581390858, 0.0022333606611937284, 0.0013145286357030272, 0.001251422567293048, 0.0012501205783337355, 0.0011948166647925973, 0.0010962533997371793]}\n", - "camping trip (wild camping)\n", - "0\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['kayaking / canoeing', 'snorkeling', 'swimming', 'running', 'going to the beach', 'relaxing', 'rafting', 'stand-up paddleboarding (SUP)', 'fishing', 'scuba diving', 'sightseeing', 'photography', 'surfing', 'hut-to-hut hiking', 'hiking', 'yoga', 'biking', 'rock climbing', 'horseback riding', 'ice climbing', 'snowshoe hiking', 'paragliding', 'cross-country skiing', 'ski touring', 'skiing'], 'scores': [0.9741191864013672, 0.8313708305358887, 0.08023631572723389, 0.0619945228099823, 0.04943564161658287, 0.02998538129031658, 0.00321459979750216, 0.0028121459763497114, 0.0021254396997392178, 0.00206172838807106, 0.0018922867020592093, 0.001279529882594943, 0.0009366609156131744, 0.0009194213780574501, 0.000556303421035409, 0.0005088432226330042, 0.00025728336186148226, 0.00025180858210660517, 0.00023011150187812746, 0.00019034721481148154, 0.00019007424998562783, 0.00017735426081344485, 0.00017349272093269974, 0.00017041667888406664, 0.0001519768702564761]}\n", - "['kayaking / canoeing', 'snorkeling']\n", - "1\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.5092107057571411, 0.40236932039260864, 0.07266531139612198, 0.008410264737904072, 0.007344490382820368]}\n", - "warm destination / summer\n", - "2\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.6200836896896362, 0.20289665460586548, 0.1540537029504776, 0.022965911775827408]}\n", - "minimalist\n", - "3\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.7067448496818542, 0.2135496884584427, 0.07970546931028366]}\n", - "casual\n", - "4\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.7308037281036377, 0.18550406396389008, 0.054551079869270325, 0.0291411355137825]}\n", - "sleeping in a tent\n", - "5\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9714846014976501, 0.02851540595293045]}\n", - "vehicle\n", - "6\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['self-supported (bring your own food/cooking)', 'off-grid / no electricity', 'pet-friendly', 'no special conditions', 'child-friendly', 'high alpine terrain', 'rainy climate', 'snow and ice', 'avalanche-prone terrain'], 'scores': [0.4884524345397949, 0.10804614424705505, 0.10726279765367508, 0.08764053136110306, 0.08023235946893692, 0.04013073816895485, 0.038666050881147385, 0.0337497815489769, 0.01581917703151703]}\n", - "self-supported (bring your own food/cooking)\n", - "7\n", - "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['3 days', '4 days', '1 day', '2 days', '5 days', '6 days', '7 days', '7+ days'], 'scores': [0.9294797778129578, 0.01445760764181614, 0.012593325227499008, 0.010713724419474602, 0.00934701506048441, 0.008914248086512089, 0.008393170312047005, 0.0061011724174022675]}\n", - "3 days\n", - "8\n", - " superclass pred_class true_class\n", - "0 activity_type camping trip (wild camping) camping trip (wild camping)\n", - "1 activities [kayaking / canoeing, snorkeling] [scuba diving, kayaking / canoeing]\n", - "2 climate_or_season warm destination / summer tropical / humid\n", - "3 style_or_comfort minimalist lightweight (but comfortable)\n", - "4 dress_code casual conservative\n", - "5 accommodation sleeping in a tent sleeping in a tent\n", - "6 transportation vehicle vehicle\n", - "7 special_conditions self-supported (bring your own food/cooking) no special conditions\n", - "8 trip_length_days 3 days 3 days\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.750000 0.000000\n", - "1 0.333333 1.000000 0.500000\n", - "2 0.444444 0.000000 1.000000\n", - "3 0.333333 1.000000 0.000000\n", - "4 0.444444 1.000000 0.000000\n", - "5 0.444444 1.000000 0.666667\n", - "6 0.555556 1.000000 0.333333\n", - "7 0.333333 0.500000 0.500000\n", - "8 0.444444 0.333333 0.500000\n", - "9 0.444444 0.500000 0.500000\n" + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9990958571434021, 0.0009041387238539755]}\n", + "no own vehicle\n", + "6\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[39], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m current_trip \u001b[38;5;241m=\u001b[39m trip_descriptions[i]\n\u001b[1;32m 6\u001b[0m current_type \u001b[38;5;241m=\u001b[39m trip_types[i]\n\u001b[0;32m----> 7\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpred_trip\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcurrent_trip\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcut_off\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n", + "Cell \u001b[0;32mIn[37], line 14\u001b[0m, in \u001b[0;36mpred_trip\u001b[0;34m(trip_descr, trip_type, cut_off)\u001b[0m\n\u001b[1;32m 12\u001b[0m classes \u001b[38;5;241m=\u001b[39m [result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m'\u001b[39m][i] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m indices]\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 14\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mclassifier\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrip_descr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcandidate_labels\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 15\u001b[0m classes \u001b[38;5;241m=\u001b[39m result[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28mprint\u001b[39m(result)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:206\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline.__call__\u001b[0;34m(self, sequences, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to understand extra arguments \u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msequences\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1294\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miterate(inputs, preprocess_params, forward_params, postprocess_params)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mframework \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpt\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ChunkPipeline):\n\u001b[0;32m-> 1294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1295\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43miter\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1296\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_iterator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1297\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43minputs\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnum_workers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbatch_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpreprocess_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforward_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostprocess_params\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:124\u001b[0m, in \u001b[0;36mPipelineIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_item()\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# We're out of items within a batch\u001b[39;00m\n\u001b[0;32m--> 124\u001b[0m item \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfer(item, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparams)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;66;03m# We now have a batch of \"inferred things\".\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:269\u001b[0m, in \u001b[0;36mPipelinePackIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m accumulator\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_last:\n\u001b[0;32m--> 269\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(processed, torch\u001b[38;5;241m.\u001b[39mTensor):\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1209\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1207\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1208\u001b[0m model_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdevice)\n\u001b[0;32m-> 1209\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mforward_params\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mdevice(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcpu\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 1211\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:229\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline._forward\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(model_forward)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 228\u001b[0m model_inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 229\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 231\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 232\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcandidate_label\u001b[39m\u001b[38;5;124m\"\u001b[39m: candidate_label,\n\u001b[1;32m 233\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msequence\u001b[39m\u001b[38;5;124m\"\u001b[39m: sequence,\n\u001b[1;32m 234\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m: inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 235\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moutputs,\n\u001b[1;32m 236\u001b[0m }\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m model_outputs\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1297\u001b[0m, in \u001b[0;36mDebertaV2ForSequenceClassification.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1289\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;124;03mlabels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;124;03m Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,\u001b[39;00m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;124;03m config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If\u001b[39;00m\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;124;03m `config.num_labels > 1` a classification loss is computed (Cross-Entropy).\u001b[39;00m\n\u001b[1;32m 1294\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1295\u001b[0m return_dict \u001b[38;5;241m=\u001b[39m return_dict \u001b[38;5;28;01mif\u001b[39;00m return_dict \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39muse_return_dict\n\u001b[0;32m-> 1297\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeberta\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken_type_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken_type_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[43m \u001b[49m\u001b[43mposition_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mposition_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1302\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1303\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1304\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1305\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1306\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1308\u001b[0m encoder_layer \u001b[38;5;241m=\u001b[39m outputs[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1309\u001b[0m pooled_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpooler(encoder_layer)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1063\u001b[0m, in \u001b[0;36mDebertaV2Model.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1053\u001b[0m token_type_ids \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mzeros(input_shape, dtype\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mlong, device\u001b[38;5;241m=\u001b[39mdevice)\n\u001b[1;32m 1055\u001b[0m embedding_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39membeddings(\n\u001b[1;32m 1056\u001b[0m input_ids\u001b[38;5;241m=\u001b[39minput_ids,\n\u001b[1;32m 1057\u001b[0m token_type_ids\u001b[38;5;241m=\u001b[39mtoken_type_ids,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1060\u001b[0m inputs_embeds\u001b[38;5;241m=\u001b[39minputs_embeds,\n\u001b[1;32m 1061\u001b[0m )\n\u001b[0;32m-> 1063\u001b[0m encoder_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1064\u001b[0m \u001b[43m \u001b[49m\u001b[43membedding_output\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1065\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1066\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 1067\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1068\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1069\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1070\u001b[0m encoded_layers \u001b[38;5;241m=\u001b[39m encoder_outputs[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 1072\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_steps \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:507\u001b[0m, in \u001b[0;36mDebertaV2Encoder.forward\u001b[0;34m(self, hidden_states, attention_mask, output_hidden_states, output_attentions, query_states, relative_pos, return_dict)\u001b[0m\n\u001b[1;32m 497\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_gradient_checkpointing_func(\n\u001b[1;32m 498\u001b[0m layer_module\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__call__\u001b[39m,\n\u001b[1;32m 499\u001b[0m next_kv,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 504\u001b[0m output_attentions,\n\u001b[1;32m 505\u001b[0m )\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 507\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[43mlayer_module\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 508\u001b[0m \u001b[43m \u001b[49m\u001b[43mnext_kv\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 510\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 511\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 512\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 513\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 514\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 517\u001b[0m output_states, att_m \u001b[38;5;241m=\u001b[39m output_states\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:366\u001b[0m, in \u001b[0;36mDebertaV2Layer.forward\u001b[0;34m(self, hidden_states, attention_mask, query_states, relative_pos, rel_embeddings, output_attentions)\u001b[0m\n\u001b[1;32m 364\u001b[0m attention_output, att_matrix \u001b[38;5;241m=\u001b[39m attention_output\n\u001b[1;32m 365\u001b[0m intermediate_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mintermediate(attention_output)\n\u001b[0;32m--> 366\u001b[0m layer_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moutput\u001b[49m\u001b[43m(\u001b[49m\u001b[43mintermediate_output\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mattention_output\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 367\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 368\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (layer_output, att_matrix)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:332\u001b[0m, in \u001b[0;36mDebertaV2Output.forward\u001b[0;34m(self, hidden_states, input_tensor)\u001b[0m\n\u001b[1;32m 331\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, hidden_states, input_tensor):\n\u001b[0;32m--> 332\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdense\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 333\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdropout(hidden_states)\n\u001b[1;32m 334\u001b[0m hidden_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mLayerNorm(hidden_states \u001b[38;5;241m+\u001b[39m input_tensor)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/linear.py:116\u001b[0m, in \u001b[0;36mLinear.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m: Tensor) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Tensor:\n\u001b[0;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mF\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinear\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mweight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbias\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ], @@ -826,182 +337,29 @@ " print(df)\n", " \n", " # accuracy, perc true classes identified and perc wrong pred classes\n", - " performance.loc[i] = perf_measure(df)\n", + " performance = pd.concat([performance, perf_measure(df)])\n", " print(performance)\n", " \n", " result_list.append(df)" ] }, { - "cell_type": "code", - "execution_count": 23, - "id": "031594fd-9a98-4c0e-8777-bfe5b4042c48", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[ superclass pred_class true_class same\n", - "0 activity_type beach vacation beach vacation True\n", - "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking] False\n", - "2 climate_or_season warm destination / summer warm destination / summer True\n", - "3 style_or_comfort minimalist lightweight (but comfortable) False\n", - "4 dress_code casual casual True\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions off-grid / no electricity no special conditions False\n", - "8 trip_length_days 7+ days 7 days False, superclass pred_class true_class same\n", - "0 activity_type city trip city trip True\n", - "1 activities [sightseeing, running] [sightseeing] False\n", - "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn True\n", - "3 style_or_comfort ultralight luxury (including evening wear) False\n", - "4 dress_code conservative casual False\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions pet-friendly no special condition False\n", - "8 trip_length_days 3 days 3 days True, superclass pred_class true_class same\n", - "0 activity_type micro-adventure / weekend trip city trip False\n", - "1 activities [running] [relaxing] False\n", - "2 climate_or_season cold destination / winter cold destination / winter True\n", - "3 style_or_comfort lightweight (but comfortable) lightweight (but comfortable) True\n", - "4 dress_code casual casual True\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions off-grid / no electricity no special condition False\n", - "8 trip_length_days 7+ days 7+ days True, superclass pred_class true_class same\n", - "0 activity_type cultural exploration cultural exploration True\n", - "1 activities [hiking, rafting, sightseeing] [sightseeing, hiking, rafting] False\n", - "2 climate_or_season warm destination / summer variable weather / spring / autumn False\n", - "3 style_or_comfort minimalist lightweight (but comfortable) False\n", - "4 dress_code casual casual True\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions self-supported (bring your own food/cooking) rainy climate False\n", - "8 trip_length_days 7+ days 7+ days True, superclass pred_class true_class same\n", - "0 activity_type nature escape nature escape True\n", - "1 activities [hiking, swimming, relaxing] [swimming, relaxing, hiking] False\n", - "2 climate_or_season warm destination / summer warm destination / summer True\n", - "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable) False\n", - "4 dress_code casual casual True\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions pet-friendly no special conditions False\n", - "8 trip_length_days 7+ days 7+ days True, superclass pred_class true_class same\n", - "0 activity_type nature escape long-distance hike / thru-hike False\n", - "1 activities [hiking, hut-to-hut hiking, going to the beach] [going to the beach] False\n", - "2 climate_or_season warm destination / summer tropical / humid False\n", - "3 style_or_comfort minimalist minimalist True\n", - "4 dress_code casual casual True\n", - "5 accommodation huts with half board huts with half board True\n", - "6 transportation vehicle vehicle True\n", - "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity False\n", - "8 trip_length_days 7+ days 6 days False, superclass pred_class true_class same\n", - "0 activity_type beach vacation beach vacation True\n", - "1 activities [going to the beach, surfing, stand-up paddleb... [stand-up paddleboarding (SUP), surfing] False\n", - "2 climate_or_season variable weather / spring / autumn cold destination / winter False\n", - "3 style_or_comfort ultralight ultralight True\n", - "4 dress_code casual casual True\n", - "5 accommodation sleeping in a tent sleeping in a tent True\n", - "6 transportation vehicle vehicle True\n", - "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity False\n", - "8 trip_length_days 7+ days 6 days False, superclass pred_class true_class same\n", - "0 activity_type yoga / wellness retreat yoga / wellness retreat True\n", - "1 activities [yoga, hiking] [hut-to-hut hiking, yoga] False\n", - "2 climate_or_season cold destination / winter cold destination / winter True\n", - "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable) False\n", - "4 dress_code casual formal (business trip) False\n", - "5 accommodation indoor sleeping in a tent False\n", - "6 transportation no vehicle no vehicle True\n", - "7 special_conditions pet-friendly avalanche-prone terrain False\n", - "8 trip_length_days 7+ days 7 days False, superclass pred_class true_class same\n", - "0 activity_type ski tour / skitour ski tour / skitour True\n", - "1 activities [ski touring, skiing] [ski touring, photography, swimming] False\n", - "2 climate_or_season cold destination / winter cold destination / winter True\n", - "3 style_or_comfort minimalist minimalist True\n", - "4 dress_code conservative conservative True\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions high alpine terrain avalanche-prone terrain False\n", - "8 trip_length_days 7+ days 5 days False, superclass pred_class true_class same\n", - "0 activity_type camping trip (wild camping) camping trip (wild camping) True\n", - "1 activities [kayaking / canoeing, snorkeling] [scuba diving, kayaking / canoeing] False\n", - "2 climate_or_season warm destination / summer tropical / humid False\n", - "3 style_or_comfort minimalist lightweight (but comfortable) False\n", - "4 dress_code casual conservative False\n", - "5 accommodation sleeping in a tent sleeping in a tent True\n", - "6 transportation vehicle vehicle True\n", - "7 special_conditions self-supported (bring your own food/cooking) no special conditions False\n", - "8 trip_length_days 3 days 3 days True]\n", - " accuracy true_ident false_pred\n", - "0 0.333333 0.750000 0.000000\n", - "1 0.333333 1.000000 0.500000\n", - "2 0.444444 0.000000 1.000000\n", - "3 0.333333 1.000000 0.000000\n", - "4 0.444444 1.000000 0.000000\n", - "5 0.444444 1.000000 0.666667\n", - "6 0.555556 1.000000 0.333333\n", - "7 0.333333 0.500000 0.500000\n", - "8 0.444444 0.333333 0.500000\n", - "9 0.444444 0.500000 0.500000\n", - "\n" - ] - } - ], - "source": [ - "print(result_list)\n", - "print(performance)\n", - "print(type(performance))" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "ed802b5a-82c1-4e2f-abb6-bc9a6dc69b78", + "cell_type": "markdown", + "id": "b5c08703-7166-4d03-9d6b-ee2c12608134", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\n" - ] - } - ], "source": [ - "print(type(result_list))\n", - "print(type(result_list[0]))" + "**Compute average performance measures**" ] }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "eb33fd31-94e6-40b5-9c36-a32effe77c01", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " superclass same same same same same same same same same same\n", - "0 activity_type True True False True True False True True True True\n", - "1 activities False False False False False False False False False False\n", - "2 climate_or_season True True True False True False False True True False\n", - "3 style_or_comfort False False True False False True True False True False\n", - "4 dress_code True False True True True True True False True False\n", - "5 accommodation False False False False False True True False False True\n", - "6 transportation False False False False False True True True False True\n", - "7 special_conditions False False False False False False False False False False\n", - "8 trip_length_days False True True True True False False False False True\n" - ] - } - ], + "outputs": [], "source": [ "# Extract \"same_value\" column from each DataFrame\n", - "sv_columns = [df['same'] for df in result_list] # 'same' needs to be changed\n", + "sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", "sv_columns.insert(0, result_list[0]['superclass'])\n", "\n", "# Combine into a new DataFrame (columns side-by-side)\n", @@ -1012,60 +370,32 @@ }, { "cell_type": "code", - "execution_count": 35, - "id": "089d394a-cc38-441f-9fb1-6d4816c32fa5", + "execution_count": null, + "id": "bf7546cb-79ce-49ad-8cee-54d02239220c", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0 activity_type\n", - "1 activities\n", - "2 climate_or_season\n", - "3 style_or_comfort\n", - "4 dress_code\n", - "5 accommodation\n", - "6 transportation\n", - "7 special_conditions\n", - "8 trip_length_days\n", - "Name: superclass, dtype: object\n" - ] - } - ], + "outputs": [], "source": [ - "df['row_mean'] = df.mean(axis=1)\n" + "# Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", + "row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", + "\n", + "df_row_means = pd.DataFrame({\n", + " 'superclass': sv_df['superclass'],\n", + " 'accuracy': row_means\n", + "})\n", + "\n", + "print(df_row_means)" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "fd232953-59e8-4f28-9ce8-11515a2c310b", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "accuracy 0.411111\n", - "true_ident 0.708333\n", - "false_pred 0.400000\n", - "dtype: float64\n" - ] - }, - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAA90AAAJOCAYAAACqS2TfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/xnp5ZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABO90lEQVR4nO3deXhU9b0/8E+AMAEloIZVoyBWrShSsSIulSqIS91qXYpVXKpW0ao89lbrTwmlCre1Xu+1SNWqtFbEpWq9rRsi1GuFqihVcakgrhU0LgSJxkDO749eco1hyYQ5mQl5vZ6HR+fke8585jPfyfe8M1tRkiRJAAAAADnXLt8FAAAAwMZK6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgCAVqRv375x8sknr3fc1KlTo6ioKF5//fXUawLWTugGAICIeOKJJ6KioiI+/vjjfJfSalRXV0dFRUXMnj0736VAweqQ7wIAAKAQPPHEEzF+/Pg4+eSTo1u3bvkuZ61eeeWVaNeuMJ47q66ujvHjx0dExLBhw/JbDBSowni0AgVtxYoV+S4BAApGXV1dfPbZZ3m7/kwmE8XFxXm7fiA7QjfkwRtvvBFnn3127LDDDtGpU6fYYost4phjjlnje64+/vjjuOCCC6Jv376RyWRiq622ipNOOikqKyvrx3z22WdRUVER22+/fZSUlETv3r3j29/+dixatCgiImbPnh1FRUWNXvr1+uuvR1FRUUydOrV+28knnxybbrppLFq0KA455JDo0qVLnHDCCRER8T//8z9xzDHHxNZbbx2ZTCbKy8vjggsuiE8//bRR3S+//HIce+yx0b179+jUqVPssMMOcckll0RExKxZs6KoqCjuueeeRvtNmzYtioqKYs6cOdm2FQCaraKiIn70ox9FRES/fv2iqKio/v3QRUVFcc4558Stt94aAwYMiEwmEw8++GBW62vEv9bG73znO7H55ptHSUlJ7L777nHfffdlXeua3tO9YMGC2H///aNTp06x1VZbxc9+9rOoq6tb4/4PPPBA7LvvvrHJJptEly5d4tBDD40FCxY0GLP6fOCdd96JI488MjbddNPo3r17XHjhhbFq1ar629m9e/eIiBg/fnx9zyoqKrK+TbAx8/JyyIOnnnoqnnjiiTj++ONjq622itdffz2mTJkSw4YNixdffDE6d+4cERGffPJJ7LvvvvHSSy/FqaeeGrvttltUVlbGfffdF2+//XaUlZXFqlWr4lvf+lbMnDkzjj/++DjvvPNi+fLlMWPGjHjhhReif//+Wde3cuXKGDlyZOyzzz5x5ZVX1tdz5513RnV1dZx11lmxxRZbxJNPPhnXXHNNvP3223HnnXfW7//cc8/FvvvuG8XFxXHGGWdE3759Y9GiRfHf//3fcfnll8ewYcOivLw8br311jjqqKMaXPett94a/fv3j6FDh25AhwEgO9/+9rfjH//4R9x2223xH//xH1FWVhYRUR8qH3300bjjjjvinHPOibKysujbt29W7/1esGBB7L333rHlllvGRRddFJtssknccccdceSRR8Yf/vCHRuthNpYsWRLf/OY3Y+XKlfXHvv7666NTp06Nxt5yyy0xevToGDlyZPz7v/97VFdXx5QpU2KfffaJZ599Nvr27Vs/dtWqVTFy5MgYMmRIXHnllfHII4/EL3/5y+jfv3+cddZZ0b1795gyZUqcddZZcdRRR8W3v/3tiIgYOHBgs28LbJQSoMVVV1c32jZnzpwkIpLf/e539dsuu+yyJCKSu+++u9H4urq6JEmS5KabbkoiIrnqqqvWOmbWrFlJRCSzZs1q8PPFixcnEZHcfPPN9dtGjx6dRERy0UUXNanuiRMnJkVFRckbb7xRv+0b3/hG0qVLlwbbvlhPkiTJxRdfnGQymeTjjz+u3/bee+8lHTp0SMaNG9foegAgbb/4xS+SiEgWL17cYHtEJO3atUsWLFjQYHs26+sBBxyQ7LLLLslnn31Wv62uri7Za6+9kq985StZ1bnNNtsko0ePrr98/vnnJxGR/O1vf6vf9t577yVdu3ZtcHuWL1+edOvWLTn99NMbHG/JkiVJ165dG2xffT7w05/+tMHYr33ta8ngwYPrL7///vtJRFi7YR28vBzy4It/ea6trY0PPvggtttuu+jWrVs888wz9T/7wx/+ELvuuusa//pdVFRUP6asrCzOPffctY5pjrPOOmudda9YsSIqKytjr732iiRJ4tlnn42IiPfffz8ee+yxOPXUU2Prrbdeaz0nnXRS1NTUxF133VW/7fbbb4+VK1fG9773vWbXDQBp2G+//WKnnXZq1r4ffvhhPProo3HsscfG8uXLo7KyMiorK+ODDz6IkSNHxquvvhrvvPNOs2u7//77Y88994w99tijflv37t3r3x622owZM+Ljjz+O7373u/U1VFZWRvv27WPIkCExa9asRsf+wQ9+0ODyvvvuG6+99lqza4W2yMvLIQ8+/fTTmDhxYtx8883xzjvvRJIk9T9btmxZ/f8vWrQojj766HUea9GiRbHDDjtEhw65ezh36NAhttpqq0bb33zzzbjsssvivvvui48++qjBz1bXvXoh3nnnndd5HTvuuGN8/etfj1tvvTVOO+20iPjXS8v33HPP2G677XJxMwAgZ/r169fsfRcuXBhJksSll14al1566RrHvPfee7Hllls26/hvvPFGDBkypNH2HXbYocHlV199NSIi9t9//zUep7S0tMHlkpKS+pfXr7bZZps1OgcA1k3ohjw499xz4+abb47zzz8/hg4dGl27do2ioqI4/vjj1/qhJxtibc94r/4glC/LZDKNvopk1apVMWLEiPjwww/jxz/+cey4446xySabxDvvvBMnn3xys+o+6aST4rzzzou33347ampqYu7cufGrX/0q6+MAQNrW9P7opq6vq9fICy+8MEaOHLnGfVriD86r67jllluiV69ejX7+5T/gt2/fPvWaoC0QuiEP7rrrrhg9enT88pe/rN/22WefNfpAlv79+8cLL7ywzmP1798//va3v0Vtbe1avz5ks802i4hodPw33nijyTU///zz8Y9//CN++9vfxkknnVS/fcaMGQ3GbbvtthER6607IuL444+PsWPHxm233RaffvppFBcXx3HHHdfkmgAgl7J9W1ZT19fVa2NxcXEMHz68+QWuxTbbbFP/LPYXvfLKKw0ur/5w1R49euSsjg15Kxu0Fd7TDXnQvn37Bi8pj4i45pprGv1l/Oijj46///3va/xqrdX7H3300VFZWbnGZ4hXj9lmm22iffv28dhjjzX4+bXXXptVzV885ur//8///M8G47p37x7f+MY34qabboo333xzjfWsVlZWFgcffHD8/ve/j1tvvTUOOuig+k+LBYCWtskmm0RE4xC9Nk1dX3v06BHDhg2L6667Lt59991Gx3n//febV/D/OuSQQ2Lu3Lnx5JNPNjjmrbfe2mDcyJEjo7S0NK644oqora3NSR2rv+Ekm09yh7bGM92QB9/61rfilltuia5du8ZOO+0Uc+bMiUceeSS22GKLBuN+9KMfxV133RXHHHNMnHrqqTF48OD48MMP47777otf//rXseuuu8ZJJ50Uv/vd72Ls2LHx5JNPxr777hsrVqyIRx55JM4+++w44ogjomvXrnHMMcfENddcE0VFRdG/f//405/+FO+9916Ta95xxx2jf//+ceGFF8Y777wTpaWl8Yc//GGN7+v6r//6r9hnn31it912izPOOCP69esXr7/+evz5z3+O+fPnNxh70kknxXe+852IiJgwYUL2zQSAHBk8eHBERFxyySVx/PHHR3FxcRx22GFrHZ/N+jp58uTYZ599YpdddonTTz89tt1221i6dGnMmTMn3n777fj73//e7Lr/7d/+LW655ZY46KCD4rzzzqv/yrBtttkmnnvuufpxpaWlMWXKlDjxxBNjt912i+OPPz66d+8eb775Zvz5z3+OvffeO+u3eXXq1Cl22mmnuP3222P77bePzTffPHbeeef1frYLtCl5+9x0aMM++uij5JRTTknKysqSTTfdNBk5cmTy8ssvN/oKkCRJkg8++CA555xzki233DLp2LFjstVWWyWjR49OKisr68dUV1cnl1xySdKvX7+kuLg46dWrV/Kd73wnWbRoUf2Y999/Pzn66KOTzp07J5tttlly5plnJi+88MIavzJsk002WWPdL774YjJ8+PBk0003TcrKypLTTz89+fvf/97oGEmSJC+88EJy1FFHJd26dUtKSkqSHXbYIbn00ksbHbOmpibZbLPNkq5duyaffvpp9s0EgByaMGFCsuWWWybt2rWr/7qtiEjGjBmzxvFNXV+TJEkWLVqUnHTSSUmvXr2S4uLiZMstt0y+9a1vJXfddVdWNa7pfOG5555L9ttvv6SkpCTZcsstkwkTJiQ33njjGr8CbdasWcnIkSOTrl27JiUlJUn//v2Tk08+OXn66afrx6ztfGDcuHHJlyPEE088kQwePDjp2LGjrw+DNShKki+93hOgBa1cuTL69OkThx12WNx44435LgcAAHLKe7qBvLr33nvj/fffb/DhbAAAsLHwTDeQF3/729/iueeeiwkTJkRZWVk888wz+S4JAPJqyZIl6/x5p06domvXri1UDZArPkgNyIspU6bE73//+xg0aFBMnTo13+UAQN717t17nT8fPXq0NRNaIc90AwBAAXjkkUfW+fM+ffrETjvt1ELVALkidAMAAEBKfJAaAAAApKTF39NdV1cX//znP6NLly5RVFTU0lcPAAUvSZJYvnx59OnTJ9q1y8/fx63XALBuTV2vWzx0//Of/4zy8vKWvloAaHXeeuut2GqrrfJy3dZrAGia9a3XLR66u3TpEhH/Kqy0tLSlrz7namtr4+GHH44DDzwwiouL811Om6HvLU/P80Pf8yPffa+qqory8vL6NTMf0liv893XjYle5pZ+5o5e5pZ+5k4avWzqet3ioXv1S9RKS0s3mtDduXPnKC0t9UBoQfre8vQ8P/Q9Pwql7/l8WXca63Wh9HVjoJe5pZ+5o5e5pZ+5k2Yv17de+yA1AAAASInQDQAAACkRugEAACAlQjcAAACkJKvQXVFREUVFRQ3+7bjjjmnVBgA0kzUbAApD1p9ePmDAgHjkkUf+7wAdWvwD0AGAJrBmA0D+Zb36dujQIXr16pVGLQBADlmzASD/sg7dr776avTp0ydKSkpi6NChMXHixNh6663XOr6mpiZqamrqL1dVVUXEv74nrba2thklF5bVt2FjuC2tib63PD3PD33Pj3z3PVfXm82a3RLrdb77ujHRy9zSz9zRy9zSz9xJo5dNPVZRkiRJUw/6wAMPxCeffBI77LBDvPvuuzF+/Ph455134oUXXoguXbqscZ+KiooYP358o+3Tpk2Lzp07N/WqAaDNqK6ujlGjRsWyZcuitLS0WcfIds22XgNAdpq6XmcVur/s448/jm222SauuuqqOO2009Y4Zk1/OS8vL4/Kyspmn0gUktra2pgxY0aMGDEiiouL811Om6HvubVzxUPrHZNpl8SE3evi0qfbRU1dUQtU1dgLFSPzcr35ZK7nR777XlVVFWVlZRsUur9sfWt2S6zX+e7rxkQvc0s/c0cvc6u19LMp55L5tvpcNpe9bOp6vUGfqNKtW7fYfvvtY+HChWsdk8lkIpPJNNpeXFxc0BMnWxvb7Wkt9D03alY1PUTX1BVlNT6X2vJ9ba7nR776nsZ1rm/Nbsn12nzOHb3MLf3MHb3MrULvZ77ODZsjl71s6nE26Hu6P/nkk1i0aFH07t17Qw4DAKTMmg0A+ZFV6L7wwgvjL3/5S7z++uvxxBNPxFFHHRXt27eP7373u2nVBwA0gzUbAApDVi8vf/vtt+O73/1ufPDBB9G9e/fYZ599Yu7cudG9e/e06gMAmsGaDQCFIavQPX369LTqAAByyJoNAIVhg97TDQAAAKyd0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASMkGhe5JkyZFUVFRnH/++TkqBwDINes1AORPs0P3U089Fdddd10MHDgwl/UAADlkvQaA/GpW6P7kk0/ihBNOiBtuuCE222yzXNcEAOSA9RoA8q9Dc3YaM2ZMHHrooTF8+PD42c9+ts6xNTU1UVNTU3+5qqoqIiJqa2ujtra2OVdfUFbfho3htrQm+p5bmfbJ+se0Sxr8Nx/a4v1trudHvvueq+sttPU6333dmOhlbuln7uhlbrWWfjblXDLfVp/D5rKXTT1WUZIkWXVo+vTpcfnll8dTTz0VJSUlMWzYsBg0aFBcffXVaxxfUVER48ePb7R92rRp0blz52yuGgDahOrq6hg1alQsW7YsSktLm3UM6zUApKup63VWofutt96K3XffPWbMmFH/3rD1LeJr+st5eXl5VFZWNvtE4st2rngoJ8dpjky7JCbsXheXPt0uauqK1jn2hYqRLVTVxq+2tjZmzJgRI0aMiOLi4nyX0+o15TGUzVxPS1t8DJnr+ZHvvldVVUVZWVmzQ3ehrtf57uvGRC9zSz9zRy9zq7X0M595rKlWn8vmspdNXa+zenn5vHnz4r333ovddtutftuqVavisccei1/96ldRU1MT7du3b7BPJpOJTCbT6FjFxcU5u7E1q/ITABrUUFe03joK+YHSWuVyHrVl2TyGmjLX09KW72tzPT/y1fcNvc5CXa/TPGZbpZe5pZ+5o5e5Vej9LIQ81lS57GVTj5NV6D7ggAPi+eefb7DtlFNOiR133DF+/OMfN1rAAYCWZ70GgMKRVeju0qVL7Lzzzg22bbLJJrHFFls02g4A5If1GgAKR7O/pxsAAABYt2Z9ZdgXzZ49OwdlAABpsl4DQH54phsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFKSVeieMmVKDBw4MEpLS6O0tDSGDh0aDzzwQFq1AQDNZM0GgMKQVejeaqutYtKkSTFv3rx4+umnY//9948jjjgiFixYkFZ9AEAzWLMBoDB0yGbwYYcd1uDy5ZdfHlOmTIm5c+fGgAEDcloYANB81mwAKAxZhe4vWrVqVdx5552xYsWKGDp0aC5rAgByyJoNAPmTdeh+/vnnY+jQofHZZ5/FpptuGvfcc0/stNNOax1fU1MTNTU19ZerqqoiIqK2tjZqa2ubUXJjmfZJTo7TrOtulzT477rk6vbyf73U09xoymMom7melrZ4f5vr+ZHvvufqerNZs1tivc53Xzcmeplb+pk7eplbraWf+cxjTbX6HDaXvWzqsYqSJMmqQ59//nm8+eabsWzZsrjrrrviN7/5TfzlL39Z6yJeUVER48ePb7R92rRp0blz52yuGgDahOrq6hg1alQsW7YsSktLm32cbNZs6zUAZKep63XWofvLhg8fHv3794/rrrtujT9f01/Oy8vLo7KycoNOJL5o54qHcnKc5si0S2LC7nVx6dPtoqauaJ1jX6gY2UJVbfxqa2tjxowZMWLEiCguLs53Oa1eUx5D2cz1tLTFx5C5nh/57ntVVVWUlZVtcOj+snWt2S2xXue7rxsTvcwt/cwdvcyt1tLPfOaxplp9LpvLXjZ1vW72e7pXq6ura7BIf1kmk4lMJtNoe3Fxcc5ubM2q/ASABjXUFa23jkJ+oLRWuZxHbVk2j6GmzPW0tOX72lzPj3z1Pa3rXNea3RLrdZrHbKv0Mrf0M3f0MrcKvZ+FkMeaKpe9bOpxsgrdF198cRx88MGx9dZbx/Lly2PatGkxe/bseOihwv/LBgC0JdZsACgMWYXu9957L0466aR49913o2vXrjFw4MB46KGHYsSIEWnVBwA0gzUbAApDVqH7xhtvTKsOACCHrNkAUBja5bsAAAAA2FgJ3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlGQVuidOnBhf//rXo0uXLtGjR4848sgj45VXXkmrNgCgmazZAFAYsgrdf/nLX2LMmDExd+7cmDFjRtTW1saBBx4YK1asSKs+AKAZrNkAUBg6ZDP4wQcfbHB56tSp0aNHj5g3b1584xvfyGlhAEDzWbMBoDBs0Hu6ly1bFhERm2++eU6KAQDSYc0GgPzI6pnuL6qrq4vzzz8/9t5779h5553XOq6mpiZqamrqL1dVVUVERG1tbdTW1jb36hvItE9ycpxmXXe7pMF/1yVXt5f/66We5kZTHkPZzPW0tMX721zPj3z3PdfX25Q1uyXW63z3dWOil7mln7mjl7nVWvqZzzzWVKvPYXPZy6YeqyhJkmZ16KyzzooHHnggHn/88dhqq63WOq6ioiLGjx/faPu0adOic+fOzblqANioVVdXx6hRo2LZsmVRWlq6wcdrypptvQaA7DR1vW5W6D7nnHPij3/8Yzz22GPRr1+/dY5d01/Oy8vLo7KyMicnEhERO1c8lJPjNEemXRITdq+LS59uFzV1Resc+0LFyBaqauNXW1sbM2bMiBEjRkRxcXG+y2n1mvIYymaup6UtPobM9fzId9+rqqqirKwsJ6G7qWt2S6zX+e7rxkQvc6s19TOf571Nsfp8oTX0sjVoLXOz0OdlRDpzs6nrdVYvL0+SJM4999y45557Yvbs2esN3BERmUwmMplMo+3FxcU5u7E1q/ITABrUUFe03joK+YHSWuVyHrVl2TyGmjLX09KW72tzPT/y1fdcXGe2a3ZLrNdpHrOt0svcag39LITz3qZoDb1sTQq9n61lXkbktpdNPU5WoXvMmDExbdq0+OMf/xhdunSJJUuWRERE165do1OnTtlXCQCkwpoNAIUhq08vnzJlSixbtiyGDRsWvXv3rv93++23p1UfANAM1mwAKAxZv7wcACh81mwAKAwb9D3dAAAAwNoJ3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlGQduh977LE47LDDok+fPlFUVBT33ntvCmUBABvCeg0AhSHr0L1ixYrYddddY/LkyWnUAwDkgPUaAApDh2x3OPjgg+Pggw9OoxYAIEes1wBQGLynGwAAAFKS9TPd2aqpqYmampr6y1VVVRERUVtbG7W1tTm5jkz7JCfHadZ1t0sa/HddcnV7+b9e6mluNOUxlM1cT0tbvL/N9fzId9/zcb0tsV7nu68bE73MrdbUz3ye9zbF6vOE1tDL1qC1zM1Cn5cR6czNph6rKEmSZneoqKgo7rnnnjjyyCPXOqaioiLGjx/faPu0adOic+fOzb1qANhoVVdXx6hRo2LZsmVRWlq6wcezXgNA7jV1vU49dK/pL+fl5eVRWVmZkxOJiIidKx7KyXGaI9MuiQm718WlT7eLmrqidY59oWJkC1W18autrY0ZM2bEiBEjori4ON/ltHpNeQxlM9fT0hYfQ219rufr93u28z3Xc7OqqirKyspaNHS3xHq9ej7n8/dIUxX675vW9Lshn+dpTbX6Ma+fG04vc6u19LOt9rKp63XqLy/PZDKRyWQabS8uLs7Zja1Zlf+Fu6auaL11FPIDpbXK5Txqy7J5DDVlrqelLd/XbXWu5/v3e1Pne67vm3zc1y2xXq+Wz98jTdVaHm+t4XdDod/XX6SfuaOXuVXo/WyrvWzqcbIO3Z988kksXLiw/vLixYtj/vz5sfnmm8fWW2+d7eEAgBRYrwGgMGQdup9++un45je/WX957NixERExevTomDp1as4KAwCaz3oNAIUh69A9bNiw2IC3gQMALcB6DQCFwfd0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASpoVuidPnhx9+/aNkpKSGDJkSDz55JO5rgsA2EDWawDIv6xD9+233x5jx46NcePGxTPPPBO77rprjBw5Mt5777006gMAmsF6DQCFIevQfdVVV8Xpp58ep5xySuy0007x61//Ojp37hw33XRTGvUBAM1gvQaAwpBV6P78889j3rx5MXz48P87QLt2MXz48JgzZ07OiwMAsme9BoDC0SGbwZWVlbFq1aro2bNng+09e/aMl19+eY371NTURE1NTf3lZcuWRUTEhx9+GLW1tdnWu0YdVq7IyXGadd11SVRX10WH2naxqq5onWM/+OCDFqpq41dbWxvV1dXxwQcfRHFxcb7LafWa8hjKZq6npS0+htr6XM/X7/ds53uu5+by5csjIiJJkmbtX6jr9er5nM/fI01V6L9vWtPvhnyepzXV6se8fm44vcyt1tLPttrLpq7XWYXu5pg4cWKMHz++0fZ+/fqlfdUtZlQTx5X9MtUyIHVNnetp8RiiJWUz39Oam8uXL4+uXbumc/AvaQvrdTb8vml78r3GbUz0Mrf0M3fS6uX61uusQndZWVm0b98+li5d2mD70qVLo1evXmvc5+KLL46xY8fWX66rq4sPP/wwtthiiygqKuy/cjdFVVVVlJeXx1tvvRWlpaX5LqfN0PeWp+f5oe/5ke++J0kSy5cvjz59+jRr/0Jdr/Pd142JXuaWfuaOXuaWfuZOGr1s6nqdVeju2LFjDB48OGbOnBlHHnlkRPxrUZ45c2acc845a9wnk8lEJpNpsK1bt27ZXG2rUFpa6oGQB/re8vQ8P/Q9P/LZ9w15hrvQ12vzOXf0Mrf0M3f0Mrf0M3dy3cumrNdZv7x87NixMXr06Nh9991jjz32iKuvvjpWrFgRp5xySrOKBAByz3oNAIUh69B93HHHxfvvvx+XXXZZLFmyJAYNGhQPPvhgow9rAQDyx3oNAIWhWR+kds4556z15WltTSaTiXHjxjV6SR7p0veWp+f5oe/5sbH0vdDW642lr4VAL3NLP3NHL3NLP3Mnn70sSpr7fSQAAADAOrXLdwEAAACwsRK6AQAAICVCNwAAAKRE6P6SyZMnR9++faOkpCSGDBkSTz755FrH3n333bH77rtHt27dYpNNNolBgwbFLbfc0mDMySefHEVFRQ3+HXTQQWnfjFYnm75/0fTp06OoqKj+e2hXS5IkLrvssujdu3d06tQphg8fHq+++moKlbduue67+d402fR96tSpjXpaUlLSYIz53jS57rv5vmbZ/l658847Y8cdd4ySkpLYZZdd4v7772+hSgtfNr284YYbYt99943NNtssNttssxg+fHiTf6e3Fble89qybHv58ccfx5gxY6J3796RyWRi++2391j/gmz7efXVV8cOO+wQnTp1ivLy8rjgggvis88+a6FqC9djjz0Whx12WPTp0yeKiori3nvvXe8+s2fPjt122y0ymUxst912MXXq1HSKS6g3ffr0pGPHjslNN92ULFiwIDn99NOTbt26JUuXLl3j+FmzZiV333138uKLLyYLFy5Mrr766qR9+/bJgw8+WD9m9OjRyUEHHZS8++679f8+/PDDlrpJrUK2fV9t8eLFyZZbbpnsu+++yRFHHNHgZ5MmTUq6du2a3Hvvvcnf//735PDDD0/69euXfPrppynektYljb6b7+uXbd9vvvnmpLS0tEFPlyxZ0mCM+b5+afTdfG8s2z7/9a9/Tdq3b5/8/Oc/T1588cXk//2//5cUFxcnzz//fAtXXniy7eWoUaOSyZMnJ88++2zy0ksvJSeffHLStWvX5O23327hygtTGmteW5VtL2tqapLdd989OeSQQ5LHH388Wbx4cTJ79uxk/vz5LVx5Ycq2n7feemuSyWSSW2+9NVm8eHHy0EMPJb17904uuOCCFq688Nx///3JJZdcktx9991JRCT33HPPOse/9tprSefOnZOxY8cmL774YnLNNdc0ynK5InR/wR577JGMGTOm/vKqVauSPn36JBMnTmzyMb72ta8l/+///b/6y6NHj/ZLej2a0/eVK1cme+21V/Kb3/ymUY/r6uqSXr16Jb/4xS/qt3388cdJJpNJbrvttlRuQ2uU674nifneFNn2/eabb066du261uOZ702T674nifm+Jtn2+dhjj00OPfTQBtuGDBmSnHnmmanW2Rps6DnJypUrky5duiS//e1v0yqxVUljzWursu3llClTkm233Tb5/PPPW6rEViXbfo4ZMybZf//9G2wbO3Zssvfee6daZ2vTlND9b//2b8mAAQMabDvuuOOSkSNH5rweLy//X59//nnMmzcvhg8fXr+tXbt2MXz48JgzZ85690+SJGbOnBmvvPJKfOMb32jws9mzZ0ePHj1ihx12iLPOOis++OCDnNffWjW37z/96U+jR48ecdpppzX62eLFi2PJkiUNjtm1a9cYMmRIk+7LtiCNvq9mvq9dc/v+ySefxDbbbBPl5eVxxBFHxIIFC+p/Zr6vXxp9X818/z/N6fOcOXMajI+IGDlyZJufuxt6ThIRUV1dHbW1tbH55punVWarkeaa19Y0p5f33XdfDB06NMaMGRM9e/aMnXfeOa644opYtWpVS5VdsJrTz7322ivmzZtX/xL01157Le6///445JBDWqTmjUlLrkEdcn7EVqqysjJWrVoVPXv2bLC9Z8+e8fLLL691v2XLlsWWW24ZNTU10b59+7j22mtjxIgR9T8/6KCD4tvf/nb069cvFi1aFD/5yU/i4IMPjjlz5kT79u1Tuz2tRXP6/vjjj8eNN94Y8+fPX+PPlyxZUn+MLx9z9c/aujT6HmG+r09z+r7DDjvETTfdFAMHDoxly5bFlVdeGXvttVcsWLAgttpqK/O9CdLoe4T5/mXN6fOSJUvM3TVo7jnJF/34xz+OPn36NDqhbIvSWvPaoub08rXXXotHH300TjjhhLj//vtj4cKFcfbZZ0dtbW2MGzeuJcouWM3p56hRo6KysjL22WefSJIkVq5cGT/4wQ/iJz/5SUuUvFFZ2xpUVVUVn376aXTq1Cln1yV0b6AuXbrE/Pnz45NPPomZM2fG2LFjY9ttt41hw4ZFRMTxxx9fP3aXXXaJgQMHRv/+/WP27NlxwAEH5Knq1mv58uVx4oknxg033BBlZWX5LqfNaGrfzffcGzp0aAwdOrT+8l577RVf/epX47rrrosJEybksbKNW1P6br5TqCZNmhTTp0+P2bNnN/oAQNbPuUZu1dXVRY8ePeL666+P9u3bx+DBg+Odd96JX/ziF20+dDfH7Nmz44orrohrr702hgwZEgsXLozzzjsvJkyYEJdeemm+y2MthO7/VVZWFu3bt4+lS5c22L506dLo1avXWvdr165dbLfddhERMWjQoHjppZdi4sSJ9aH7y7bddtsoKyuLhQsXOimL7Pu+aNGieP311+Owww6r31ZXVxcRER06dIhXXnmlfr+lS5dG7969Gxxz0KBBKdyK1ieNvvfv37/RfuZ7Q839PfNFxcXF8bWvfS0WLlwYEWG+N0EafV+Ttj7fm9PnXr16bdD9srHakDl75ZVXxqRJk+KRRx6JgQMHpllmq9FSa15b0Jy52bt37yguLm7wCqCvfvWrsWTJkvj888+jY8eOqdZcyJrTz0svvTROPPHE+P73vx8R//qj74oVK+KMM86ISy65JNq18+7hplrbGlRaWprTZ7kjfGVYvY4dO8bgwYNj5syZ9dvq6upi5syZDZ7tWJ+6urqoqalZ68/ffvvt+OCDDxqcHLdl2fZ9xx13jOeffz7mz59f/+/www+Pb37zmzF//vwoLy+Pfv36Ra9evRocs6qqKv72t79ldV9uzNLo+5qY7w3l4vfMqlWr4vnnn6/vqfm+fmn0fU3a+nxvTp+HDh3aYHxExIwZM9r83G3unP35z38eEyZMiAcffDB23333lii1VWipNa8taM7c3HvvvWPhwoX1f7iIiPjHP/4RvXv3btOBO6J5/ayurm4UrFf/QeNfnx9GU7XoGpTzj2ZrxaZPn55kMplk6tSpyYsvvpicccYZSbdu3eq/JubEE09MLrroovrxV1xxRfLwww8nixYtSl588cXkyiuvTDp06JDccMMNSZIkyfLly5MLL7wwmTNnTrJ48eLkkUceSXbbbbfkK1/5SvLZZ5/l5TYWomz7/mVr+kTRSZMmJd26dUv++Mc/Js8991xyxBFH+AqlL8l13833psm27+PHj08eeuihZNGiRcm8efOS448/PikpKUkWLFhQP8Z8X79c9918X7Ns+/zXv/416dChQ3LllVcmL730UjJu3DhfGfa/su3lpEmTko4dOyZ33XVXg6+xW758eb5uQkFJ41yjrcq2l2+++WbSpUuX5JxzzkleeeWV5E9/+lPSo0eP5Gc/+1m+bkJBybaf48aNS7p06ZLcdtttyWuvvZY8/PDDSf/+/ZNjjz02XzehYCxfvjx59tlnk2effTaJiOSqq65Knn322eSNN95IkiRJLrroouTEE0+sH7/6K8N+9KMfJS+99FIyefJkXxnWUq655ppk6623Tjp27Jjsscceydy5c+t/tt9++yWjR4+uv3zJJZck2223XVJSUpJsttlmydChQ5Pp06fX/7y6ujo58MADk+7duyfFxcXJNttsk5x++umNvuuV7Pr+ZWtaCOvq6pJLL7006dmzZ5LJZJIDDjggeeWVV1KqvvXKZd/N96bLpu/nn39+/diePXsmhxxySPLMM880OJ753jS57Lv5vnbZ/l654447ku233z7p2LFjMmDAgOTPf/5zC1dcuLLp5TbbbJNERKN/48aNa/nCC1SuzzXasmx7+cQTTyRDhgxJMplMsu222yaXX355snLlyhauunBl08/a2tqkoqIi6d+/f1JSUpKUl5cnZ599dvLRRx+1fOEFZtasWWv8Pbi6f6NHj07222+/RvsMGjQo6dixY7LtttsmN998cyq1FSWJ1yEAAABAGrynGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuaAFPPfVU7LXXXrHJJptEUVFRzJ8/v0n7TZ06NYqKiuL1119Ptb5CNnv27CgqKorZs2fnuxQAAMhah3wXABu72traOOaYY6KkpCT+4z/+Izp37hzbbLNNvssCAABagNANKVu0aFG88cYbccMNN8T3v//9fJcDAAC0IC8vh5S99957ERHRrVu3/BbSwurq6uKzzz7LdxkAAJBXQjek6OSTT4799tsvIiKOOeaYKCoqimHDhsVzzz0XJ598cmy77bZRUlISvXr1ilNPPTU++OCD9R7z6aefjpEjR0ZZWVl06tQp+vXrF6eeemqDMXV1dXH11VfHgAEDoqSkJHr27BlnnnlmfPTRR1nVX1FREUVFRfHyyy/HscceG6WlpbHFFlvEeeed1yhQFxUVxTnnnBO33nprDBgwIDKZTDz44IMREfHOO+/EqaeeGj179oxMJhMDBgyIm266qdH1vf3223HkkUfGJptsEj169IgLLrggampqsqoZAAAKiZeXQ4rOPPPM2HLLLeOKK66IH/7wh/H1r389evbsGTNmzIjXXnstTjnllOjVq1csWLAgrr/++liwYEHMnTs3ioqK1ni89957Lw488MDo3r17XHTRRdGtW7d4/fXX4+677250vVOnTo1TTjklfvjDH8bixYvjV7/6VTz77LPx17/+NYqLi7O6Hccee2z07ds3Jk6cGHPnzo3/+q//io8++ih+97vfNRj36KOPxh133BHnnHNOlJWVRd++fWPp0qWx55571ofy7t27xwMPPBCnnXZaVFVVxfnnnx8REZ9++mkccMAB8eabb8YPf/jD6NOnT9xyyy3x6KOPZlUrAAAUlARI1axZs5KISO688876bdXV1Y3G3XbbbUlEJI899lj9tptvvjmJiGTx4sVJkiTJPffck0RE8tRTT631+v7nf/4niYjk1ltvbbD9wQcfXOP2dRk3blwSEcnhhx/eYPvZZ5+dRETy97//vX5bRCTt2rVLFixY0GDsaaedlvTu3TuprKxssP34449PunbtWt+Lq6++OomI5I477qgfs2LFimS77bZLIiKZNWtWk+sGAIBC4eXlkAedOnWq///PPvssKisrY88994yIiGeeeWat+61+X/if/vSnqK2tXeOYO++8M7p27RojRoyIysrK+n+DBw+OTTfdNGbNmpV1vWPGjGlw+dxzz42IiPvvv7/B9v322y922mmn+stJksQf/vCHOOywwyJJkgb1jBw5MpYtW1Z/e++///7o3bt3fOc736nfv3PnznHGGWdkXS8AABQKoRvy4MMPP4zzzjsvevbsGZ06dYru3btHv379IiJi2bJla91vv/32i6OPPjrGjx8fZWVlccQRR8TNN9/c4H3Pr776aixbtix69OgR3bt3b/Dvk08+qf9gt2x85StfaXC5f//+0a5du0bfH776Nqz2/vvvx8cffxzXX399o1pOOeWUiPi/D5p74403Yrvttmv00voddtgh63oBAKBQeE835MGxxx4bTzzxRPzoRz+KQYMGxaabbhp1dXVx0EEHRV1d3Vr3Kyoqirvuuivmzp0b//3f/x0PPfRQnHrqqfHLX/4y5s6dW3+cHj16xK233rrGY3Tv3n2D61/be86/+Ax+RNTflu9973sxevToNe4zcODADa4HAAAKldANLeyjjz6KmTNnxvjx4+Oyyy6r3/7qq682+Rh77rln7LnnnnH55ZfHtGnT4oQTTojp06fH97///ejfv3888sgjsffeezcKwc316quvNngWe+HChVFXVxd9+/Zd537du3ePLl26xKpVq2L48OHrHLvNNtvECy+8EEmSNAj1r7zyygbVDgAA+eTl5dDC2rdvHxH/er/zF1199dXr3fejjz5qtN+gQYMiIupfYn7sscfGqlWrYsKECY32X7lyZXz88cdZ1zx58uQGl6+55pqIiDj44IPXuV/79u3j6KOPjj/84Q/xwgsvNPr5+++/X///hxxySPzzn/+Mu+66q35bdXV1XH/99VnXCwAAhcIz3dDCSktL4xvf+Eb8/Oc/j9ra2thyyy3j4YcfjsWLF69339/+9rdx7bXXxlFHHRX9+/eP5cuXxw033BClpaVxyCGHRMS/3vd95plnxsSJE2P+/Plx4IEHRnFxcbz66qtx5513xn/+5382+LCypli8eHEcfvjhcdBBB8WcOXPi97//fYwaNSp23XXX9e47adKkmDVrVgwZMiROP/302GmnneLDDz+MZ555Jh555JH48MMPIyLi9NNPj1/96ldx0kknxbx586J3795xyy23ROfOnbOqFQAAConQDXkwbdq0OPfcc2Py5MmRJEkceOCB8cADD0SfPn3Wud9+++0XTz75ZEyfPj2WLl0aXbt2jT322CNuvfXWBi///vWvfx2DBw+O6667Ln7yk59Ehw4dom/fvvG9730v9t5776zrvf322+Oyyy6Liy66KDp06BDnnHNO/OIXv2jSvj179ownn3wyfvrTn8bdd98d1157bWyxxRYxYMCA+Pd///f6cZ07d46ZM2fGueeeG9dcc0107tw5TjjhhDj44IPjoIMOyrpmAAAoBEXJl1+rCvC/KioqYvz48fH+++9HWVlZvssBAIBWx3u6AQAAICVeXg5t0CeffBKffPLJOsfk4qvFAACgrRO6oQ268sorY/z48esc05QPdgMAANbNe7qhDXrttdfitddeW+eYffbZJ0pKSlqoIgAA2DgJ3QAAAJASH6QGAAAAKWnx93TX1dXFP//5z+jSpUsUFRW19NUDQMFLkiSWL18effr0iXbt/H0cAFqzFg/d//znP6O8vLylrxYAWp233norttpqq3yXAQBsgBYP3V26dImIf51IlJaWbvDxamtr4+GHH44DDzwwiouLN/h4bZ1+5o5e5pZ+5o5e5lYa/ayqqory8vL6NRMAaL1aPHSvfkl5aWlpzkJ3586do7S01MljDuhn7uhlbuln7uhlbqXZT2/DAoDWzxvFAAAAICVCNwAAAKRE6AYAAICUbFDonjRpUhQVFcX555+fo3IAAABg49Hs0P3UU0/FddddFwMHDsxlPQAAALDRaFbo/uSTT+KEE06IG264ITbbbLNc1wQAAAAbhWaF7jFjxsShhx4aw4cPz3U9AAAAsNHI+nu6p0+fHs8880w89dRTTRpfU1MTNTU19Zerqqoi4l/fa1pbW5vt1Tey+hi5OBb6mUt6mVv6mTt6mVtp9NN9AwAbj6IkSZKmDn7rrbdi9913jxkzZtS/l3vYsGExaNCguPrqq9e4T0VFRYwfP77R9mnTpkXnzp2bVzUAbMSqq6tj1KhRsWzZsigtLc13OQDABsgqdN97771x1FFHRfv27eu3rVq1KoqKiqJdu3ZRU1PT4GcRa36mu7y8PCorK3NyIlFbWxszZsyIESNGRHFx8QYfr63Tz9xpTb3cueKhfJewXpl2SUzYva5V9LPQtaa52Rqk0c+qqqooKysTugFgI5DVy8sPOOCAeP755xtsO+WUU2LHHXeMH//4x40Cd0REJpOJTCbTaHtxcXFOT/Zyfby2Tj9zpzX0smZVUb5LaLLW0M/WQi9zK5f9dL8AwMYjq9DdpUuX2HnnnRts22STTWKLLbZotB0AAADaumZ/TzcAAACwbll/evmXzZ49OwdlAAAAwMbHM90AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABISVahe8qUKTFw4MAoLS2N0tLSGDp0aDzwwANp1QYAAACtWlahe6uttopJkybFvHnz4umnn479998/jjjiiFiwYEFa9QEAAECr1SGbwYcddliDy5dffnlMmTIl5s6dGwMGDMhpYQAAANDaZRW6v2jVqlVx5513xooVK2Lo0KG5rAkAAAA2ClmH7ueffz6GDh0an332WWy66aZxzz33xE477bTW8TU1NVFTU1N/uaqqKiIiamtro7a2thklN7T6GLk4FvqZS62pl5n2Sb5LWK9Mu3/V2Br6Weha09xsDdLop/sGADYeRUmSZHW2/fnnn8ebb74Zy5Yti7vuuit+85vfxF/+8pe1Bu+KiooYP358o+3Tpk2Lzp07N69qANiIVVdXx6hRo2LZsmVRWlqa73IAgA2Qdej+suHDh0f//v3juuuuW+PP1/RMd3l5eVRWVubkRKK2tjZmzJgRlz7dLmrqijb4eGl6oWJkvktYr9X9HDFiRBQXF+e7nFatNfVy54qH8l3CemXaJTFh97pW0c9C15rmZmuQRj+rqqqirKxM6AaAjUCz39O9Wl1dXYNQ/WWZTCYymUyj7cXFxTk92aupK4qaVYUdulvTyW2u75+2rDX0stAfO1/UGvrZWuhlbuWyn+4XANh4ZBW6L7744jj44INj6623juXLl8e0adNi9uzZ8dBDhf8sGQAAALS0rEL3e++9FyeddFK8++670bVr1xg4cGA89NBDMWLEiLTqAwAAgFYrq9B94403plUHAAAAbHTa5bsAAAAA2FgJ3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEhJVqF74sSJ8fWvfz26dOkSPXr0iCOPPDJeeeWVtGoDAACAVi2r0P2Xv/wlxowZE3Pnzo0ZM2ZEbW1tHHjggbFixYq06gMAAIBWq0M2gx988MEGl6dOnRo9evSIefPmxTe+8Y2cFgYAAACtXVah+8uWLVsWERGbb775WsfU1NRETU1N/eWqqqqIiKitrY3a2toNufr640REZNolG3ystOXi9qZtdY2todZC15p6mWlf+I+f1Y/x1tDPQtea5mZrkEY/3TcAsPEoSpKkWWfbdXV1cfjhh8fHH38cjz/++FrHVVRUxPjx4xttnzZtWnTu3Lk5Vw0AG7Xq6uoYNWpULFu2LEpLS/NdDgCwAZodus8666x44IEH4vHHH4+tttpqrePW9Ex3eXl5VFZW5uREora2NmbMmBGXPt0uauqKNvh4aXqhYmS+S1iv1f0cMWJEFBcX57ucVq019XLniofyXcJ6ZdolMWH3ulbRz0LXmuZma5BGP6uqqqKsrEzoBoCNQLNeXn7OOefEn/70p3jsscfWGbgjIjKZTGQymUbbi4uLc3qyV1NXFDWrCjt0t6aT21zfP21Za+hloT92vqg19LO10MvcymU/3S8AsPHIKnQnSRLnnntu3HPPPTF79uzo169fWnUBAABAq5dV6B4zZkxMmzYt/vjHP0aXLl1iyZIlERHRtWvX6NSpUyoFAgAAQGuV1fd0T5kyJZYtWxbDhg2L3r171/+7/fbb06oPAAAAWq2sX14OAAAANE1Wz3QDAAAATSd0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKck6dD/22GNx2GGHRZ8+faKoqCjuvffeFMoCAACA1i/r0L1ixYrYddddY/LkyWnUAwAAABuNDtnucPDBB8fBBx+cRi0AAACwUck6dGerpqYmampq6i9XVVVFRERtbW3U1tZu8PFXHyPTLtngY6UtF7c3batrbA21FrrW1MtM+8J//Kx+jLeGfha61jQ3W4M0+um+AYCNR1GSJM0+2y4qKop77rknjjzyyLWOqaioiPHjxzfaPm3atOjcuXNzrxoANlrV1dUxatSoWLZsWZSWlua7HABgA6Qeutf0THd5eXlUVlbm5ESitrY2ZsyYEZc+3S5q6oo2+HhpeqFiZL5LWK/V/RwxYkQUFxfnu5x12rnioXyXsE6ZdklM2L1OL3NkdT8L/bHucZ5brWlu5rKfVVVVUVZWJnQDwEYg9ZeXZzKZyGQyjbYXFxfn9GSvpq4oalYV7ol4RBT8ye0X5fr+SUOh39+r6WVuFfpjvdDv6y8yN3Mrl/0s9PsFAGg639MNAAAAKcn6me5PPvkkFi5cWH958eLFMX/+/Nh8881j6623zmlxAAAA0JplHbqffvrp+OY3v1l/eezYsRERMXr06Jg6dWrOCgMAAIDWLuvQPWzYsNiAz14DAACANsN7ugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJCSZoXuyZMnR9++faOkpCSGDBkSTz75ZK7rAgAAgFYv69B9++23x9ixY2PcuHHxzDPPxK677hojR46M9957L436AAAAoNXKOnRfddVVcfrpp8cpp5wSO+20U/z617+Ozp07x0033ZRGfQAAANBqdchm8Oeffx7z5s2Liy++uH5bu3btYvjw4TFnzpw17lNTUxM1NTX1l5ctWxYRER9++GHU1tY2p+YGamtro7q6OjrUtotVdUUbfLw0ffDBB/kuYb1W9/ODDz6I4uLifJezTh1Wrsh3CevUoS6J6uo6vcyR1f0s9Me6x3lutaa5mct+Ll++PCIikiTJyfEAgPzJKnRXVlbGqlWromfPng229+zZM15++eU17jNx4sQYP358o+39+vXL5qo3CmW/zHcFtLRR+S5gI9Ma+ulx3jalNTeXL18eXbt2TenoAEBLyCp0N8fFF18cY8eOrb9cV1cXH374YWyxxRZRVLThz1ZVVVVFeXl5vPXWW1FaWrrBx2vr9DN39DK39DN39DK30uhnkiSxfPny6NOnT06OBwDkT1ahu6ysLNq3bx9Lly5tsH3p0qXRq1evNe6TyWQik8k02NatW7fsqmyC0tJSJ485pJ+5o5e5pZ+5o5e5let+eoYbADYOWX2QWseOHWPw4MExc+bM+m11dXUxc+bMGDp0aM6LAwAAgNYs65eXjx07NkaPHh2777577LHHHnH11VfHihUr4pRTTkmjPgAAAGi1sg7dxx13XLz//vtx2WWXxZIlS2LQoEHx4IMPNvpwtZaSyWRi3LhxjV7CTvPoZ+7oZW7pZ+7oZW7pJwCwLkWJ7yMBAACAVGT1nm4AAACg6YRuAAAASInQDQAAACkRugEAACAlrSJ0T548Ofr27RslJSUxZMiQePLJJ9c5/s4774wdd9wxSkpKYpdddon777+/hSptHbLp5w033BD77rtvbLbZZrHZZpvF8OHD19v/tiTbubna9OnTo6ioKI488sh0C2xlsu3nxx9/HGPGjInevXtHJpOJ7bff3uP9f2Xby6uvvjp22GGH6NSpU5SXl8cFF1wQn332WQtVW7gee+yxOOyww6JPnz5RVFQU995773r3mT17duy2226RyWRiu+22i6lTp6ZeJwBQuAo+dN9+++0xduzYGDduXDzzzDOx6667xsiRI+O9995b4/gnnngivvvd78Zpp50Wzz77bBx55JFx5JFHxgsvvNDClRembPs5e/bs+O53vxuzZs2KOXPmRHl5eRx44IHxzjvvtHDlhSfbXq72+uuvx4UXXhj77rtvC1XaOmTbz88//zxGjBgRr7/+etx1113xyiuvxA033BBbbrllC1deeLLt5bRp0+Kiiy6KcePGxUsvvRQ33nhj3H777fGTn/ykhSsvPCtWrIhdd901Jk+e3KTxixcvjkMPPTS++c1vxvz58+P888+P73//+/HQQw+lXCkAULCSArfHHnskY8aMqb+8atWqpE+fPsnEiRPXOP7YY49NDj300AbbhgwZkpx55pmp1tlaZNvPL1u5cmXSpUuX5Le//W1aJbYazenlypUrk7322iv5zW9+k4wePTo54ogjWqDS1iHbfk6ZMiXZdtttk88//7ylSmw1su3lmDFjkv3337/BtrFjxyZ77713qnW2NhGR3HPPPesc82//9m/JgAEDGmw77rjjkpEjR6ZYGQBQyAr6me7PP/885s2bF8OHD6/f1q5duxg+fHjMmTNnjfvMmTOnwfiIiJEjR651fFvSnH5+WXV1ddTW1sbmm2+eVpmtQnN7+dOf/jR69OgRp512WkuU2Wo0p5/33XdfDB06NMaMGRM9e/aMnXfeOa644opYtWpVS5VdkJrTy7322ivmzZtX/xL01157Le6///445JBDWqTmjYk1CAD4sg75LmBdKisrY9WqVdGzZ88G23v27Bkvv/zyGvdZsmTJGscvWbIktTpbi+b088t+/OMfR58+fRqdVLY1zenl448/HjfeeGPMnz+/BSpsXZrTz9deey0effTROOGEE+L++++PhQsXxtlnnx21tbUxbty4lii7IDWnl6NGjYrKysrYZ599IkmSWLlyZfzgBz/w8vJmWNsaVFVVFZ9++ml06tQpT5UBAPlS0M90U1gmTZoU06dPj3vuuSdKSkryXU6rsnz58jjxxBPjhhtuiLKysnyXs1Goq6uLHj16xPXXXx+DBw+O4447Li655JL49a9/ne/SWp3Zs2fHFVdcEddee20888wzcffdd8ef//znmDBhQr5LAwBo9Qr6me6ysrJo3759LF26tMH2pUuXRq9evda4T69evbIa35Y0p5+rXXnllTFp0qR45JFHYuDAgWmW2Spk28tFixbF66+/Hocddlj9trq6uoiI6NChQ7zyyivRv3//dIsuYM2Zm717947i4uJo3759/bavfvWrsWTJkvj888+jY8eOqdZcqJrTy0svvTROPPHE+P73vx8REbvsskusWLEizjjjjLjkkkuiXTt/n22qta1BpaWlnuUGgDaqoM+kOnbsGIMHD46ZM2fWb6urq4uZM2fG0KFD17jP0KFDG4yPiJgxY8Zax7clzelnRMTPf/7zmDBhQjz44IOx++67t0SpBS/bXu64447x/PPPx/z58+v/HX744fWfcFxeXt6S5Rec5szNvffeOxYuXFj/x4uIiH/84x/Ru3fvNhu4I5rXy+rq6kbBevUfM5IkSa/YjZA1CABoJN+f5LY+06dPTzKZTDJ16tTkxRdfTM4444ykW7duyZIlS5IkSZITTzwxueiii+rH//Wvf006dOiQXHnllclLL72UjBs3LikuLk6ef/75fN2EgpJtPydNmpR07Ngxueuuu5J33323/t/y5cvzdRMKRra9/DKfXt5Qtv188803ky5duiTnnHNO8sorryR/+tOfkh49eiQ/+9nP8nUTCka2vRw3blzSpUuX5Lbbbktee+215OGHH0769++fHHvssfm6CQVj+fLlybPPPps8++yzSUQkV111VfLss88mb7zxRpIkSXLRRRclJ554Yv341157LencuXPyox/9KHnppZeSyZMnJ+3bt08efPDBfN0EACDPCj50J0mSXHPNNcnWW2+ddOzYMdljjz2SuXPn1v9sv/32S0aPHt1g/B133JFsv/32SceOHZMBAwYkf/7zn1u44sKWTT+32WabJCIa/Rs3blzLF16Asp2bXyR0N5ZtP5944olkyJAhSSaTSbbddtvk8ssvT1auXNnCVRembHpZW1ubVFRUJP37909KSkqS8vLy5Oyzz04++uijli+8wMyaNWuNvwNX92/06NHJfvvt12ifQYMGJR07dky23Xbb5Oabb27xugGAwlGUJF47CAAAAGko6Pd0AwAAQGsmdAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAAp+f+o22bPdy2VHAAAAABJRU5ErkJggg==", - "text/plain": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "metadata": { + "scrolled": true + }, + "outputs": [], "source": [ - "# Compute mean for each column\n", + "# Compute performance measures per trip (mean for each column of performance table)\n", "column_means = performance.mean()\n", "print(column_means)\n", "\n", @@ -1078,11 +408,121 @@ { "cell_type": "code", "execution_count": null, - "id": "b5d7b528-34c2-441a-ba20-117038066033", + "id": "bd682c84-3eb1-4a8d-9621-b741e98e4537", "metadata": {}, "outputs": [], "source": [ - "# whcih superclass most mistakes?" + "# save results\n", + "# Example data for one model\n", + "model_name = 'model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli'\n", + "# Structure to save\n", + "model_result = {\n", + " 'model': model_name,\n", + " 'predictions': result_list,\n", + " 'performance': performance,\n", + " 'perf_summary': column_means,\n", + " 'perf_superclass': df_row_means\n", + "}\n", + "\n", + "# File path with folder\n", + "filename = os.path.join('results', f'{model_name}_results.pkl')\n", + "\n", + "# Save the object\n", + "with open(filename, 'wb') as f:\n", + " pickle.dump(model_result, f)" + ] + }, + { + "cell_type": "markdown", + "id": "e1cbb54e-abe6-49b6-957e-0683196f3199", + "metadata": {}, + "source": [ + "**Load and compare results**" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: model_a_facebook-bart-large-mnli\n", + "Performance Summary:\n", + "accuracy 0.454545\n", + "true_ident 0.689394\n", + "false_pred 0.409091\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: model_b_sileod-deberta-v3-base-tasksource-nli\n", + "Performance Summary:\n", + "accuracy 0.500000\n", + "true_ident 0.666667\n", + "false_pred 0.551667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: model_a_facebook-bart-large-mnli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.3\n", + "6 transportation 0.8\n", + "7 special_conditions 0.0\n", + "8 trip_length_days 0.5\n", + "----------------------------------------\n", + "Model: model_b_sileod-deberta-v3-base-tasksource-nli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.1\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.6\n", + "5 accommodation 0.9\n", + "6 transportation 0.7\n", + "7 special_conditions 0.1\n", + "8 trip_length_days 0.5\n", + "----------------------------------------\n" + ] + } + ], + "source": [ + "# Folder where your .pkl files are saved\n", + "results_dir = 'results'\n", + "\n", + "# Dictionary to store all loaded results\n", + "all_results = {}\n", + "\n", + "# Loop through all .pkl files in the folder\n", + "for filename in os.listdir(results_dir):\n", + " if filename.endswith('.pkl'):\n", + " model_name = filename.replace('_results.pkl', '') # Extract model name\n", + " file_path = os.path.join(results_dir, filename)\n", + " \n", + " # Load the result\n", + " with open(file_path, 'rb') as f:\n", + " result = pickle.load(f)\n", + " all_results[model_name] = result\n", + "\n", + "# Now you can compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", + " print(\"-\" * 40)\n", + "\n", + "\n", + "# Now you can compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", + " print(\"-\" * 40)" ] }, { diff --git a/space/space/space/space/space/space/packing_label_hierarchical_mapping.json b/space/space/space/space/space/space/packing_label_hierarchical_mapping.json index bc07fbd9f3e6fd46e3d17f0af9e97e900f485cd3..1643af7b2d8f62eb0148f49c79b76ddfc649f598 100644 --- a/space/space/space/space/space/space/packing_label_hierarchical_mapping.json +++ b/space/space/space/space/space/space/packing_label_hierarchical_mapping.json @@ -247,11 +247,11 @@ "category": "accommodation", "superclass": "type" }, - "transportation: vehicle": { + "transportation: own vehicle": { "category": "transportation", "superclass": "mode" }, - "transportation: no vehicle": { + "transportation: no own vehicle": { "category": "transportation", "superclass": "mode" }, diff --git a/space/space/space/space/space/space/packing_label_structure.json b/space/space/space/space/space/space/packing_label_structure.json index af7794ca5cc915d12d029197bb1135661e86e1ae..0de6fb1915aeab9ad590056645801c629cf88a23 100644 --- a/space/space/space/space/space/space/packing_label_structure.json +++ b/space/space/space/space/space/space/packing_label_structure.json @@ -69,8 +69,8 @@ "sleeping in a car" ], "transportation": [ - "vehicle", - "no vehicle" + "own vehicle", + "no own vehicle" ], "special_conditions": [ "off-grid / no electricity", diff --git a/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json b/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json index 038e192aa1e8c88a7a1d397c618c6bc029e7f756..df7ab8786dde92d3a617243101aa791cc98db5ba 100644 --- a/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json +++ b/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json @@ -507,14 +507,14 @@ "snacks voor de nacht", "thermische deken (voor koude nachten)" ], - "vehicle": [ + "own vehicle": [ "rijbewijs", "autopapieren", "EHBO-set", "navigatie of smartphone", "telefoonhouder" ], - "no vehicle": [ + "no own vehicle": [ "rugzak", "waterfles", "lichte schoenen", diff --git a/space/space/space/space/space/space/results/model_a_facebook-bart-large-mnli_results.pkl b/space/space/space/space/space/space/results/model_a_facebook-bart-large-mnli_results.pkl new file mode 100644 index 0000000000000000000000000000000000000000..444b51c39e33a94e236f00737d6feda19f7cd152 --- /dev/null +++ b/space/space/space/space/space/space/results/model_a_facebook-bart-large-mnli_results.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f5c3b28d1fb60f40fa22ebbe9a32e10f6a81b61beaf376c620eabc6912a72e7 +size 9445 diff --git a/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb b/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb index f0e770f8ce7bd71d0fc1953ebe17d0a71bb77218..d6a4fe714db93ed6bb9e29fa72c738e0e4cbbd48 100644 --- a/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb +++ b/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb @@ -8,59 +8,1176 @@ "# Try out gradio" ] }, + { + "cell_type": "markdown", + "id": "afd23321-1870-44af-82ed-bb241d055dfa", + "metadata": {}, + "source": [] + }, { "cell_type": "markdown", "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", "metadata": {}, "source": [ - "Try model" + "**Load and try the model**" ] }, { "cell_type": "code", "execution_count": 1, - "id": "fa0d8126-e346-4412-9197-7d51baf868da", + "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First trip: We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train. \n", + "\n", + "Trip type: ['city trip', ['sightseeing'], 'variable weather / spring / autumn', 'luxury (including evening wear)', 'casual', 'indoor', 'no vehicle', 'no special condition', '3 days']\n" + ] + } + ], + "source": [ + "# Prerequisites\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", + "import json\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Load the model and create a pipeline for zero-shot classification (1min loading + classifying with 89 labels)\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-large-mnli\")\n", + "\n", + "# get candidate labels\n", + "with open(\"packing_label_structure.json\", \"r\") as file:\n", + " candidate_labels = json.load(file)\n", + "keys_list = list(candidate_labels.keys())\n", + "\n", + "# Load test data (in list of dictionaries)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Extract all trip descriptions and trip_types\n", + "trip_descriptions = [trip['description'] for trip in packing_data]\n", + "trip_types = [trip['trip_types'] for trip in packing_data]\n", + "\n", + "# Access the first trip description\n", + "first_trip = trip_descriptions[1]\n", + "# Get the packing list for the secondfirst trip\n", + "first_trip_type = trip_types[1]\n", + "\n", + "print(f\"First trip: {first_trip} \\n\")\n", + "print(f\"Trip type: {first_trip_type}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "fed1f8bc-5baf-46e7-8763-9d56fb9c536b", "metadata": { "scrolled": true }, "outputs": [ { - "name": "stderr", + "name": "stdout", "output_type": "stream", "text": [ - "Some weights of BartForSequenceClassification were not initialized from the model checkpoint at facebook/bart-base and are newly initialized: ['classification_head.dense.bias', 'classification_head.dense.weight', 'classification_head.out_proj.bias', 'classification_head.out_proj.weight']\n", - "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n", - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n", - "Failed to determine 'entailment' label id from the label2id mapping in the model config. Setting to -1. Define a descriptive label2id mapping in the model config to ensure correct outputs.\n", - "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'ski tour / skitour', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'camping trip (campground)', 'camping trip (wild camping)'], 'scores': [0.43876224756240845, 0.28949078917503357, 0.2296781688928604, 0.013231690041720867, 0.006261605303734541, 0.0048823230899870396, 0.004273542668670416, 0.003523954190313816, 0.002200624207034707, 0.0017751322593539953, 0.0012460413854569197, 0.001187920686788857, 0.001103689894080162, 0.0010212253546342254, 0.0007383587071672082, 0.0006226822733879089]}\n", + "city trip\n", + "0\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'stand-up paddleboarding (SUP)', 'yoga', 'swimming', 'horseback riding', 'biking', 'hiking', 'fishing', 'hut-to-hut hiking', 'snowshoe hiking', 'surfing', 'cross-country skiing', 'ice climbing', 'rock climbing', 'skiing', 'paragliding', 'snorkeling', 'kayaking / canoeing', 'rafting', 'ski touring', 'scuba diving', 'going to the beach'], 'scores': [0.993356466293335, 0.6435525417327881, 0.22852905094623566, 0.041904889047145844, 0.016036055982112885, 0.009409126825630665, 0.005277613643556833, 0.0045664007775485516, 0.003934502601623535, 0.0032551318872720003, 0.0029276658315211535, 0.0028460840694606304, 0.002796007553115487, 0.002782624214887619, 0.0026962263509631157, 0.0022985099349170923, 0.0018938799621537328, 0.0014590730424970388, 0.0014523258432745934, 0.0011245544301345944, 0.0010432893177494407, 0.0005298255709931254, 0.0005263364873826504, 0.0003157037717755884, 0.0002174152177758515]}\n", + "['sightseeing', 'running']\n", + "1\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'dry / desert-like', 'cold destination / winter', 'tropical / humid'], 'scores': [0.2885315418243408, 0.26166394352912903, 0.21071799099445343, 0.13520291447639465, 0.10388367623090744]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.33056551218032837, 0.29158779978752136, 0.19290487468242645, 0.18494176864624023]}\n", + "ultralight\n", + "3\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.5861191749572754, 0.37694796919822693, 0.0369328074157238]}\n", + "conservative\n", + "4\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4559071660041809, 0.4436822831630707, 0.05552537366747856, 0.04488520696759224]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9014678001403809, 0.09853222221136093]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'rainy climate', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'snow and ice', 'high alpine terrain', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.19365736842155457, 0.16660872101783752, 0.16359402239322662, 0.1427871584892273, 0.09902289509773254, 0.06602667272090912, 0.06477302312850952, 0.05932661145925522, 0.04420347884297371]}\n", + "pet-friendly\n", + "7\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '4 days', '1 day', '2 days', '7+ days', '5 days', '7 days', '6 days'], 'scores': [0.9385411143302917, 0.012675816193223, 0.009355404414236546, 0.00852197129279375, 0.00844663381576538, 0.00801017601042986, 0.00785527192056179, 0.006593691650778055]}\n", + "3 days\n", + "8\n" + ] + } + ], + "source": [ + "# Create an empty DataFrame with specified columns\n", + "df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + "cutoff = 0.5 # used to choose which activities are relevant\n", + "\n", + "# fill DataFrame\n", + "for i, key in enumerate(keys_list):\n", + " # Run the classification (ca 30 seconds classifying)\n", + " if key == 'activities':\n", + " result = classifier(first_trip, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cutoff]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(first_trip, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(result)\n", + " print(classes)\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + "\n", + "df['true_class'] = first_trip_type" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "2ec09e8f-75f5-45b1-b4c0-4fafd685d36b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " superclass pred_class true_class same\n", + "0 activity_type city trip city trip True\n", + "1 activities [sightseeing, running] [sightseeing] False\n", + "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn True\n", + "3 style_or_comfort ultralight luxury (including evening wear) False\n", + "4 dress_code conservative casual False\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions pet-friendly no special condition False\n", + "8 trip_length_days 3 days 3 days True\n" + ] + } + ], + "source": [ + "pd.set_option('display.width', 1000) \n", + "pd.set_option('display.max_columns', None)\n", + "df['same_value'] = df['pred_class'] == df['true_class']\n", + "print(df)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "82ae19c8-8bb7-4f7f-841b-1cb6501a17a7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy (excluding activities): 0.3333333333333333\n" + ] + } + ], + "source": [ + "# accuracy excluding activities\n", + "correct = sum(df.loc[df.index != 1, 'same_value'])\n", + "total = len(df['same_value'])\n", + "accuracy = correct/total\n", + "print(\"Accuracy (excluding activities):\", accuracy)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "16c0a3ae-34ac-49a4-b59f-411a6f0ce947", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percentage of true classes that were identified: 1.0\n", + "Percentage of predicted classes that were wrong: 0.5\n" + ] + } + ], + "source": [ + "pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + "true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + "correct = [label for label in pred_class if label in true_class]\n", + "\n", + "num_correct = len(correct)\n", + "correct_perc = num_correct/len(true_class)\n", + "\n", + "num_pred = len(pred_class)\n", + "wrong_perc = (num_pred - num_correct)/num_pred\n", + "\n", + "print(\"Percentage of true classes that were identified:\", correct_perc)\n", + "print(\"Percentage of predicted classes that were wrong:\", wrong_perc)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "3a762755-872d-43a6-b666-874d6133488c", + "metadata": {}, + "outputs": [], + "source": [ + "# write function that returns pandas data frame with predictions\n", + "\n", + "cut_off = 0.5 # used to choose which activities are relevant\n", + "\n", + "def pred_trip(trip_descr, trip_type, cut_off):\n", + " # Create an empty DataFrame with specified columns\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(result)\n", + " print(classes)\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + " df['true_class'] = trip_type\n", + " return df" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "a8087c21-1723-4d8b-b16a-b9a8c4711b3c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'ski tour / skitour', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'camping trip (campground)', 'camping trip (wild camping)'], 'scores': [0.43876224756240845, 0.28949078917503357, 0.2296781688928604, 0.013231690041720867, 0.006261605303734541, 0.0048823230899870396, 0.004273542668670416, 0.003523954190313816, 0.002200624207034707, 0.0017751322593539953, 0.0012460413854569197, 0.001187920686788857, 0.001103689894080162, 0.0010212253546342254, 0.0007383587071672082, 0.0006226822733879089]}\n", + "city trip\n", + "0\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'stand-up paddleboarding (SUP)', 'yoga', 'swimming', 'horseback riding', 'biking', 'hiking', 'fishing', 'hut-to-hut hiking', 'snowshoe hiking', 'surfing', 'cross-country skiing', 'ice climbing', 'rock climbing', 'skiing', 'paragliding', 'snorkeling', 'kayaking / canoeing', 'rafting', 'ski touring', 'scuba diving', 'going to the beach'], 'scores': [0.993356466293335, 0.6435525417327881, 0.22852905094623566, 0.041904889047145844, 0.016036055982112885, 0.009409126825630665, 0.005277613643556833, 0.0045664007775485516, 0.003934502601623535, 0.0032551318872720003, 0.0029276658315211535, 0.0028460840694606304, 0.002796007553115487, 0.002782624214887619, 0.0026962263509631157, 0.0022985099349170923, 0.0018938799621537328, 0.0014590730424970388, 0.0014523258432745934, 0.0011245544301345944, 0.0010432893177494407, 0.0005298255709931254, 0.0005263364873826504, 0.0003157037717755884, 0.0002174152177758515]}\n", + "['sightseeing', 'running']\n", + "1\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'dry / desert-like', 'cold destination / winter', 'tropical / humid'], 'scores': [0.2885315418243408, 0.26166394352912903, 0.21071799099445343, 0.13520291447639465, 0.10388367623090744]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.33056551218032837, 0.29158779978752136, 0.19290487468242645, 0.18494176864624023]}\n", + "ultralight\n", + "3\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.5861191749572754, 0.37694796919822693, 0.0369328074157238]}\n", + "conservative\n", + "4\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4559071660041809, 0.4436822831630707, 0.05552537366747856, 0.04488520696759224]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9014678001403809, 0.09853222221136093]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'rainy climate', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'snow and ice', 'high alpine terrain', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.19365736842155457, 0.16660872101783752, 0.16359402239322662, 0.1427871584892273, 0.09902289509773254, 0.06602667272090912, 0.06477302312850952, 0.05932661145925522, 0.04420347884297371]}\n", + "pet-friendly\n", + "7\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '4 days', '1 day', '2 days', '7+ days', '5 days', '7 days', '6 days'], 'scores': [0.9385411143302917, 0.012675816193223, 0.009355404414236546, 0.00852197129279375, 0.00844663381576538, 0.00801017601042986, 0.00785527192056179, 0.006593691650778055]}\n", + "3 days\n", + "8\n" + ] + } + ], + "source": [ + "test = pred_trip(first_trip, first_trip_type, cut_off = 0.5)" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "3b4f3193-3bdd-453c-8664-df84f955600c", + "metadata": {}, + "outputs": [], + "source": [ + "# write function for accuracy, perc true classes identified and perc wrong pred classes\n", + "\n", + "def perf_measure(df):\n", + " df['same_value'] = df['pred_class'] == df['true_class']\n", + " correct = sum(df.loc[df.index != 1, 'same_value'])\n", + " total = len(df['same_value'])\n", + " accuracy = correct/total\n", + " pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + " true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + " correct = [label for label in pred_class if label in true_class]\n", + " num_correct = len(correct)\n", + " correct_perc = num_correct/len(true_class)\n", + " num_pred = len(pred_class)\n", + " wrong_perc = (num_pred - num_correct)/num_pred\n", + " df_perf = pd.DataFrame({\n", + " 'accuracy': [accuracy],\n", + " 'true_ident': [correct_perc],\n", + " 'false_pred': [wrong_perc]\n", + " })\n", + " return(df_perf)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "ac8e6536-6b00-40b4-8231-877547926d5b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " superclass pred_class true_class same\n", + "0 activity_type city trip city trip True\n", + "1 activities [sightseeing, running] [sightseeing] False\n", + "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn True\n", + "3 style_or_comfort ultralight luxury (including evening wear) False\n", + "4 dress_code conservative casual False\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions pet-friendly no special condition False\n", + "8 trip_length_days 3 days 3 days True\n", + " accuracy true_ident false_pred\n", + "0 0.333333 1.0 0.5\n" + ] + } + ], + "source": [ + "print(test)\n", + "print(perf_measure(test))" + ] + }, + { + "cell_type": "markdown", + "id": "62c5c18c-58f4-465c-a188-c57cfa7ffa90", + "metadata": {}, + "source": [ + "**Now do the same for all trips**" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "4dd01755-be8d-4904-8494-ac28aba2fee7", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'nature escape', 'digital nomad trip', 'cultural exploration', 'yoga / wellness retreat', 'festival trip', 'long-distance hike / thru-hike', 'hut trek (summer)', 'city trip', 'road trip (car/camper)', 'ski tour / skitour', 'camping trip (campground)', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'hut trek (winter)'], 'scores': [0.37631064653396606, 0.35016775131225586, 0.13397355377674103, 0.031636204570531845, 0.031270742416381836, 0.012846449390053749, 0.012699575163424015, 0.009526746347546577, 0.008148356340825558, 0.007793044205754995, 0.006512156222015619, 0.005669699050486088, 0.0044484627433121204, 0.004113250877708197, 0.002713854657486081, 0.002169555053114891]}\n", + "beach vacation\n", + "0\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'relaxing', 'hiking', 'swimming', 'sightseeing', 'running', 'hut-to-hut hiking', 'biking', 'photography', 'surfing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'yoga', 'kayaking / canoeing', 'rock climbing', 'fishing', 'paragliding', 'rafting', 'horseback riding', 'snowshoe hiking', 'cross-country skiing', 'ice climbing', 'skiing', 'scuba diving', 'ski touring'], 'scores': [0.9914858341217041, 0.9771362543106079, 0.9426282048225403, 0.21901991963386536, 0.17586199939250946, 0.09854521602392197, 0.08370419591665268, 0.03679152950644493, 0.03668990358710289, 0.03099300153553486, 0.025300050154328346, 0.021451234817504883, 0.011070131324231625, 0.0075112744234502316, 0.006306737195700407, 0.0034973458386957645, 0.002655829070135951, 0.00197031581774354, 0.0015599008183926344, 0.001527810120023787, 0.0015017405385151505, 0.0014336870517581701, 0.0011686616344377398, 0.000789369223639369, 0.0004912536824122071]}\n", + "['going to the beach', 'relaxing', 'hiking']\n", + "1\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'cold destination / winter'], 'scores': [0.6468702554702759, 0.19999535381793976, 0.09394325315952301, 0.05279730260372162, 0.0063938056118786335]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.4286234974861145, 0.2564568817615509, 0.2147122174501419, 0.10020739585161209]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.6567223072052002, 0.3034382164478302, 0.039839524775743484]}\n", + "casual\n", + "4\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.5007699728012085, 0.34074831008911133, 0.10416240990161896, 0.05431929975748062]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.7521055936813354, 0.24789436161518097]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'no special conditions', 'pet-friendly', 'rainy climate', 'child-friendly', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.46220096945762634, 0.12957870960235596, 0.10651793330907822, 0.09777138382196426, 0.06722460687160492, 0.0632496327161789, 0.04952802509069443, 0.015049820765852928, 0.008878983557224274]}\n", + "off-grid / no electricity\n", + "7\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '6 days', '3 days', '4 days', '7 days', '5 days'], 'scores': [0.21139054000377655, 0.18512114882469177, 0.14520084857940674, 0.0976138487458229, 0.094282366335392, 0.09376301616430283, 0.09161651134490967, 0.08101171255111694]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type beach vacation beach vacation\n", + "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking]\n", + "2 climate_or_season warm destination / summer warm destination / summer\n", + "3 style_or_comfort minimalist lightweight (but comfortable)\n", + "4 dress_code casual casual\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions off-grid / no electricity no special conditions\n", + "8 trip_length_days 7+ days 7 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.0\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'digital nomad trip', 'nature escape', 'hut trek (summer)', 'hut trek (winter)', 'yoga / wellness retreat', 'ski tour / skitour', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'snowboard / splitboard trip', 'beach vacation', 'camping trip (campground)', 'camping trip (wild camping)'], 'scores': [0.43876224756240845, 0.28949078917503357, 0.2296781688928604, 0.013231690041720867, 0.006261605303734541, 0.0048823230899870396, 0.004273542668670416, 0.003523954190313816, 0.002200624207034707, 0.0017751322593539953, 0.0012460413854569197, 0.001187920686788857, 0.001103689894080162, 0.0010212253546342254, 0.0007383587071672082, 0.0006226822733879089]}\n", + "city trip\n", + "0\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['sightseeing', 'running', 'relaxing', 'photography', 'stand-up paddleboarding (SUP)', 'yoga', 'swimming', 'horseback riding', 'biking', 'hiking', 'fishing', 'hut-to-hut hiking', 'snowshoe hiking', 'surfing', 'cross-country skiing', 'ice climbing', 'rock climbing', 'skiing', 'paragliding', 'snorkeling', 'kayaking / canoeing', 'rafting', 'ski touring', 'scuba diving', 'going to the beach'], 'scores': [0.993356466293335, 0.6435525417327881, 0.22852905094623566, 0.041904889047145844, 0.016036055982112885, 0.009409126825630665, 0.005277613643556833, 0.0045664007775485516, 0.003934502601623535, 0.0032551318872720003, 0.0029276658315211535, 0.0028460840694606304, 0.002796007553115487, 0.002782624214887619, 0.0026962263509631157, 0.0022985099349170923, 0.0018938799621537328, 0.0014590730424970388, 0.0014523258432745934, 0.0011245544301345944, 0.0010432893177494407, 0.0005298255709931254, 0.0005263364873826504, 0.0003157037717755884, 0.0002174152177758515]}\n", + "['sightseeing', 'running']\n", + "1\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['variable weather / spring / autumn', 'warm destination / summer', 'dry / desert-like', 'cold destination / winter', 'tropical / humid'], 'scores': [0.2885315418243408, 0.26166394352912903, 0.21071799099445343, 0.13520291447639465, 0.10388367623090744]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'minimalist'], 'scores': [0.33056551218032837, 0.29158779978752136, 0.19290487468242645, 0.18494176864624023]}\n", + "ultralight\n", + "3\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.5861191749572754, 0.37694796919822693, 0.0369328074157238]}\n", + "conservative\n", + "4\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4559071660041809, 0.4436822831630707, 0.05552537366747856, 0.04488520696759224]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9014678001403809, 0.09853222221136093]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['pet-friendly', 'rainy climate', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'snow and ice', 'high alpine terrain', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.19365736842155457, 0.16660872101783752, 0.16359402239322662, 0.1427871584892273, 0.09902289509773254, 0.06602667272090912, 0.06477302312850952, 0.05932661145925522, 0.04420347884297371]}\n", + "pet-friendly\n", + "7\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['3 days', '4 days', '1 day', '2 days', '7+ days', '5 days', '7 days', '6 days'], 'scores': [0.9385411143302917, 0.012675816193223, 0.009355404414236546, 0.00852197129279375, 0.00844663381576538, 0.00801017601042986, 0.00785527192056179, 0.006593691650778055]}\n", + "3 days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type city trip city trip\n", + "1 activities [sightseeing, running] [sightseeing]\n", + "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn\n", + "3 style_or_comfort ultralight luxury (including evening wear)\n", + "4 dress_code conservative casual\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions pet-friendly no special condition\n", + "8 trip_length_days 3 days 3 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.0\n", + "1 0.333333 1.00 0.5\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['micro-adventure / weekend trip', 'cultural exploration', 'festival trip', 'city trip', 'digital nomad trip', 'hut trek (winter)', 'nature escape', 'ski tour / skitour', 'snowboard / splitboard trip', 'long-distance hike / thru-hike', 'yoga / wellness retreat', 'road trip (car/camper)', 'hut trek (summer)', 'camping trip (campground)', 'beach vacation', 'camping trip (wild camping)'], 'scores': [0.2392912209033966, 0.15534718334674835, 0.13751967251300812, 0.09226146340370178, 0.07452593743801117, 0.06707481294870377, 0.04759081080555916, 0.043233778327703476, 0.028630005195736885, 0.01878121681511402, 0.0180769432336092, 0.017894743010401726, 0.017357835546135902, 0.017217138782143593, 0.01436654757708311, 0.010830691084265709]}\n", + "micro-adventure / weekend trip\n", + "0\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['running', 'sightseeing', 'photography', 'stand-up paddleboarding (SUP)', 'relaxing', 'cross-country skiing', 'skiing', 'biking', 'horseback riding', 'kayaking / canoeing', 'hiking', 'snowshoe hiking', 'rock climbing', 'ice climbing', 'fishing', 'ski touring', 'going to the beach', 'hut-to-hut hiking', 'rafting', 'swimming', 'surfing', 'snorkeling', 'yoga', 'paragliding', 'scuba diving'], 'scores': [0.7003850340843201, 0.11371292173862457, 0.037029631435871124, 0.03360823914408684, 0.02719508484005928, 0.020364845171570778, 0.01584702357649803, 0.015790844336152077, 0.015647919848561287, 0.012953400611877441, 0.010651995427906513, 0.009859885089099407, 0.008985543623566628, 0.008797547779977322, 0.007938007824122906, 0.007290820125490427, 0.006831961218267679, 0.006372789852321148, 0.006293026264756918, 0.004361668601632118, 0.00409139646217227, 0.0032699385192245245, 0.0026200537104159594, 0.0024058902636170387, 0.0014953003264963627]}\n", + "['running']\n", + "1\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['cold destination / winter', 'warm destination / summer', 'dry / desert-like', 'tropical / humid', 'variable weather / spring / autumn'], 'scores': [0.32574304938316345, 0.19408294558525085, 0.17832006514072418, 0.1775846630334854, 0.12426932901144028]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['lightweight (but comfortable)', 'minimalist', 'luxury (including evening wear)', 'ultralight'], 'scores': [0.334703654050827, 0.25336575508117676, 0.2077224999666214, 0.204208105802536]}\n", + "lightweight (but comfortable)\n", + "3\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5872262120246887, 0.3484684228897095, 0.06430540233850479]}\n", + "casual\n", + "4\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.4828520715236664, 0.29535308480262756, 0.13302002847194672, 0.08877479285001755]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9325927495956421, 0.06740719825029373]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['off-grid / no electricity', 'high alpine terrain', 'snow and ice', 'rainy climate', 'self-supported (bring your own food/cooking)', 'pet-friendly', 'avalanche-prone terrain', 'child-friendly', 'no special conditions'], 'scores': [0.2509196698665619, 0.14195245504379272, 0.1384759396314621, 0.13007090985774994, 0.11442799866199493, 0.09318387508392334, 0.04901996999979019, 0.04704733192920685, 0.03490184620022774]}\n", + "off-grid / no electricity\n", + "7\n", + "{'sequence': 'My partner and I are traveling to the Netherlands and Germany to spend Christmas with our family. We are in our late twenties and will start our journey with a two-hour flight to the Netherlands. From there, we will take a 5.5-hour train ride to northern Germany.', 'labels': ['7+ days', '2 days', '5 days', '1 day', '3 days', '6 days', '4 days', '7 days'], 'scores': [0.1944044679403305, 0.15996229648590088, 0.14701354503631592, 0.11328177154064178, 0.11079160124063492, 0.09671943634748459, 0.0910923033952713, 0.08673460781574249]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type micro-adventure / weekend trip city trip\n", + "1 activities [running] [relaxing]\n", + "2 climate_or_season cold destination / winter cold destination / winter\n", + "3 style_or_comfort lightweight (but comfortable) lightweight (but comfortable)\n", + "4 dress_code casual casual\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions off-grid / no electricity no special condition\n", + "8 trip_length_days 7+ days 7+ days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.0\n", + "1 0.333333 1.00 0.5\n", + "2 0.444444 0.00 1.0\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['cultural exploration', 'micro-adventure / weekend trip', 'nature escape', 'hut trek (summer)', 'digital nomad trip', 'city trip', 'long-distance hike / thru-hike', 'festival trip', 'hut trek (winter)', 'yoga / wellness retreat', 'road trip (car/camper)', 'camping trip (campground)', 'beach vacation', 'ski tour / skitour', 'snowboard / splitboard trip', 'camping trip (wild camping)'], 'scores': [0.46336302161216736, 0.1727677881717682, 0.07163920998573303, 0.0506572462618351, 0.04663144052028656, 0.04209558293223381, 0.031931012868881226, 0.025467030704021454, 0.01593252643942833, 0.014883406460285187, 0.013931799679994583, 0.011312623508274555, 0.010983764193952084, 0.01052050944417715, 0.008977973833680153, 0.008905108086764812]}\n", + "cultural exploration\n", + "0\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['hiking', 'rafting', 'sightseeing', 'kayaking / canoeing', 'hut-to-hut hiking', 'running', 'photography', 'horseback riding', 'stand-up paddleboarding (SUP)', 'relaxing', 'swimming', 'biking', 'fishing', 'snowshoe hiking', 'rock climbing', 'going to the beach', 'snorkeling', 'yoga', 'surfing', 'cross-country skiing', 'ice climbing', 'paragliding', 'scuba diving', 'skiing', 'ski touring'], 'scores': [0.972043514251709, 0.9528122544288635, 0.8972923159599304, 0.4682398736476898, 0.32698461413383484, 0.32268962264060974, 0.13095048069953918, 0.08518116176128387, 0.0796419307589531, 0.07568981498479843, 0.05600163713097572, 0.055922020226716995, 0.05140833556652069, 0.043697480112314224, 0.03483415022492409, 0.027331499382853508, 0.024191800504922867, 0.01979714259505272, 0.016146888956427574, 0.014535189606249332, 0.013982715085148811, 0.012163450941443443, 0.007916608825325966, 0.006059339735656977, 0.0032862559892237186]}\n", + "['hiking', 'rafting', 'sightseeing']\n", + "1\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'tropical / humid', 'dry / desert-like', 'cold destination / winter'], 'scores': [0.44384506344795227, 0.2690219581127167, 0.1677556335926056, 0.06238124519586563, 0.056996092200279236]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'luxury (including evening wear)', 'ultralight'], 'scores': [0.3486657440662384, 0.31562066078186035, 0.18116892874240875, 0.1545446217060089]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.653571605682373, 0.2889733612537384, 0.057454951107501984]}\n", + "casual\n", + "4\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.46777573227882385, 0.2539612352848053, 0.16836754977703094, 0.10989541560411453]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.7252210378646851, 0.27477893233299255]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['self-supported (bring your own food/cooking)', 'rainy climate', 'off-grid / no electricity', 'high alpine terrain', 'snow and ice', 'pet-friendly', 'avalanche-prone terrain', 'no special conditions', 'child-friendly'], 'scores': [0.39003658294677734, 0.20380789041519165, 0.09472139179706573, 0.08575285971164703, 0.07610892504453659, 0.04846395552158356, 0.03600940853357315, 0.0329112708568573, 0.03218770772218704]}\n", + "self-supported (bring your own food/cooking)\n", + "7\n", + "{'sequence': 'I’m in my twenties and will be traveling to Peru for three weeks. I’m going solo but will meet up with a friend to explore the Sacred Valley and take part in a Machu Picchu tour. We plan to hike, go rafting, and explore the remnants of the ancient Inca Empire. We’re also excited to try Peruvian cuisine and immerse ourselves in the local culture. Depending on our plans, we might also visit the rainforest region, such as Tarapoto. I’ll be flying to Peru on a long-haul flight and will be traveling in August.', 'labels': ['7+ days', '3 days', '6 days', '7 days', '5 days', '4 days', '2 days', '1 day'], 'scores': [0.37269166111946106, 0.15968835353851318, 0.1272405982017517, 0.11949551105499268, 0.09665583074092865, 0.07941259443759918, 0.02776406519114971, 0.0170513316988945]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type cultural exploration cultural exploration\n", + "1 activities [hiking, rafting, sightseeing] [sightseeing, hiking, rafting]\n", + "2 climate_or_season warm destination / summer variable weather / spring / autumn\n", + "3 style_or_comfort minimalist lightweight (but comfortable)\n", + "4 dress_code casual casual\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions self-supported (bring your own food/cooking) rainy climate\n", + "8 trip_length_days 7+ days 7+ days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.0\n", + "1 0.333333 1.00 0.5\n", + "2 0.444444 0.00 1.0\n", + "3 0.333333 1.00 0.0\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['nature escape', 'micro-adventure / weekend trip', 'hut trek (summer)', 'festival trip', 'cultural exploration', 'digital nomad trip', 'road trip (car/camper)', 'city trip', 'beach vacation', 'yoga / wellness retreat', 'long-distance hike / thru-hike', 'camping trip (campground)', 'ski tour / skitour', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'hut trek (winter)'], 'scores': [0.47466129064559937, 0.16936436295509338, 0.05788277089595795, 0.05779806524515152, 0.05607228726148605, 0.046175211668014526, 0.03308841958642006, 0.022494975477457047, 0.016859961673617363, 0.01673378236591816, 0.011891375295817852, 0.010220238007605076, 0.009581994265317917, 0.00800924189388752, 0.005885846447199583, 0.003280133241787553]}\n", + "nature escape\n", + "0\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['hiking', 'swimming', 'relaxing', 'hut-to-hut hiking', 'snowshoe hiking', 'photography', 'going to the beach', 'running', 'stand-up paddleboarding (SUP)', 'horseback riding', 'kayaking / canoeing', 'sightseeing', 'snorkeling', 'rafting', 'surfing', 'rock climbing', 'fishing', 'paragliding', 'biking', 'yoga', 'ice climbing', 'scuba diving', 'cross-country skiing', 'ski touring', 'skiing'], 'scores': [0.9834448099136353, 0.9827073216438293, 0.9554252624511719, 0.302951455116272, 0.15803122520446777, 0.07539486140012741, 0.04432662948966026, 0.041922833770513535, 0.037780944257974625, 0.021722102537751198, 0.018872562795877457, 0.015834694728255272, 0.01344585046172142, 0.008506654761731625, 0.008275093510746956, 0.007949848659336567, 0.007900969125330448, 0.006161535624414682, 0.005462693050503731, 0.004551028832793236, 0.004176904447376728, 0.003736245445907116, 0.0031280280090868473, 0.0018006752943620086, 0.0014146548928692937]}\n", + "['hiking', 'swimming', 'relaxing']\n", + "1\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'dry / desert-like', 'tropical / humid', 'cold destination / winter'], 'scores': [0.950709342956543, 0.019234782084822655, 0.01766001060605049, 0.009133369661867619, 0.0032624907325953245]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight', 'minimalist'], 'scores': [0.3035975396633148, 0.29390522837638855, 0.23362991213798523, 0.16886736452579498]}\n", + "luxury (including evening wear)\n", + "3\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5692072510719299, 0.3603260815143585, 0.07046671956777573]}\n", + "casual\n", + "4\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['huts with half board', 'indoor', 'sleeping in a tent', 'sleeping in a car'], 'scores': [0.5352669954299927, 0.21521903574466705, 0.15747497975826263, 0.09203897416591644]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.8241589069366455, 0.1758410781621933]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['pet-friendly', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'no special conditions', 'rainy climate', 'child-friendly', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.2958301901817322, 0.1270701289176941, 0.11052859574556351, 0.10127398371696472, 0.09833040833473206, 0.09256233274936676, 0.08372248709201813, 0.06674295663833618, 0.023938972502946854]}\n", + "pet-friendly\n", + "7\n", + "{'sequence': 'We’re planning a 10-day trip to Austria in the summer, combining hiking with relaxation by the lake. We love exploring scenic trails and enjoying the outdoors, but we also want to unwind and swim in the lake. It’s the perfect mix of adventure and relaxation.', 'labels': ['7+ days', '1 day', '4 days', '2 days', '6 days', '5 days', '7 days', '3 days'], 'scores': [0.831832766532898, 0.03202304244041443, 0.02475377917289734, 0.024069445207715034, 0.023275017738342285, 0.022024031728506088, 0.021049346774816513, 0.020972533151507378]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type nature escape nature escape\n", + "1 activities [hiking, swimming, relaxing] [swimming, relaxing, hiking]\n", + "2 climate_or_season warm destination / summer warm destination / summer\n", + "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable)\n", + "4 dress_code casual casual\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions pet-friendly no special conditions\n", + "8 trip_length_days 7+ days 7+ days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.0\n", + "1 0.333333 1.00 0.5\n", + "2 0.444444 0.00 1.0\n", + "3 0.333333 1.00 0.0\n", + "4 0.444444 1.00 0.0\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['nature escape', 'long-distance hike / thru-hike', 'road trip (car/camper)', 'micro-adventure / weekend trip', 'digital nomad trip', 'beach vacation', 'festival trip', 'snowboard / splitboard trip', 'city trip', 'cultural exploration', 'camping trip (wild camping)', 'camping trip (campground)', 'hut trek (summer)', 'ski tour / skitour', 'hut trek (winter)', 'yoga / wellness retreat'], 'scores': [0.2722090780735016, 0.2096298784017563, 0.17115218937397003, 0.11708182096481323, 0.04944751039147377, 0.04696764051914215, 0.028846951201558113, 0.0212775319814682, 0.01632694900035858, 0.015267681330442429, 0.014307969249784946, 0.014053658582270145, 0.0068706972524523735, 0.0060454499907791615, 0.005282019730657339, 0.0052328938618302345]}\n", + "nature escape\n", + "0\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['hiking', 'hut-to-hut hiking', 'going to the beach', 'sightseeing', 'snowshoe hiking', 'running', 'photography', 'rock climbing', 'relaxing', 'stand-up paddleboarding (SUP)', 'surfing', 'horseback riding', 'ice climbing', 'yoga', 'swimming', 'snorkeling', 'rafting', 'paragliding', 'fishing', 'biking', 'ski touring', 'cross-country skiing', 'skiing', 'kayaking / canoeing', 'scuba diving'], 'scores': [0.995924174785614, 0.8107315301895142, 0.6704922914505005, 0.09409588575363159, 0.09048515558242798, 0.03622523695230484, 0.026452651247382164, 0.0221311803907156, 0.018599139526486397, 0.015825064852833748, 0.013440313749015331, 0.007497405633330345, 0.00657653110101819, 0.0036618353333324194, 0.002331383991986513, 0.0009992193663492799, 0.0007957113557495177, 0.0006465379847213626, 0.0006223482778295875, 0.0006145680090412498, 0.000583317712880671, 0.0005684427451342344, 0.0004824084462597966, 0.00034976654569618404, 0.0002721030614338815]}\n", + "['hiking', 'hut-to-hut hiking', 'going to the beach']\n", + "1\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'tropical / humid', 'dry / desert-like'], 'scores': [0.3592403531074524, 0.3246847689151764, 0.12692902982234955, 0.12148210406303406, 0.0676637664437294]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.6689043641090393, 0.15979459881782532, 0.15350840985774994, 0.01779269427061081]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5058596730232239, 0.4563210606575012, 0.0378192737698555]}\n", + "casual\n", + "4\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['huts with half board', 'sleeping in a car', 'indoor', 'sleeping in a tent'], 'scores': [0.9306207895278931, 0.031916361302137375, 0.02436664327979088, 0.01309619378298521]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9628865718841553, 0.037113435566425323]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['self-supported (bring your own food/cooking)', 'off-grid / no electricity', 'high alpine terrain', 'pet-friendly', 'rainy climate', 'snow and ice', 'no special conditions', 'child-friendly', 'avalanche-prone terrain'], 'scores': [0.2806045413017273, 0.20554204285144806, 0.15984709560871124, 0.0722210556268692, 0.06746473163366318, 0.06105376034975052, 0.05754203349351883, 0.05304615572094917, 0.04267856478691101]}\n", + "self-supported (bring your own food/cooking)\n", + "7\n", + "{'sequence': 'I am going on a multiple day hike and passing though mountains and the beach in Croatia. I like to pack light and will stay in refugios/huts with half board and travel to the start of the hike by car. It will be 6-7 days.', 'labels': ['7+ days', '6 days', '7 days', '5 days', '1 day', '2 days', '4 days', '3 days'], 'scores': [0.34911271929740906, 0.31416037678718567, 0.25476762652397156, 0.02170025184750557, 0.021649762988090515, 0.014863741584122181, 0.011998875997960567, 0.011746703647077084]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type nature escape long-distance hike / thru-hike\n", + "1 activities [hiking, hut-to-hut hiking, going to the beach] [going to the beach]\n", + "2 climate_or_season warm destination / summer tropical / humid\n", + "3 style_or_comfort minimalist minimalist\n", + "4 dress_code casual casual\n", + "5 accommodation huts with half board huts with half board\n", + "6 transportation vehicle vehicle\n", + "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity\n", + "8 trip_length_days 7+ days 6 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.000000\n", + "1 0.333333 1.00 0.500000\n", + "2 0.444444 0.00 1.000000\n", + "3 0.333333 1.00 0.000000\n", + "4 0.444444 1.00 0.000000\n", + "5 0.444444 1.00 0.666667\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['beach vacation', 'road trip (car/camper)', 'nature escape', 'micro-adventure / weekend trip', 'festival trip', 'digital nomad trip', 'cultural exploration', 'city trip', 'camping trip (campground)', 'hut trek (winter)', 'hut trek (summer)', 'long-distance hike / thru-hike', 'yoga / wellness retreat', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'ski tour / skitour'], 'scores': [0.8424649238586426, 0.052122071385383606, 0.045149654150009155, 0.016546053811907768, 0.00966702401638031, 0.007702015805989504, 0.004779668524861336, 0.004560756962746382, 0.0023846791591495275, 0.0023726094514131546, 0.002371410606428981, 0.00234890915453434, 0.0020649293437600136, 0.0020323314238339663, 0.0018846038728952408, 0.0015484279720112681]}\n", + "beach vacation\n", + "0\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['going to the beach', 'surfing', 'stand-up paddleboarding (SUP)', 'running', 'kayaking / canoeing', 'relaxing', 'swimming', 'photography', 'sightseeing', 'rafting', 'hut-to-hut hiking', 'yoga', 'fishing', 'hiking', 'biking', 'horseback riding', 'snorkeling', 'skiing', 'rock climbing', 'paragliding', 'ice climbing', 'snowshoe hiking', 'ski touring', 'scuba diving', 'cross-country skiing'], 'scores': [0.9920135736465454, 0.9526715278625488, 0.9424984455108643, 0.19494973123073578, 0.02892795391380787, 0.011631068773567677, 0.004414754454046488, 0.0006122476770542562, 0.0005591650260612369, 0.00039036732050590217, 0.0002494072250556201, 0.0002450320462230593, 0.0002269407268613577, 0.000170115425135009, 0.00014811556320637465, 0.00010454187577124685, 0.00010332300735171884, 9.331753244623542e-05, 8.935244841268286e-05, 8.883540431270376e-05, 8.413659816142172e-05, 8.254400745499879e-05, 7.817314326530322e-05, 7.580930832773447e-05, 6.3187864725478e-05]}\n", + "['going to the beach', 'surfing', 'stand-up paddleboarding (SUP)']\n", + "1\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['variable weather / spring / autumn', 'cold destination / winter', 'warm destination / summer', 'tropical / humid', 'dry / desert-like'], 'scores': [0.6218664050102234, 0.14698372781276703, 0.13569146394729614, 0.0680992528796196, 0.027359161525964737]}\n", + "variable weather / spring / autumn\n", + "2\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['ultralight', 'lightweight (but comfortable)', 'minimalist', 'luxury (including evening wear)'], 'scores': [0.530884325504303, 0.24740535020828247, 0.1111086905002594, 0.11060160398483276]}\n", + "ultralight\n", + "3\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.5781950354576111, 0.35012683272361755, 0.07167812436819077]}\n", + "casual\n", + "4\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.8374345898628235, 0.14991936087608337, 0.008760198019444942, 0.0038858656771481037]}\n", + "sleeping in a tent\n", + "5\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9654665589332581, 0.03453344106674194]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['self-supported (bring your own food/cooking)', 'off-grid / no electricity', 'no special conditions', 'pet-friendly', 'child-friendly', 'rainy climate', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.2636737525463104, 0.18892917037010193, 0.1361442506313324, 0.13264372944831848, 0.09250619262456894, 0.07673879712820053, 0.04546836018562317, 0.04477165639400482, 0.019124098122119904]}\n", + "self-supported (bring your own food/cooking)\n", + "7\n", + "{'sequence': 'I will go with a friend on a beach holiday and we will do stand-up paddling, and surfing in the North of Spain. The destination is windy and can get cold, but is generally sunny. We will go by car and bring a tent to sleep in. It will be two weeks.', 'labels': ['7+ days', '6 days', '7 days', '5 days', '4 days', '2 days', '3 days', '1 day'], 'scores': [0.38457050919532776, 0.1673465073108673, 0.14360207319259644, 0.11416381597518921, 0.06863638758659363, 0.0520939901471138, 0.046323563903570175, 0.0232631154358387]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type beach vacation beach vacation\n", + "1 activities [going to the beach, surfing, stand-up paddleb... [stand-up paddleboarding (SUP), surfing]\n", + "2 climate_or_season variable weather / spring / autumn cold destination / winter\n", + "3 style_or_comfort ultralight ultralight\n", + "4 dress_code casual casual\n", + "5 accommodation sleeping in a tent sleeping in a tent\n", + "6 transportation vehicle vehicle\n", + "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity\n", + "8 trip_length_days 7+ days 6 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.000000\n", + "1 0.333333 1.00 0.500000\n", + "2 0.444444 0.00 1.000000\n", + "3 0.333333 1.00 0.000000\n", + "4 0.444444 1.00 0.000000\n", + "5 0.444444 1.00 0.666667\n", + "6 0.555556 1.00 0.333333\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga / wellness retreat', 'nature escape', 'micro-adventure / weekend trip', 'cultural exploration', 'digital nomad trip', 'festival trip', 'city trip', 'hut trek (winter)', 'road trip (car/camper)', 'beach vacation', 'ski tour / skitour', 'long-distance hike / thru-hike', 'camping trip (campground)', 'camping trip (wild camping)', 'snowboard / splitboard trip', 'hut trek (summer)'], 'scores': [0.74217689037323, 0.09625624120235443, 0.055444952100515366, 0.028388148173689842, 0.02349301613867283, 0.012203863821923733, 0.009713404811918736, 0.006852505728602409, 0.004789318423718214, 0.004382884595543146, 0.003765304572880268, 0.003622791962698102, 0.002603724831715226, 0.0023082902189344168, 0.0022947373799979687, 0.0017039375379681587]}\n", + "yoga / wellness retreat\n", + "0\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['yoga', 'hiking', 'relaxing', 'snowshoe hiking', 'hut-to-hut hiking', 'ice climbing', 'rock climbing', 'horseback riding', 'swimming', 'running', 'sightseeing', 'stand-up paddleboarding (SUP)', 'going to the beach', 'photography', 'snorkeling', 'cross-country skiing', 'biking', 'ski touring', 'surfing', 'fishing', 'skiing', 'kayaking / canoeing', 'paragliding', 'scuba diving', 'rafting'], 'scores': [0.8492046594619751, 0.6415605545043945, 0.48942187428474426, 0.15107616782188416, 0.022720757871866226, 0.005493790376931429, 0.004362862557172775, 0.0035604359582066536, 0.0025915896985679865, 0.0024332485627382994, 0.0021809833124279976, 0.0019110202556475997, 0.0011951607884839177, 0.0010689860209822655, 0.001003915793262422, 0.0008895954233594239, 0.0007194960489869118, 0.000655113544780761, 0.000601101026404649, 0.0004903521039523184, 0.0004634983488358557, 0.0003716421779245138, 0.0003238141362089664, 0.0003046975762117654, 0.0002747876278590411]}\n", + "['yoga', 'hiking']\n", + "1\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['cold destination / winter', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid', 'dry / desert-like'], 'scores': [0.9471889138221741, 0.021895499899983406, 0.012388203293085098, 0.009448436088860035, 0.00907894503325224]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['luxury (including evening wear)', 'minimalist', 'ultralight', 'lightweight (but comfortable)'], 'scores': [0.3255053162574768, 0.22910459339618683, 0.22417910397052765, 0.2212110310792923]}\n", + "luxury (including evening wear)\n", + "3\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.642772376537323, 0.3136065900325775, 0.04362105205655098]}\n", + "casual\n", + "4\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.45050886273384094, 0.3199365735054016, 0.13311396539211273, 0.0964406430721283]}\n", + "indoor\n", + "5\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['no vehicle', 'vehicle'], 'scores': [0.5035094618797302, 0.4964905083179474]}\n", + "no vehicle\n", + "6\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['pet-friendly', 'snow and ice', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'child-friendly', 'rainy climate', 'high alpine terrain', 'no special conditions', 'avalanche-prone terrain'], 'scores': [0.20113274455070496, 0.18143297731876373, 0.1281966269016266, 0.12688273191452026, 0.10568756610155106, 0.09556522965431213, 0.07762978971004486, 0.06777562201023102, 0.015696685761213303]}\n", + "pet-friendly\n", + "7\n", + "{'sequence': 'We will go to Sweden in the winter, to go for a yoga and sauna/wellness retreat. I prefer lightweight packing and also want clothes to go for fancy dinners and maybe on a winter hike. We stay in hotels.', 'labels': ['7+ days', '7 days', '6 days', '4 days', '5 days', '1 day', '3 days', '2 days'], 'scores': [0.19246383011341095, 0.12628361582756042, 0.12603610754013062, 0.11952764540910721, 0.11401552706956863, 0.1101016104221344, 0.10996993631124496, 0.10160179436206818]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type yoga / wellness retreat yoga / wellness retreat\n", + "1 activities [yoga, hiking] [hut-to-hut hiking, yoga]\n", + "2 climate_or_season cold destination / winter cold destination / winter\n", + "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable)\n", + "4 dress_code casual formal (business trip)\n", + "5 accommodation indoor sleeping in a tent\n", + "6 transportation no vehicle no vehicle\n", + "7 special_conditions pet-friendly avalanche-prone terrain\n", + "8 trip_length_days 7+ days 7 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.75 0.000000\n", + "1 0.333333 1.00 0.500000\n", + "2 0.444444 0.00 1.000000\n", + "3 0.333333 1.00 0.000000\n", + "4 0.444444 1.00 0.000000\n", + "5 0.444444 1.00 0.666667\n", + "6 0.555556 1.00 0.333333\n", + "7 0.333333 0.50 0.500000\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski tour / skitour', 'digital nomad trip', 'micro-adventure / weekend trip', 'hut trek (winter)', 'nature escape', 'snowboard / splitboard trip', 'cultural exploration', 'road trip (car/camper)', 'city trip', 'festival trip', 'long-distance hike / thru-hike', 'yoga / wellness retreat', 'beach vacation', 'camping trip (campground)', 'hut trek (summer)', 'camping trip (wild camping)'], 'scores': [0.6277877688407898, 0.10147693753242493, 0.08032911270856857, 0.049313176423311234, 0.03282054141163826, 0.023940999060869217, 0.019064947962760925, 0.016684003174304962, 0.013051704503595829, 0.0089231813326478, 0.0070185353979468346, 0.005841666366904974, 0.004441345110535622, 0.003346299286931753, 0.0030660738702863455, 0.0028937174938619137]}\n", + "ski tour / skitour\n", + "0\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['ski touring', 'skiing', 'cross-country skiing', 'stand-up paddleboarding (SUP)', 'surfing', 'running', 'photography', 'swimming', 'relaxing', 'snowshoe hiking', 'horseback riding', 'ice climbing', 'biking', 'rock climbing', 'kayaking / canoeing', 'fishing', 'hut-to-hut hiking', 'sightseeing', 'snorkeling', 'going to the beach', 'hiking', 'yoga', 'paragliding', 'scuba diving', 'rafting'], 'scores': [0.9693604111671448, 0.8987270593643188, 0.3836323022842407, 0.0930146872997284, 0.0707859992980957, 0.0568058155477047, 0.054869573563337326, 0.04586975648999214, 0.04119567945599556, 0.0407184436917305, 0.03190801665186882, 0.025626182556152344, 0.01811041496694088, 0.01370724942535162, 0.013295331038534641, 0.012912402860820293, 0.010964828543365002, 0.009949550963938236, 0.00915785226970911, 0.006088017951697111, 0.005409067030996084, 0.004837491549551487, 0.0037431824021041393, 0.003286615712568164, 0.0006043871399015188]}\n", + "['ski touring', 'skiing']\n", + "1\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['cold destination / winter', 'dry / desert-like', 'variable weather / spring / autumn', 'warm destination / summer', 'tropical / humid'], 'scores': [0.990604817867279, 0.004373250529170036, 0.0024099540896713734, 0.0017728792736306787, 0.0008389907306991518]}\n", + "cold destination / winter\n", + "2\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['minimalist', 'lightweight (but comfortable)', 'ultralight', 'luxury (including evening wear)'], 'scores': [0.39435455203056335, 0.29837822914123535, 0.26335230469703674, 0.04391491040587425]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['conservative', 'casual', 'formal (business trip)'], 'scores': [0.4866763949394226, 0.45126742124557495, 0.06205620989203453]}\n", + "conservative\n", + "4\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.4471704363822937, 0.4278737008571625, 0.06446021795272827, 0.06049559265375137]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.5295488238334656, 0.4704512059688568]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['high alpine terrain', 'snow and ice', 'off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'rainy climate', 'child-friendly', 'pet-friendly', 'no special conditions', 'avalanche-prone terrain'], 'scores': [0.2215374857187271, 0.20641450583934784, 0.1480192095041275, 0.1283065527677536, 0.087259441614151, 0.06202260032296181, 0.04981611296534538, 0.04899971932172775, 0.04762434586882591]}\n", + "high alpine terrain\n", + "7\n", + "{'sequence': 'I go on a skitouring trip where we also make videos/photos and the destination is Japan. Mainly sports clothes and isolation are needed (it is winter). We stay in a guesthouse. It will be 10 days.', 'labels': ['7+ days', '6 days', '7 days', '4 days', '5 days', '3 days', '2 days', '1 day'], 'scores': [0.7842941284179688, 0.03461426496505737, 0.03410837799310684, 0.0328315868973732, 0.03218388929963112, 0.029369475319981575, 0.02771950326859951, 0.024878760799765587]}\n", + "7+ days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type ski tour / skitour ski tour / skitour\n", + "1 activities [ski touring, skiing] [ski touring, photography, swimming]\n", + "2 climate_or_season cold destination / winter cold destination / winter\n", + "3 style_or_comfort minimalist minimalist\n", + "4 dress_code conservative conservative\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions high alpine terrain avalanche-prone terrain\n", + "8 trip_length_days 7+ days 5 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.750000 0.000000\n", + "1 0.333333 1.000000 0.500000\n", + "2 0.444444 0.000000 1.000000\n", + "3 0.333333 1.000000 0.000000\n", + "4 0.444444 1.000000 0.000000\n", + "5 0.444444 1.000000 0.666667\n", + "6 0.555556 1.000000 0.333333\n", + "7 0.333333 0.500000 0.500000\n", + "8 0.444444 0.333333 0.500000\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['camping trip (wild camping)', 'micro-adventure / weekend trip', 'nature escape', 'road trip (car/camper)', 'camping trip (campground)', 'cultural exploration', 'digital nomad trip', 'beach vacation', 'festival trip', 'hut trek (summer)', 'city trip', 'long-distance hike / thru-hike', 'hut trek (winter)', 'ski tour / skitour', 'yoga / wellness retreat', 'snowboard / splitboard trip'], 'scores': [0.5653408169746399, 0.16596493124961853, 0.1550244241952896, 0.06219211965799332, 0.02012023888528347, 0.006907567847520113, 0.00554176140576601, 0.0039147986099123955, 0.0036774182226508856, 0.0029754680581390858, 0.0022333606611937284, 0.0013145286357030272, 0.001251422567293048, 0.0012501205783337355, 0.0011948166647925973, 0.0010962533997371793]}\n", + "camping trip (wild camping)\n", + "0\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['kayaking / canoeing', 'snorkeling', 'swimming', 'running', 'going to the beach', 'relaxing', 'rafting', 'stand-up paddleboarding (SUP)', 'fishing', 'scuba diving', 'sightseeing', 'photography', 'surfing', 'hut-to-hut hiking', 'hiking', 'yoga', 'biking', 'rock climbing', 'horseback riding', 'ice climbing', 'snowshoe hiking', 'paragliding', 'cross-country skiing', 'ski touring', 'skiing'], 'scores': [0.9741191864013672, 0.8313708305358887, 0.08023631572723389, 0.0619945228099823, 0.04943564161658287, 0.02998538129031658, 0.00321459979750216, 0.0028121459763497114, 0.0021254396997392178, 0.00206172838807106, 0.0018922867020592093, 0.001279529882594943, 0.0009366609156131744, 0.0009194213780574501, 0.000556303421035409, 0.0005088432226330042, 0.00025728336186148226, 0.00025180858210660517, 0.00023011150187812746, 0.00019034721481148154, 0.00019007424998562783, 0.00017735426081344485, 0.00017349272093269974, 0.00017041667888406664, 0.0001519768702564761]}\n", + "['kayaking / canoeing', 'snorkeling']\n", + "1\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.5092107057571411, 0.40236932039260864, 0.07266531139612198, 0.008410264737904072, 0.007344490382820368]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.6200836896896362, 0.20289665460586548, 0.1540537029504776, 0.022965911775827408]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.7067448496818542, 0.2135496884584427, 0.07970546931028366]}\n", + "casual\n", + "4\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['sleeping in a tent', 'sleeping in a car', 'huts with half board', 'indoor'], 'scores': [0.7308037281036377, 0.18550406396389008, 0.054551079869270325, 0.0291411355137825]}\n", + "sleeping in a tent\n", + "5\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.9714846014976501, 0.02851540595293045]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['self-supported (bring your own food/cooking)', 'off-grid / no electricity', 'pet-friendly', 'no special conditions', 'child-friendly', 'high alpine terrain', 'rainy climate', 'snow and ice', 'avalanche-prone terrain'], 'scores': [0.4884524345397949, 0.10804614424705505, 0.10726279765367508, 0.08764053136110306, 0.08023235946893692, 0.04013073816895485, 0.038666050881147385, 0.0337497815489769, 0.01581917703151703]}\n", + "self-supported (bring your own food/cooking)\n", + "7\n", + "{'sequence': 'We plan a wild camping trip with activities such as snorkeling, kayaking and canoeing. It is a warm place and we want to bring little stuff. We stay in tents and hammocks and travel with a car, it will be 3 days.', 'labels': ['3 days', '4 days', '1 day', '2 days', '5 days', '6 days', '7 days', '7+ days'], 'scores': [0.9294797778129578, 0.01445760764181614, 0.012593325227499008, 0.010713724419474602, 0.00934701506048441, 0.008914248086512089, 0.008393170312047005, 0.0061011724174022675]}\n", + "3 days\n", + "8\n", + " superclass pred_class true_class\n", + "0 activity_type camping trip (wild camping) camping trip (wild camping)\n", + "1 activities [kayaking / canoeing, snorkeling] [scuba diving, kayaking / canoeing]\n", + "2 climate_or_season warm destination / summer tropical / humid\n", + "3 style_or_comfort minimalist lightweight (but comfortable)\n", + "4 dress_code casual conservative\n", + "5 accommodation sleeping in a tent sleeping in a tent\n", + "6 transportation vehicle vehicle\n", + "7 special_conditions self-supported (bring your own food/cooking) no special conditions\n", + "8 trip_length_days 3 days 3 days\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.750000 0.000000\n", + "1 0.333333 1.000000 0.500000\n", + "2 0.444444 0.000000 1.000000\n", + "3 0.333333 1.000000 0.000000\n", + "4 0.444444 1.000000 0.000000\n", + "5 0.444444 1.000000 0.666667\n", + "6 0.555556 1.000000 0.333333\n", + "7 0.333333 0.500000 0.500000\n", + "8 0.444444 0.333333 0.500000\n", + "9 0.444444 0.500000 0.500000\n" + ] + } + ], + "source": [ + "result_list = []\n", + "performance = pd.DataFrame(columns=['accuracy', 'true_ident', 'false_pred'])\n", + " \n", + "for i in range(len(trip_descriptions)):\n", + " current_trip = trip_descriptions[i]\n", + " current_type = trip_types[i]\n", + " df = pred_trip(current_trip, current_type, cut_off = 0.5)\n", + " print(df)\n", + " \n", + " # accuracy, perc true classes identified and perc wrong pred classes\n", + " performance.loc[i] = perf_measure(df)\n", + " print(performance)\n", + " \n", + " result_list.append(df)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "031594fd-9a98-4c0e-8777-bfe5b4042c48", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ superclass pred_class true_class same\n", + "0 activity_type beach vacation beach vacation True\n", + "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking] False\n", + "2 climate_or_season warm destination / summer warm destination / summer True\n", + "3 style_or_comfort minimalist lightweight (but comfortable) False\n", + "4 dress_code casual casual True\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions off-grid / no electricity no special conditions False\n", + "8 trip_length_days 7+ days 7 days False, superclass pred_class true_class same\n", + "0 activity_type city trip city trip True\n", + "1 activities [sightseeing, running] [sightseeing] False\n", + "2 climate_or_season variable weather / spring / autumn variable weather / spring / autumn True\n", + "3 style_or_comfort ultralight luxury (including evening wear) False\n", + "4 dress_code conservative casual False\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions pet-friendly no special condition False\n", + "8 trip_length_days 3 days 3 days True, superclass pred_class true_class same\n", + "0 activity_type micro-adventure / weekend trip city trip False\n", + "1 activities [running] [relaxing] False\n", + "2 climate_or_season cold destination / winter cold destination / winter True\n", + "3 style_or_comfort lightweight (but comfortable) lightweight (but comfortable) True\n", + "4 dress_code casual casual True\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions off-grid / no electricity no special condition False\n", + "8 trip_length_days 7+ days 7+ days True, superclass pred_class true_class same\n", + "0 activity_type cultural exploration cultural exploration True\n", + "1 activities [hiking, rafting, sightseeing] [sightseeing, hiking, rafting] False\n", + "2 climate_or_season warm destination / summer variable weather / spring / autumn False\n", + "3 style_or_comfort minimalist lightweight (but comfortable) False\n", + "4 dress_code casual casual True\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions self-supported (bring your own food/cooking) rainy climate False\n", + "8 trip_length_days 7+ days 7+ days True, superclass pred_class true_class same\n", + "0 activity_type nature escape nature escape True\n", + "1 activities [hiking, swimming, relaxing] [swimming, relaxing, hiking] False\n", + "2 climate_or_season warm destination / summer warm destination / summer True\n", + "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable) False\n", + "4 dress_code casual casual True\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions pet-friendly no special conditions False\n", + "8 trip_length_days 7+ days 7+ days True, superclass pred_class true_class same\n", + "0 activity_type nature escape long-distance hike / thru-hike False\n", + "1 activities [hiking, hut-to-hut hiking, going to the beach] [going to the beach] False\n", + "2 climate_or_season warm destination / summer tropical / humid False\n", + "3 style_or_comfort minimalist minimalist True\n", + "4 dress_code casual casual True\n", + "5 accommodation huts with half board huts with half board True\n", + "6 transportation vehicle vehicle True\n", + "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity False\n", + "8 trip_length_days 7+ days 6 days False, superclass pred_class true_class same\n", + "0 activity_type beach vacation beach vacation True\n", + "1 activities [going to the beach, surfing, stand-up paddleb... [stand-up paddleboarding (SUP), surfing] False\n", + "2 climate_or_season variable weather / spring / autumn cold destination / winter False\n", + "3 style_or_comfort ultralight ultralight True\n", + "4 dress_code casual casual True\n", + "5 accommodation sleeping in a tent sleeping in a tent True\n", + "6 transportation vehicle vehicle True\n", + "7 special_conditions self-supported (bring your own food/cooking) off-grid / no electricity False\n", + "8 trip_length_days 7+ days 6 days False, superclass pred_class true_class same\n", + "0 activity_type yoga / wellness retreat yoga / wellness retreat True\n", + "1 activities [yoga, hiking] [hut-to-hut hiking, yoga] False\n", + "2 climate_or_season cold destination / winter cold destination / winter True\n", + "3 style_or_comfort luxury (including evening wear) lightweight (but comfortable) False\n", + "4 dress_code casual formal (business trip) False\n", + "5 accommodation indoor sleeping in a tent False\n", + "6 transportation no vehicle no vehicle True\n", + "7 special_conditions pet-friendly avalanche-prone terrain False\n", + "8 trip_length_days 7+ days 7 days False, superclass pred_class true_class same\n", + "0 activity_type ski tour / skitour ski tour / skitour True\n", + "1 activities [ski touring, skiing] [ski touring, photography, swimming] False\n", + "2 climate_or_season cold destination / winter cold destination / winter True\n", + "3 style_or_comfort minimalist minimalist True\n", + "4 dress_code conservative conservative True\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions high alpine terrain avalanche-prone terrain False\n", + "8 trip_length_days 7+ days 5 days False, superclass pred_class true_class same\n", + "0 activity_type camping trip (wild camping) camping trip (wild camping) True\n", + "1 activities [kayaking / canoeing, snorkeling] [scuba diving, kayaking / canoeing] False\n", + "2 climate_or_season warm destination / summer tropical / humid False\n", + "3 style_or_comfort minimalist lightweight (but comfortable) False\n", + "4 dress_code casual conservative False\n", + "5 accommodation sleeping in a tent sleeping in a tent True\n", + "6 transportation vehicle vehicle True\n", + "7 special_conditions self-supported (bring your own food/cooking) no special conditions False\n", + "8 trip_length_days 3 days 3 days True]\n", + " accuracy true_ident false_pred\n", + "0 0.333333 0.750000 0.000000\n", + "1 0.333333 1.000000 0.500000\n", + "2 0.444444 0.000000 1.000000\n", + "3 0.333333 1.000000 0.000000\n", + "4 0.444444 1.000000 0.000000\n", + "5 0.444444 1.000000 0.666667\n", + "6 0.555556 1.000000 0.333333\n", + "7 0.333333 0.500000 0.500000\n", + "8 0.444444 0.333333 0.500000\n", + "9 0.444444 0.500000 0.500000\n", + "\n" + ] + } + ], + "source": [ + "print(result_list)\n", + "print(performance)\n", + "print(type(performance))" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "ed802b5a-82c1-4e2f-abb6-bc9a6dc69b78", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n" + ] + } + ], + "source": [ + "print(type(result_list))\n", + "print(type(result_list[0]))" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "eb33fd31-94e6-40b5-9c36-a32effe77c01", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " superclass same same same same same same same same same same\n", + "0 activity_type True True False True True False True True True True\n", + "1 activities False False False False False False False False False False\n", + "2 climate_or_season True True True False True False False True True False\n", + "3 style_or_comfort False False True False False True True False True False\n", + "4 dress_code True False True True True True True False True False\n", + "5 accommodation False False False False False True True False False True\n", + "6 transportation False False False False False True True True False True\n", + "7 special_conditions False False False False False False False False False False\n", + "8 trip_length_days False True True True True False False False False True\n" + ] + } + ], + "source": [ + "# Extract \"same_value\" column from each DataFrame\n", + "sv_columns = [df['same'] for df in result_list] # 'same' needs to be changed\n", + "sv_columns.insert(0, result_list[0]['superclass'])\n", + "\n", + "# Combine into a new DataFrame (columns side-by-side)\n", + "sv_df = pd.concat(sv_columns, axis=1)\n", + "\n", + "print(sv_df)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "089d394a-cc38-441f-9fb1-6d4816c32fa5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0 activity_type\n", + "1 activities\n", + "2 climate_or_season\n", + "3 style_or_comfort\n", + "4 dress_code\n", + "5 accommodation\n", + "6 transportation\n", + "7 special_conditions\n", + "8 trip_length_days\n", + "Name: superclass, dtype: object\n" + ] + } + ], + "source": [ + "df['row_mean'] = df.mean(axis=1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "fd232953-59e8-4f28-9ce8-11515a2c310b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "accuracy 0.411111\n", + "true_ident 0.708333\n", + "false_pred 0.400000\n", + "dtype: float64\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAA90AAAJOCAYAAACqS2TfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/xnp5ZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABO90lEQVR4nO3deXhU9b0/8E+AMAEloIZVoyBWrShSsSIulSqIS91qXYpVXKpW0ao89lbrTwmlCre1Xu+1SNWqtFbEpWq9rRsi1GuFqihVcakgrhU0LgSJxkDO749eco1hyYQ5mQl5vZ6HR+fke8585jPfyfe8M1tRkiRJAAAAADnXLt8FAAAAwMZK6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgCAVqRv375x8sknr3fc1KlTo6ioKF5//fXUawLWTugGAICIeOKJJ6KioiI+/vjjfJfSalRXV0dFRUXMnj0736VAweqQ7wIAAKAQPPHEEzF+/Pg4+eSTo1u3bvkuZ61eeeWVaNeuMJ47q66ujvHjx0dExLBhw/JbDBSowni0AgVtxYoV+S4BAApGXV1dfPbZZ3m7/kwmE8XFxXm7fiA7QjfkwRtvvBFnn3127LDDDtGpU6fYYost4phjjlnje64+/vjjuOCCC6Jv376RyWRiq622ipNOOikqKyvrx3z22WdRUVER22+/fZSUlETv3r3j29/+dixatCgiImbPnh1FRUWNXvr1+uuvR1FRUUydOrV+28knnxybbrppLFq0KA455JDo0qVLnHDCCRER8T//8z9xzDHHxNZbbx2ZTCbKy8vjggsuiE8//bRR3S+//HIce+yx0b179+jUqVPssMMOcckll0RExKxZs6KoqCjuueeeRvtNmzYtioqKYs6cOdm2FQCaraKiIn70ox9FRES/fv2iqKio/v3QRUVFcc4558Stt94aAwYMiEwmEw8++GBW62vEv9bG73znO7H55ptHSUlJ7L777nHfffdlXeua3tO9YMGC2H///aNTp06x1VZbxc9+9rOoq6tb4/4PPPBA7LvvvrHJJptEly5d4tBDD40FCxY0GLP6fOCdd96JI488MjbddNPo3r17XHjhhbFq1ar629m9e/eIiBg/fnx9zyoqKrK+TbAx8/JyyIOnnnoqnnjiiTj++ONjq622itdffz2mTJkSw4YNixdffDE6d+4cERGffPJJ7LvvvvHSSy/FqaeeGrvttltUVlbGfffdF2+//XaUlZXFqlWr4lvf+lbMnDkzjj/++DjvvPNi+fLlMWPGjHjhhReif//+Wde3cuXKGDlyZOyzzz5x5ZVX1tdz5513RnV1dZx11lmxxRZbxJNPPhnXXHNNvP3223HnnXfW7//cc8/FvvvuG8XFxXHGGWdE3759Y9GiRfHf//3fcfnll8ewYcOivLw8br311jjqqKMaXPett94a/fv3j6FDh25AhwEgO9/+9rfjH//4R9x2223xH//xH1FWVhYRUR8qH3300bjjjjvinHPOibKysujbt29W7/1esGBB7L333rHlllvGRRddFJtssknccccdceSRR8Yf/vCHRuthNpYsWRLf/OY3Y+XKlfXHvv7666NTp06Nxt5yyy0xevToGDlyZPz7v/97VFdXx5QpU2KfffaJZ599Nvr27Vs/dtWqVTFy5MgYMmRIXHnllfHII4/EL3/5y+jfv3+cddZZ0b1795gyZUqcddZZcdRRR8W3v/3tiIgYOHBgs28LbJQSoMVVV1c32jZnzpwkIpLf/e539dsuu+yyJCKSu+++u9H4urq6JEmS5KabbkoiIrnqqqvWOmbWrFlJRCSzZs1q8PPFixcnEZHcfPPN9dtGjx6dRERy0UUXNanuiRMnJkVFRckbb7xRv+0b3/hG0qVLlwbbvlhPkiTJxRdfnGQymeTjjz+u3/bee+8lHTp0SMaNG9foegAgbb/4xS+SiEgWL17cYHtEJO3atUsWLFjQYHs26+sBBxyQ7LLLLslnn31Wv62uri7Za6+9kq985StZ1bnNNtsko0ePrr98/vnnJxGR/O1vf6vf9t577yVdu3ZtcHuWL1+edOvWLTn99NMbHG/JkiVJ165dG2xffT7w05/+tMHYr33ta8ngwYPrL7///vtJRFi7YR28vBzy4It/ea6trY0PPvggtttuu+jWrVs888wz9T/7wx/+ELvuuusa//pdVFRUP6asrCzOPffctY5pjrPOOmudda9YsSIqKytjr732iiRJ4tlnn42IiPfffz8ee+yxOPXUU2Prrbdeaz0nnXRS1NTUxF133VW/7fbbb4+VK1fG9773vWbXDQBp2G+//WKnnXZq1r4ffvhhPProo3HsscfG8uXLo7KyMiorK+ODDz6IkSNHxquvvhrvvPNOs2u7//77Y88994w99tijflv37t3r3x622owZM+Ljjz+O7373u/U1VFZWRvv27WPIkCExa9asRsf+wQ9+0ODyvvvuG6+99lqza4W2yMvLIQ8+/fTTmDhxYtx8883xzjvvRJIk9T9btmxZ/f8vWrQojj766HUea9GiRbHDDjtEhw65ezh36NAhttpqq0bb33zzzbjsssvivvvui48++qjBz1bXvXoh3nnnndd5HTvuuGN8/etfj1tvvTVOO+20iPjXS8v33HPP2G677XJxMwAgZ/r169fsfRcuXBhJksSll14al1566RrHvPfee7Hllls26/hvvPFGDBkypNH2HXbYocHlV199NSIi9t9//zUep7S0tMHlkpKS+pfXr7bZZps1OgcA1k3ohjw499xz4+abb47zzz8/hg4dGl27do2ioqI4/vjj1/qhJxtibc94r/4glC/LZDKNvopk1apVMWLEiPjwww/jxz/+cey4446xySabxDvvvBMnn3xys+o+6aST4rzzzou33347ampqYu7cufGrX/0q6+MAQNrW9P7opq6vq9fICy+8MEaOHLnGfVriD86r67jllluiV69ejX7+5T/gt2/fPvWaoC0QuiEP7rrrrhg9enT88pe/rN/22WefNfpAlv79+8cLL7ywzmP1798//va3v0Vtbe1avz5ks802i4hodPw33nijyTU///zz8Y9//CN++9vfxkknnVS/fcaMGQ3GbbvtthER6607IuL444+PsWPHxm233RaffvppFBcXx3HHHdfkmgAgl7J9W1ZT19fVa2NxcXEMHz68+QWuxTbbbFP/LPYXvfLKKw0ur/5w1R49euSsjg15Kxu0Fd7TDXnQvn37Bi8pj4i45pprGv1l/Oijj46///3va/xqrdX7H3300VFZWbnGZ4hXj9lmm22iffv28dhjjzX4+bXXXptVzV885ur//8///M8G47p37x7f+MY34qabboo333xzjfWsVlZWFgcffHD8/ve/j1tvvTUOOuig+k+LBYCWtskmm0RE4xC9Nk1dX3v06BHDhg2L6667Lt59991Gx3n//febV/D/OuSQQ2Lu3Lnx5JNPNjjmrbfe2mDcyJEjo7S0NK644oqora3NSR2rv+Ekm09yh7bGM92QB9/61rfilltuia5du8ZOO+0Uc+bMiUceeSS22GKLBuN+9KMfxV133RXHHHNMnHrqqTF48OD48MMP47777otf//rXseuuu8ZJJ50Uv/vd72Ls2LHx5JNPxr777hsrVqyIRx55JM4+++w44ogjomvXrnHMMcfENddcE0VFRdG/f//405/+FO+9916Ta95xxx2jf//+ceGFF8Y777wTpaWl8Yc//GGN7+v6r//6r9hnn31it912izPOOCP69esXr7/+evz5z3+O+fPnNxh70kknxXe+852IiJgwYUL2zQSAHBk8eHBERFxyySVx/PHHR3FxcRx22GFrHZ/N+jp58uTYZ599YpdddonTTz89tt1221i6dGnMmTMn3n777fj73//e7Lr/7d/+LW655ZY46KCD4rzzzqv/yrBtttkmnnvuufpxpaWlMWXKlDjxxBNjt912i+OPPz66d+8eb775Zvz5z3+OvffeO+u3eXXq1Cl22mmnuP3222P77bePzTffPHbeeef1frYLtCl5+9x0aMM++uij5JRTTknKysqSTTfdNBk5cmTy8ssvN/oKkCRJkg8++CA555xzki233DLp2LFjstVWWyWjR49OKisr68dUV1cnl1xySdKvX7+kuLg46dWrV/Kd73wnWbRoUf2Y999/Pzn66KOTzp07J5tttlly5plnJi+88MIavzJsk002WWPdL774YjJ8+PBk0003TcrKypLTTz89+fvf/97oGEmSJC+88EJy1FFHJd26dUtKSkqSHXbYIbn00ksbHbOmpibZbLPNkq5duyaffvpp9s0EgByaMGFCsuWWWybt2rWr/7qtiEjGjBmzxvFNXV+TJEkWLVqUnHTSSUmvXr2S4uLiZMstt0y+9a1vJXfddVdWNa7pfOG5555L9ttvv6SkpCTZcsstkwkTJiQ33njjGr8CbdasWcnIkSOTrl27JiUlJUn//v2Tk08+OXn66afrx6ztfGDcuHHJlyPEE088kQwePDjp2LGjrw+DNShKki+93hOgBa1cuTL69OkThx12WNx44435LgcAAHLKe7qBvLr33nvj/fffb/DhbAAAsLHwTDeQF3/729/iueeeiwkTJkRZWVk888wz+S4JAPJqyZIl6/x5p06domvXri1UDZArPkgNyIspU6bE73//+xg0aFBMnTo13+UAQN717t17nT8fPXq0NRNaIc90AwBAAXjkkUfW+fM+ffrETjvt1ELVALkidAMAAEBKfJAaAAAApKTF39NdV1cX//znP6NLly5RVFTU0lcPAAUvSZJYvnx59OnTJ9q1y8/fx63XALBuTV2vWzx0//Of/4zy8vKWvloAaHXeeuut2GqrrfJy3dZrAGia9a3XLR66u3TpEhH/Kqy0tLSlrz7namtr4+GHH44DDzwwiouL811Om6HvLU/P80Pf8yPffa+qqory8vL6NTMf0liv893XjYle5pZ+5o5e5pZ+5k4avWzqet3ioXv1S9RKS0s3mtDduXPnKC0t9UBoQfre8vQ8P/Q9Pwql7/l8WXca63Wh9HVjoJe5pZ+5o5e5pZ+5k2Yv17de+yA1AAAASInQDQAAACkRugEAACAlQjcAAACkJKvQXVFREUVFRQ3+7bjjjmnVBgA0kzUbAApD1p9ePmDAgHjkkUf+7wAdWvwD0AGAJrBmA0D+Zb36dujQIXr16pVGLQBADlmzASD/sg7dr776avTp0ydKSkpi6NChMXHixNh6663XOr6mpiZqamrqL1dVVUXEv74nrba2thklF5bVt2FjuC2tib63PD3PD33Pj3z3PVfXm82a3RLrdb77ujHRy9zSz9zRy9zSz9xJo5dNPVZRkiRJUw/6wAMPxCeffBI77LBDvPvuuzF+/Ph455134oUXXoguXbqscZ+KiooYP358o+3Tpk2Lzp07N/WqAaDNqK6ujlGjRsWyZcuitLS0WcfIds22XgNAdpq6XmcVur/s448/jm222SauuuqqOO2009Y4Zk1/OS8vL4/Kyspmn0gUktra2pgxY0aMGDEiiouL811Om6HvubVzxUPrHZNpl8SE3evi0qfbRU1dUQtU1dgLFSPzcr35ZK7nR777XlVVFWVlZRsUur9sfWt2S6zX+e7rxkQvc0s/c0cvc6u19LMp55L5tvpcNpe9bOp6vUGfqNKtW7fYfvvtY+HChWsdk8lkIpPJNNpeXFxc0BMnWxvb7Wkt9D03alY1PUTX1BVlNT6X2vJ9ba7nR776nsZ1rm/Nbsn12nzOHb3MLf3MHb3MrULvZ77ODZsjl71s6nE26Hu6P/nkk1i0aFH07t17Qw4DAKTMmg0A+ZFV6L7wwgvjL3/5S7z++uvxxBNPxFFHHRXt27eP7373u2nVBwA0gzUbAApDVi8vf/vtt+O73/1ufPDBB9G9e/fYZ599Yu7cudG9e/e06gMAmsGaDQCFIavQPX369LTqAAByyJoNAIVhg97TDQAAAKyd0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASMkGhe5JkyZFUVFRnH/++TkqBwDINes1AORPs0P3U089Fdddd10MHDgwl/UAADlkvQaA/GpW6P7kk0/ihBNOiBtuuCE222yzXNcEAOSA9RoA8q9Dc3YaM2ZMHHrooTF8+PD42c9+ts6xNTU1UVNTU3+5qqoqIiJqa2ujtra2OVdfUFbfho3htrQm+p5bmfbJ+se0Sxr8Nx/a4v1trudHvvueq+sttPU6333dmOhlbuln7uhlbrWWfjblXDLfVp/D5rKXTT1WUZIkWXVo+vTpcfnll8dTTz0VJSUlMWzYsBg0aFBcffXVaxxfUVER48ePb7R92rRp0blz52yuGgDahOrq6hg1alQsW7YsSktLm3UM6zUApKup63VWofutt96K3XffPWbMmFH/3rD1LeJr+st5eXl5VFZWNvtE4st2rngoJ8dpjky7JCbsXheXPt0uauqK1jn2hYqRLVTVxq+2tjZmzJgRI0aMiOLi4nyX0+o15TGUzVxPS1t8DJnr+ZHvvldVVUVZWVmzQ3ehrtf57uvGRC9zSz9zRy9zq7X0M595rKlWn8vmspdNXa+zenn5vHnz4r333ovddtutftuqVavisccei1/96ldRU1MT7du3b7BPJpOJTCbT6FjFxcU5u7E1q/ITABrUUFe03joK+YHSWuVyHrVl2TyGmjLX09KW72tzPT/y1fcNvc5CXa/TPGZbpZe5pZ+5o5e5Vej9LIQ81lS57GVTj5NV6D7ggAPi+eefb7DtlFNOiR133DF+/OMfN1rAAYCWZ70GgMKRVeju0qVL7Lzzzg22bbLJJrHFFls02g4A5If1GgAKR7O/pxsAAABYt2Z9ZdgXzZ49OwdlAABpsl4DQH54phsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFKSVeieMmVKDBw4MEpLS6O0tDSGDh0aDzzwQFq1AQDNZM0GgMKQVejeaqutYtKkSTFv3rx4+umnY//9948jjjgiFixYkFZ9AEAzWLMBoDB0yGbwYYcd1uDy5ZdfHlOmTIm5c+fGgAEDcloYANB81mwAKAxZhe4vWrVqVdx5552xYsWKGDp0aC5rAgByyJoNAPmTdeh+/vnnY+jQofHZZ5/FpptuGvfcc0/stNNOax1fU1MTNTU19ZerqqoiIqK2tjZqa2ubUXJjmfZJTo7TrOtulzT477rk6vbyf73U09xoymMom7melrZ4f5vr+ZHvvufqerNZs1tivc53Xzcmeplb+pk7eplbraWf+cxjTbX6HDaXvWzqsYqSJMmqQ59//nm8+eabsWzZsrjrrrviN7/5TfzlL39Z6yJeUVER48ePb7R92rRp0blz52yuGgDahOrq6hg1alQsW7YsSktLm32cbNZs6zUAZKep63XWofvLhg8fHv3794/rrrtujT9f01/Oy8vLo7KycoNOJL5o54qHcnKc5si0S2LC7nVx6dPtoqauaJ1jX6gY2UJVbfxqa2tjxowZMWLEiCguLs53Oa1eUx5D2cz1tLTFx5C5nh/57ntVVVWUlZVtcOj+snWt2S2xXue7rxsTvcwt/cwdvcyt1tLPfOaxplp9LpvLXjZ1vW72e7pXq6ura7BIf1kmk4lMJtNoe3Fxcc5ubM2q/ASABjXUFa23jkJ+oLRWuZxHbVk2j6GmzPW0tOX72lzPj3z1Pa3rXNea3RLrdZrHbKv0Mrf0M3f0MrcKvZ+FkMeaKpe9bOpxsgrdF198cRx88MGx9dZbx/Lly2PatGkxe/bseOihwv/LBgC0JdZsACgMWYXu9957L0466aR49913o2vXrjFw4MB46KGHYsSIEWnVBwA0gzUbAApDVqH7xhtvTKsOACCHrNkAUBja5bsAAAAA2FgJ3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlGQVuidOnBhf//rXo0uXLtGjR4848sgj45VXXkmrNgCgmazZAFAYsgrdf/nLX2LMmDExd+7cmDFjRtTW1saBBx4YK1asSKs+AKAZrNkAUBg6ZDP4wQcfbHB56tSp0aNHj5g3b1584xvfyGlhAEDzWbMBoDBs0Hu6ly1bFhERm2++eU6KAQDSYc0GgPzI6pnuL6qrq4vzzz8/9t5779h5553XOq6mpiZqamrqL1dVVUVERG1tbdTW1jb36hvItE9ycpxmXXe7pMF/1yVXt5f/66We5kZTHkPZzPW0tMX721zPj3z3PdfX25Q1uyXW63z3dWOil7mln7mjl7nVWvqZzzzWVKvPYXPZy6YeqyhJkmZ16KyzzooHHnggHn/88dhqq63WOq6ioiLGjx/faPu0adOic+fOzblqANioVVdXx6hRo2LZsmVRWlq6wcdrypptvQaA7DR1vW5W6D7nnHPij3/8Yzz22GPRr1+/dY5d01/Oy8vLo7KyMicnEhERO1c8lJPjNEemXRITdq+LS59uFzV1Resc+0LFyBaqauNXW1sbM2bMiBEjRkRxcXG+y2n1mvIYymaup6UtPobM9fzId9+rqqqirKwsJ6G7qWt2S6zX+e7rxkQvc6s19TOf571Nsfp8oTX0sjVoLXOz0OdlRDpzs6nrdVYvL0+SJM4999y45557Yvbs2esN3BERmUwmMplMo+3FxcU5u7E1q/ITABrUUFe03joK+YHSWuVyHrVl2TyGmjLX09KW72tzPT/y1fdcXGe2a3ZLrNdpHrOt0svcag39LITz3qZoDb1sTQq9n61lXkbktpdNPU5WoXvMmDExbdq0+OMf/xhdunSJJUuWRERE165do1OnTtlXCQCkwpoNAIUhq08vnzJlSixbtiyGDRsWvXv3rv93++23p1UfANAM1mwAKAxZv7wcACh81mwAKAwb9D3dAAAAwNoJ3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlGQduh977LE47LDDok+fPlFUVBT33ntvCmUBABvCeg0AhSHr0L1ixYrYddddY/LkyWnUAwDkgPUaAApDh2x3OPjgg+Pggw9OoxYAIEes1wBQGLynGwAAAFKS9TPd2aqpqYmampr6y1VVVRERUVtbG7W1tTm5jkz7JCfHadZ1t0sa/HddcnV7+b9e6mluNOUxlM1cT0tbvL/N9fzId9/zcb0tsV7nu68bE73MrdbUz3ye9zbF6vOE1tDL1qC1zM1Cn5cR6czNph6rKEmSZneoqKgo7rnnnjjyyCPXOqaioiLGjx/faPu0adOic+fOzb1qANhoVVdXx6hRo2LZsmVRWlq6wcezXgNA7jV1vU49dK/pL+fl5eVRWVmZkxOJiIidKx7KyXGaI9MuiQm718WlT7eLmrqidY59oWJkC1W18autrY0ZM2bEiBEjori4ON/ltHpNeQxlM9fT0hYfQ219rufr93u28z3Xc7OqqirKyspaNHS3xHq9ej7n8/dIUxX675vW9Lshn+dpTbX6Ma+fG04vc6u19LOt9rKp63XqLy/PZDKRyWQabS8uLs7Zja1Zlf+Fu6auaL11FPIDpbXK5Txqy7J5DDVlrqelLd/XbXWu5/v3e1Pne67vm3zc1y2xXq+Wz98jTdVaHm+t4XdDod/XX6SfuaOXuVXo/WyrvWzqcbIO3Z988kksXLiw/vLixYtj/vz5sfnmm8fWW2+d7eEAgBRYrwGgMGQdup9++un45je/WX957NixERExevTomDp1as4KAwCaz3oNAIUh69A9bNiw2IC3gQMALcB6DQCFwfd0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASpoVuidPnhx9+/aNkpKSGDJkSDz55JO5rgsA2EDWawDIv6xD9+233x5jx46NcePGxTPPPBO77rprjBw5Mt5777006gMAmsF6DQCFIevQfdVVV8Xpp58ep5xySuy0007x61//Ojp37hw33XRTGvUBAM1gvQaAwpBV6P78889j3rx5MXz48P87QLt2MXz48JgzZ07OiwMAsme9BoDC0SGbwZWVlbFq1aro2bNng+09e/aMl19+eY371NTURE1NTf3lZcuWRUTEhx9+GLW1tdnWu0YdVq7IyXGadd11SVRX10WH2naxqq5onWM/+OCDFqpq41dbWxvV1dXxwQcfRHFxcb7LafWa8hjKZq6npS0+htr6XM/X7/ds53uu5+by5csjIiJJkmbtX6jr9er5nM/fI01V6L9vWtPvhnyepzXV6se8fm44vcyt1tLPttrLpq7XWYXu5pg4cWKMHz++0fZ+/fqlfdUtZlQTx5X9MtUyIHVNnetp8RiiJWUz39Oam8uXL4+uXbumc/AvaQvrdTb8vml78r3GbUz0Mrf0M3fS6uX61uusQndZWVm0b98+li5d2mD70qVLo1evXmvc5+KLL46xY8fWX66rq4sPP/wwtthiiygqKuy/cjdFVVVVlJeXx1tvvRWlpaX5LqfN0PeWp+f5oe/5ke++J0kSy5cvjz59+jRr/0Jdr/Pd142JXuaWfuaOXuaWfuZOGr1s6nqdVeju2LFjDB48OGbOnBlHHnlkRPxrUZ45c2acc845a9wnk8lEJpNpsK1bt27ZXG2rUFpa6oGQB/re8vQ8P/Q9P/LZ9w15hrvQ12vzOXf0Mrf0M3f0Mrf0M3dy3cumrNdZv7x87NixMXr06Nh9991jjz32iKuvvjpWrFgRp5xySrOKBAByz3oNAIUh69B93HHHxfvvvx+XXXZZLFmyJAYNGhQPPvhgow9rAQDyx3oNAIWhWR+kds4556z15WltTSaTiXHjxjV6SR7p0veWp+f5oe/5sbH0vdDW642lr4VAL3NLP3NHL3NLP3Mnn70sSpr7fSQAAADAOrXLdwEAAACwsRK6AQAAICVCNwAAAKRE6P6SyZMnR9++faOkpCSGDBkSTz755FrH3n333bH77rtHt27dYpNNNolBgwbFLbfc0mDMySefHEVFRQ3+HXTQQWnfjFYnm75/0fTp06OoqKj+e2hXS5IkLrvssujdu3d06tQphg8fHq+++moKlbduue67+d402fR96tSpjXpaUlLSYIz53jS57rv5vmbZ/l658847Y8cdd4ySkpLYZZdd4v7772+hSgtfNr284YYbYt99943NNtssNttssxg+fHiTf6e3Fble89qybHv58ccfx5gxY6J3796RyWRi++2391j/gmz7efXVV8cOO+wQnTp1ivLy8rjgggvis88+a6FqC9djjz0Whx12WPTp0yeKiori3nvvXe8+s2fPjt122y0ymUxst912MXXq1HSKS6g3ffr0pGPHjslNN92ULFiwIDn99NOTbt26JUuXLl3j+FmzZiV333138uKLLyYLFy5Mrr766qR9+/bJgw8+WD9m9OjRyUEHHZS8++679f8+/PDDlrpJrUK2fV9t8eLFyZZbbpnsu+++yRFHHNHgZ5MmTUq6du2a3Hvvvcnf//735PDDD0/69euXfPrppynektYljb6b7+uXbd9vvvnmpLS0tEFPlyxZ0mCM+b5+afTdfG8s2z7/9a9/Tdq3b5/8/Oc/T1588cXk//2//5cUFxcnzz//fAtXXniy7eWoUaOSyZMnJ88++2zy0ksvJSeffHLStWvX5O23327hygtTGmteW5VtL2tqapLdd989OeSQQ5LHH388Wbx4cTJ79uxk/vz5LVx5Ycq2n7feemuSyWSSW2+9NVm8eHHy0EMPJb17904uuOCCFq688Nx///3JJZdcktx9991JRCT33HPPOse/9tprSefOnZOxY8cmL774YnLNNdc0ynK5InR/wR577JGMGTOm/vKqVauSPn36JBMnTmzyMb72ta8l/+///b/6y6NHj/ZLej2a0/eVK1cme+21V/Kb3/ymUY/r6uqSXr16Jb/4xS/qt3388cdJJpNJbrvttlRuQ2uU674nifneFNn2/eabb066du261uOZ702T674nifm+Jtn2+dhjj00OPfTQBtuGDBmSnHnmmanW2Rps6DnJypUrky5duiS//e1v0yqxVUljzWursu3llClTkm233Tb5/PPPW6rEViXbfo4ZMybZf//9G2wbO3Zssvfee6daZ2vTlND9b//2b8mAAQMabDvuuOOSkSNH5rweLy//X59//nnMmzcvhg8fXr+tXbt2MXz48JgzZ85690+SJGbOnBmvvPJKfOMb32jws9mzZ0ePHj1ihx12iLPOOis++OCDnNffWjW37z/96U+jR48ecdpppzX62eLFi2PJkiUNjtm1a9cYMmRIk+7LtiCNvq9mvq9dc/v+ySefxDbbbBPl5eVxxBFHxIIFC+p/Zr6vXxp9X818/z/N6fOcOXMajI+IGDlyZJufuxt6ThIRUV1dHbW1tbH55punVWarkeaa19Y0p5f33XdfDB06NMaMGRM9e/aMnXfeOa644opYtWpVS5VdsJrTz7322ivmzZtX/xL01157Le6///445JBDWqTmjUlLrkEdcn7EVqqysjJWrVoVPXv2bLC9Z8+e8fLLL691v2XLlsWWW24ZNTU10b59+7j22mtjxIgR9T8/6KCD4tvf/nb069cvFi1aFD/5yU/i4IMPjjlz5kT79u1Tuz2tRXP6/vjjj8eNN94Y8+fPX+PPlyxZUn+MLx9z9c/aujT6HmG+r09z+r7DDjvETTfdFAMHDoxly5bFlVdeGXvttVcsWLAgttpqK/O9CdLoe4T5/mXN6fOSJUvM3TVo7jnJF/34xz+OPn36NDqhbIvSWvPaoub08rXXXotHH300TjjhhLj//vtj4cKFcfbZZ0dtbW2MGzeuJcouWM3p56hRo6KysjL22WefSJIkVq5cGT/4wQ/iJz/5SUuUvFFZ2xpUVVUVn376aXTq1Cln1yV0b6AuXbrE/Pnz45NPPomZM2fG2LFjY9ttt41hw4ZFRMTxxx9fP3aXXXaJgQMHRv/+/WP27NlxwAEH5Knq1mv58uVx4oknxg033BBlZWX5LqfNaGrfzffcGzp0aAwdOrT+8l577RVf/epX47rrrosJEybksbKNW1P6br5TqCZNmhTTp0+P2bNnN/oAQNbPuUZu1dXVRY8ePeL666+P9u3bx+DBg+Odd96JX/ziF20+dDfH7Nmz44orrohrr702hgwZEgsXLozzzjsvJkyYEJdeemm+y2MthO7/VVZWFu3bt4+lS5c22L506dLo1avXWvdr165dbLfddhERMWjQoHjppZdi4sSJ9aH7y7bddtsoKyuLhQsXOimL7Pu+aNGieP311+Owww6r31ZXVxcRER06dIhXXnmlfr+lS5dG7969Gxxz0KBBKdyK1ieNvvfv37/RfuZ7Q839PfNFxcXF8bWvfS0WLlwYEWG+N0EafV+Ttj7fm9PnXr16bdD9srHakDl75ZVXxqRJk+KRRx6JgQMHpllmq9FSa15b0Jy52bt37yguLm7wCqCvfvWrsWTJkvj888+jY8eOqdZcyJrTz0svvTROPPHE+P73vx8R//qj74oVK+KMM86ISy65JNq18+7hplrbGlRaWprTZ7kjfGVYvY4dO8bgwYNj5syZ9dvq6upi5syZDZ7tWJ+6urqoqalZ68/ffvvt+OCDDxqcHLdl2fZ9xx13jOeffz7mz59f/+/www+Pb37zmzF//vwoLy+Pfv36Ra9evRocs6qqKv72t79ldV9uzNLo+5qY7w3l4vfMqlWr4vnnn6/vqfm+fmn0fU3a+nxvTp+HDh3aYHxExIwZM9r83G3unP35z38eEyZMiAcffDB23333lii1VWipNa8taM7c3HvvvWPhwoX1f7iIiPjHP/4RvXv3btOBO6J5/ayurm4UrFf/QeNfnx9GU7XoGpTzj2ZrxaZPn55kMplk6tSpyYsvvpicccYZSbdu3eq/JubEE09MLrroovrxV1xxRfLwww8nixYtSl588cXkyiuvTDp06JDccMMNSZIkyfLly5MLL7wwmTNnTrJ48eLkkUceSXbbbbfkK1/5SvLZZ5/l5TYWomz7/mVr+kTRSZMmJd26dUv++Mc/Js8991xyxBFH+AqlL8l13833psm27+PHj08eeuihZNGiRcm8efOS448/PikpKUkWLFhQP8Z8X79c9918X7Ns+/zXv/416dChQ3LllVcmL730UjJu3DhfGfa/su3lpEmTko4dOyZ33XVXg6+xW758eb5uQkFJ41yjrcq2l2+++WbSpUuX5JxzzkleeeWV5E9/+lPSo0eP5Gc/+1m+bkJBybaf48aNS7p06ZLcdtttyWuvvZY8/PDDSf/+/ZNjjz02XzehYCxfvjx59tlnk2effTaJiOSqq65Knn322eSNN95IkiRJLrroouTEE0+sH7/6K8N+9KMfJS+99FIyefJkXxnWUq655ppk6623Tjp27Jjsscceydy5c+t/tt9++yWjR4+uv3zJJZck2223XVJSUpJsttlmydChQ5Pp06fX/7y6ujo58MADk+7duyfFxcXJNttsk5x++umNvuuV7Pr+ZWtaCOvq6pJLL7006dmzZ5LJZJIDDjggeeWVV1KqvvXKZd/N96bLpu/nn39+/diePXsmhxxySPLMM880OJ753jS57Lv5vnbZ/l654447ku233z7p2LFjMmDAgOTPf/5zC1dcuLLp5TbbbJNERKN/48aNa/nCC1SuzzXasmx7+cQTTyRDhgxJMplMsu222yaXX355snLlyhauunBl08/a2tqkoqIi6d+/f1JSUpKUl5cnZ599dvLRRx+1fOEFZtasWWv8Pbi6f6NHj07222+/RvsMGjQo6dixY7LtttsmN998cyq1FSWJ1yEAAABAGrynGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuaAFPPfVU7LXXXrHJJptEUVFRzJ8/v0n7TZ06NYqKiuL1119Ptb5CNnv27CgqKorZs2fnuxQAAMhah3wXABu72traOOaYY6KkpCT+4z/+Izp37hzbbLNNvssCAABagNANKVu0aFG88cYbccMNN8T3v//9fJcDAAC0IC8vh5S99957ERHRrVu3/BbSwurq6uKzzz7LdxkAAJBXQjek6OSTT4799tsvIiKOOeaYKCoqimHDhsVzzz0XJ598cmy77bZRUlISvXr1ilNPPTU++OCD9R7z6aefjpEjR0ZZWVl06tQp+vXrF6eeemqDMXV1dXH11VfHgAEDoqSkJHr27BlnnnlmfPTRR1nVX1FREUVFRfHyyy/HscceG6WlpbHFFlvEeeed1yhQFxUVxTnnnBO33nprDBgwIDKZTDz44IMREfHOO+/EqaeeGj179oxMJhMDBgyIm266qdH1vf3223HkkUfGJptsEj169IgLLrggampqsqoZAAAKiZeXQ4rOPPPM2HLLLeOKK66IH/7wh/H1r389evbsGTNmzIjXXnstTjnllOjVq1csWLAgrr/++liwYEHMnTs3ioqK1ni89957Lw488MDo3r17XHTRRdGtW7d4/fXX4+677250vVOnTo1TTjklfvjDH8bixYvjV7/6VTz77LPx17/+NYqLi7O6Hccee2z07ds3Jk6cGHPnzo3/+q//io8++ih+97vfNRj36KOPxh133BHnnHNOlJWVRd++fWPp0qWx55571ofy7t27xwMPPBCnnXZaVFVVxfnnnx8REZ9++mkccMAB8eabb8YPf/jD6NOnT9xyyy3x6KOPZlUrAAAUlARI1axZs5KISO688876bdXV1Y3G3XbbbUlEJI899lj9tptvvjmJiGTx4sVJkiTJPffck0RE8tRTT631+v7nf/4niYjk1ltvbbD9wQcfXOP2dRk3blwSEcnhhx/eYPvZZ5+dRETy97//vX5bRCTt2rVLFixY0GDsaaedlvTu3TuprKxssP34449PunbtWt+Lq6++OomI5I477qgfs2LFimS77bZLIiKZNWtWk+sGAIBC4eXlkAedOnWq///PPvssKisrY88994yIiGeeeWat+61+X/if/vSnqK2tXeOYO++8M7p27RojRoyIysrK+n+DBw+OTTfdNGbNmpV1vWPGjGlw+dxzz42IiPvvv7/B9v322y922mmn+stJksQf/vCHOOywwyJJkgb1jBw5MpYtW1Z/e++///7o3bt3fOc736nfv3PnznHGGWdkXS8AABQKoRvy4MMPP4zzzjsvevbsGZ06dYru3btHv379IiJi2bJla91vv/32i6OPPjrGjx8fZWVlccQRR8TNN9/c4H3Pr776aixbtix69OgR3bt3b/Dvk08+qf9gt2x85StfaXC5f//+0a5du0bfH776Nqz2/vvvx8cffxzXX399o1pOOeWUiPi/D5p74403Yrvttmv00voddtgh63oBAKBQeE835MGxxx4bTzzxRPzoRz+KQYMGxaabbhp1dXVx0EEHRV1d3Vr3Kyoqirvuuivmzp0b//3f/x0PPfRQnHrqqfHLX/4y5s6dW3+cHj16xK233rrGY3Tv3n2D61/be86/+Ax+RNTflu9973sxevToNe4zcODADa4HAAAKldANLeyjjz6KmTNnxvjx4+Oyyy6r3/7qq682+Rh77rln7LnnnnH55ZfHtGnT4oQTTojp06fH97///ejfv3888sgjsffeezcKwc316quvNngWe+HChVFXVxd9+/Zd537du3ePLl26xKpVq2L48OHrHLvNNtvECy+8EEmSNAj1r7zyygbVDgAA+eTl5dDC2rdvHxH/er/zF1199dXr3fejjz5qtN+gQYMiIupfYn7sscfGqlWrYsKECY32X7lyZXz88cdZ1zx58uQGl6+55pqIiDj44IPXuV/79u3j6KOPjj/84Q/xwgsvNPr5+++/X///hxxySPzzn/+Mu+66q35bdXV1XH/99VnXCwAAhcIz3dDCSktL4xvf+Eb8/Oc/j9ra2thyyy3j4YcfjsWLF69339/+9rdx7bXXxlFHHRX9+/eP5cuXxw033BClpaVxyCGHRMS/3vd95plnxsSJE2P+/Plx4IEHRnFxcbz66qtx5513xn/+5382+LCypli8eHEcfvjhcdBBB8WcOXPi97//fYwaNSp23XXX9e47adKkmDVrVgwZMiROP/302GmnneLDDz+MZ555Jh555JH48MMPIyLi9NNPj1/96ldx0kknxbx586J3795xyy23ROfOnbOqFQAAConQDXkwbdq0OPfcc2Py5MmRJEkceOCB8cADD0SfPn3Wud9+++0XTz75ZEyfPj2WLl0aXbt2jT322CNuvfXWBi///vWvfx2DBw+O6667Ln7yk59Ehw4dom/fvvG9730v9t5776zrvf322+Oyyy6Liy66KDp06BDnnHNO/OIXv2jSvj179ownn3wyfvrTn8bdd98d1157bWyxxRYxYMCA+Pd///f6cZ07d46ZM2fGueeeG9dcc0107tw5TjjhhDj44IPjoIMOyrpmAAAoBEXJl1+rCvC/KioqYvz48fH+++9HWVlZvssBAIBWx3u6AQAAICVeXg5t0CeffBKffPLJOsfk4qvFAACgrRO6oQ268sorY/z48esc05QPdgMAANbNe7qhDXrttdfitddeW+eYffbZJ0pKSlqoIgAA2DgJ3QAAAJASH6QGAAAAKWnx93TX1dXFP//5z+jSpUsUFRW19NUDQMFLkiSWL18effr0iXbt/H0cAFqzFg/d//znP6O8vLylrxYAWp233norttpqq3yXAQBsgBYP3V26dImIf51IlJaWbvDxamtr4+GHH44DDzwwiouLN/h4bZ1+5o5e5pZ+5o5e5lYa/ayqqory8vL6NRMAaL1aPHSvfkl5aWlpzkJ3586do7S01MljDuhn7uhlbuln7uhlbqXZT2/DAoDWzxvFAAAAICVCNwAAAKRE6AYAAICUbFDonjRpUhQVFcX555+fo3IAAABg49Hs0P3UU0/FddddFwMHDsxlPQAAALDRaFbo/uSTT+KEE06IG264ITbbbLNc1wQAAAAbhWaF7jFjxsShhx4aw4cPz3U9AAAAsNHI+nu6p0+fHs8880w89dRTTRpfU1MTNTU19Zerqqoi4l/fa1pbW5vt1Tey+hi5OBb6mUt6mVv6mTt6mVtp9NN9AwAbj6IkSZKmDn7rrbdi9913jxkzZtS/l3vYsGExaNCguPrqq9e4T0VFRYwfP77R9mnTpkXnzp2bVzUAbMSqq6tj1KhRsWzZsigtLc13OQDABsgqdN97771x1FFHRfv27eu3rVq1KoqKiqJdu3ZRU1PT4GcRa36mu7y8PCorK3NyIlFbWxszZsyIESNGRHFx8QYfr63Tz9xpTb3cueKhfJewXpl2SUzYva5V9LPQtaa52Rqk0c+qqqooKysTugFgI5DVy8sPOOCAeP755xtsO+WUU2LHHXeMH//4x40Cd0REJpOJTCbTaHtxcXFOT/Zyfby2Tj9zpzX0smZVUb5LaLLW0M/WQi9zK5f9dL8AwMYjq9DdpUuX2HnnnRts22STTWKLLbZotB0AAADaumZ/TzcAAACwbll/evmXzZ49OwdlAAAAwMbHM90AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABISVahe8qUKTFw4MAoLS2N0tLSGDp0aDzwwANp1QYAAACtWlahe6uttopJkybFvHnz4umnn479998/jjjiiFiwYEFa9QEAAECr1SGbwYcddliDy5dffnlMmTIl5s6dGwMGDMhpYQAAANDaZRW6v2jVqlVx5513xooVK2Lo0KG5rAkAAAA2ClmH7ueffz6GDh0an332WWy66aZxzz33xE477bTW8TU1NVFTU1N/uaqqKiIiamtro7a2thklN7T6GLk4FvqZS62pl5n2Sb5LWK9Mu3/V2Br6Weha09xsDdLop/sGADYeRUmSZHW2/fnnn8ebb74Zy5Yti7vuuit+85vfxF/+8pe1Bu+KiooYP358o+3Tpk2Lzp07N69qANiIVVdXx6hRo2LZsmVRWlqa73IAgA2Qdej+suHDh0f//v3juuuuW+PP1/RMd3l5eVRWVubkRKK2tjZmzJgRlz7dLmrqijb4eGl6oWJkvktYr9X9HDFiRBQXF+e7nFatNfVy54qH8l3CemXaJTFh97pW0c9C15rmZmuQRj+rqqqirKxM6AaAjUCz39O9Wl1dXYNQ/WWZTCYymUyj7cXFxTk92aupK4qaVYUdulvTyW2u75+2rDX0stAfO1/UGvrZWuhlbuWyn+4XANh4ZBW6L7744jj44INj6623juXLl8e0adNi9uzZ8dBDhf8sGQAAALS0rEL3e++9FyeddFK8++670bVr1xg4cGA89NBDMWLEiLTqAwAAgFYrq9B94403plUHAAAAbHTa5bsAAAAA2FgJ3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEhJVqF74sSJ8fWvfz26dOkSPXr0iCOPPDJeeeWVtGoDAACAVi2r0P2Xv/wlxowZE3Pnzo0ZM2ZEbW1tHHjggbFixYq06gMAAIBWq0M2gx988MEGl6dOnRo9evSIefPmxTe+8Y2cFgYAAACtXVah+8uWLVsWERGbb775WsfU1NRETU1N/eWqqqqIiKitrY3a2toNufr640REZNolG3ystOXi9qZtdY2todZC15p6mWlf+I+f1Y/x1tDPQtea5mZrkEY/3TcAsPEoSpKkWWfbdXV1cfjhh8fHH38cjz/++FrHVVRUxPjx4xttnzZtWnTu3Lk5Vw0AG7Xq6uoYNWpULFu2LEpLS/NdDgCwAZodus8666x44IEH4vHHH4+tttpqrePW9Ex3eXl5VFZW5uREora2NmbMmBGXPt0uauqKNvh4aXqhYmS+S1iv1f0cMWJEFBcX57ucVq019XLniofyXcJ6ZdolMWH3ulbRz0LXmuZma5BGP6uqqqKsrEzoBoCNQLNeXn7OOefEn/70p3jsscfWGbgjIjKZTGQymUbbi4uLc3qyV1NXFDWrCjt0t6aT21zfP21Za+hloT92vqg19LO10MvcymU/3S8AsPHIKnQnSRLnnntu3HPPPTF79uzo169fWnUBAABAq5dV6B4zZkxMmzYt/vjHP0aXLl1iyZIlERHRtWvX6NSpUyoFAgAAQGuV1fd0T5kyJZYtWxbDhg2L3r171/+7/fbb06oPAAAAWq2sX14OAAAANE1Wz3QDAAAATSd0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKck6dD/22GNx2GGHRZ8+faKoqCjuvffeFMoCAACA1i/r0L1ixYrYddddY/LkyWnUAwAAABuNDtnucPDBB8fBBx+cRi0AAACwUck6dGerpqYmampq6i9XVVVFRERtbW3U1tZu8PFXHyPTLtngY6UtF7c3batrbA21FrrW1MtM+8J//Kx+jLeGfha61jQ3W4M0+um+AYCNR1GSJM0+2y4qKop77rknjjzyyLWOqaioiPHjxzfaPm3atOjcuXNzrxoANlrV1dUxatSoWLZsWZSWlua7HABgA6Qeutf0THd5eXlUVlbm5ESitrY2ZsyYEZc+3S5q6oo2+HhpeqFiZL5LWK/V/RwxYkQUFxfnu5x12rnioXyXsE6ZdklM2L1OL3NkdT8L/bHucZ5brWlu5rKfVVVVUVZWJnQDwEYg9ZeXZzKZyGQyjbYXFxfn9GSvpq4oalYV7ol4RBT8ye0X5fr+SUOh39+r6WVuFfpjvdDv6y8yN3Mrl/0s9PsFAGg639MNAAAAKcn6me5PPvkkFi5cWH958eLFMX/+/Nh8881j6623zmlxAAAA0JplHbqffvrp+OY3v1l/eezYsRERMXr06Jg6dWrOCgMAAIDWLuvQPWzYsNiAz14DAACANsN7ugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJASoRsAAABSInQDAABASoRuAAAASInQDQAAACkRugEAACAlQjcAAACkROgGAACAlAjdAAAAkBKhGwAAAFIidAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAApEboBAAAgJUI3AAAApEToBgAAgJQI3QAAAJCSZoXuyZMnR9++faOkpCSGDBkSTz75ZK7rAgAAgFYv69B9++23x9ixY2PcuHHxzDPPxK677hojR46M9957L436AAAAoNXKOnRfddVVcfrpp8cpp5wSO+20U/z617+Ozp07x0033ZRGfQAAANBqdchm8Oeffx7z5s2Liy++uH5bu3btYvjw4TFnzpw17lNTUxM1NTX1l5ctWxYRER9++GHU1tY2p+YGamtro7q6OjrUtotVdUUbfLw0ffDBB/kuYb1W9/ODDz6I4uLifJezTh1Wrsh3CevUoS6J6uo6vcyR1f0s9Me6x3lutaa5mct+Ll++PCIikiTJyfEAgPzJKnRXVlbGqlWromfPng229+zZM15++eU17jNx4sQYP358o+39+vXL5qo3CmW/zHcFtLRR+S5gI9Ma+ulx3jalNTeXL18eXbt2TenoAEBLyCp0N8fFF18cY8eOrb9cV1cXH374YWyxxRZRVLThz1ZVVVVFeXl5vPXWW1FaWrrBx2vr9DN39DK39DN39DK30uhnkiSxfPny6NOnT06OBwDkT1ahu6ysLNq3bx9Lly5tsH3p0qXRq1evNe6TyWQik8k02NatW7fsqmyC0tJSJ485pJ+5o5e5pZ+5o5e5let+eoYbADYOWX2QWseOHWPw4MExc+bM+m11dXUxc+bMGDp0aM6LAwAAgNYs65eXjx07NkaPHh2777577LHHHnH11VfHihUr4pRTTkmjPgAAAGi1sg7dxx13XLz//vtx2WWXxZIlS2LQoEHx4IMPNvpwtZaSyWRi3LhxjV7CTvPoZ+7oZW7pZ+7oZW7pJwCwLkWJ7yMBAACAVGT1nm4AAACg6YRuAAAASInQDQAAACkRugEAACAlrSJ0T548Ofr27RslJSUxZMiQePLJJ9c5/s4774wdd9wxSkpKYpdddon777+/hSptHbLp5w033BD77rtvbLbZZrHZZpvF8OHD19v/tiTbubna9OnTo6ioKI488sh0C2xlsu3nxx9/HGPGjInevXtHJpOJ7bff3uP9f2Xby6uvvjp22GGH6NSpU5SXl8cFF1wQn332WQtVW7gee+yxOOyww6JPnz5RVFQU995773r3mT17duy2226RyWRiu+22i6lTp6ZeJwBQuAo+dN9+++0xduzYGDduXDzzzDOx6667xsiRI+O9995b4/gnnngivvvd78Zpp50Wzz77bBx55JFx5JFHxgsvvNDClRembPs5e/bs+O53vxuzZs2KOXPmRHl5eRx44IHxzjvvtHDlhSfbXq72+uuvx4UXXhj77rtvC1XaOmTbz88//zxGjBgRr7/+etx1113xyiuvxA033BBbbrllC1deeLLt5bRp0+Kiiy6KcePGxUsvvRQ33nhj3H777fGTn/ykhSsvPCtWrIhdd901Jk+e3KTxixcvjkMPPTS++c1vxvz58+P888+P73//+/HQQw+lXCkAULCSArfHHnskY8aMqb+8atWqpE+fPsnEiRPXOP7YY49NDj300AbbhgwZkpx55pmp1tlaZNvPL1u5cmXSpUuX5Le//W1aJbYazenlypUrk7322iv5zW9+k4wePTo54ogjWqDS1iHbfk6ZMiXZdtttk88//7ylSmw1su3lmDFjkv3337/BtrFjxyZ77713qnW2NhGR3HPPPesc82//9m/JgAEDGmw77rjjkpEjR6ZYGQBQyAr6me7PP/885s2bF8OHD6/f1q5duxg+fHjMmTNnjfvMmTOnwfiIiJEjR651fFvSnH5+WXV1ddTW1sbmm2+eVpmtQnN7+dOf/jR69OgRp512WkuU2Wo0p5/33XdfDB06NMaMGRM9e/aMnXfeOa644opYtWpVS5VdkJrTy7322ivmzZtX/xL01157Le6///445JBDWqTmjYk1CAD4sg75LmBdKisrY9WqVdGzZ88G23v27Bkvv/zyGvdZsmTJGscvWbIktTpbi+b088t+/OMfR58+fRqdVLY1zenl448/HjfeeGPMnz+/BSpsXZrTz9deey0effTROOGEE+L++++PhQsXxtlnnx21tbUxbty4lii7IDWnl6NGjYrKysrYZ599IkmSWLlyZfzgBz/w8vJmWNsaVFVVFZ9++ml06tQpT5UBAPlS0M90U1gmTZoU06dPj3vuuSdKSkryXU6rsnz58jjxxBPjhhtuiLKysnyXs1Goq6uLHj16xPXXXx+DBw+O4447Li655JL49a9/ne/SWp3Zs2fHFVdcEddee20888wzcffdd8ef//znmDBhQr5LAwBo9Qr6me6ysrJo3759LF26tMH2pUuXRq9evda4T69evbIa35Y0p5+rXXnllTFp0qR45JFHYuDAgWmW2Spk28tFixbF66+/Hocddlj9trq6uoiI6NChQ7zyyivRv3//dIsuYM2Zm717947i4uJo3759/bavfvWrsWTJkvj888+jY8eOqdZcqJrTy0svvTROPPHE+P73vx8REbvsskusWLEizjjjjLjkkkuiXTt/n22qta1BpaWlnuUGgDaqoM+kOnbsGIMHD46ZM2fWb6urq4uZM2fG0KFD17jP0KFDG4yPiJgxY8Zax7clzelnRMTPf/7zmDBhQjz44IOx++67t0SpBS/bXu64447x/PPPx/z58+v/HX744fWfcFxeXt6S5Rec5szNvffeOxYuXFj/x4uIiH/84x/Ru3fvNhu4I5rXy+rq6kbBevUfM5IkSa/YjZA1CABoJN+f5LY+06dPTzKZTDJ16tTkxRdfTM4444ykW7duyZIlS5IkSZITTzwxueiii+rH//Wvf006dOiQXHnllclLL72UjBs3LikuLk6ef/75fN2EgpJtPydNmpR07Ngxueuuu5J33323/t/y5cvzdRMKRra9/DKfXt5Qtv188803ky5duiTnnHNO8sorryR/+tOfkh49eiQ/+9nP8nUTCka2vRw3blzSpUuX5Lbbbktee+215OGHH0769++fHHvssfm6CQVj+fLlybPPPps8++yzSUQkV111VfLss88mb7zxRpIkSXLRRRclJ554Yv341157LencuXPyox/9KHnppZeSyZMnJ+3bt08efPDBfN0EACDPCj50J0mSXHPNNcnWW2+ddOzYMdljjz2SuXPn1v9sv/32S0aPHt1g/B133JFsv/32SceOHZMBAwYkf/7zn1u44sKWTT+32WabJCIa/Rs3blzLF16Asp2bXyR0N5ZtP5944olkyJAhSSaTSbbddtvk8ssvT1auXNnCVRembHpZW1ubVFRUJP37909KSkqS8vLy5Oyzz04++uijli+8wMyaNWuNvwNX92/06NHJfvvt12ifQYMGJR07dky23Xbb5Oabb27xugGAwlGUJF47CAAAAGko6Pd0AwAAQGsmdAMAAEBKhG4AAABIidANAAAAKRG6AQAAICVCNwAAAKRE6AYAAICUCN0AAACQEqEbAAAAUiJ0AwAAQEqEbgAAAEiJ0A0AAAAp+f+o22bPdy2VHAAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Compute mean for each column\n", + "column_means = performance.mean()\n", + "print(column_means)\n", + "\n", + "# Plot histograms for all numeric columns\n", + "performance.hist(bins=10, figsize=(10, 6))\n", + "plt.tight_layout()\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b5d7b528-34c2-441a-ba20-117038066033", + "metadata": {}, + "outputs": [], + "source": [ + "# whcih superclass most mistakes?" + ] + }, + { + "cell_type": "markdown", + "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", + "metadata": {}, + "source": [ + "**Use gradio for user input**" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "cb7fd425-d0d6-458d-97ca-2150dc55f206", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7861\n", + "Running on public URL: https://aa06d5d85ffadaa92b.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Map', 'Compass', 'Laptop', 'Car charger', 'Toys', 'Travel crib', 'Hat', 'Playlist', 'Stroller', 'Currency', 'Travel adapter', 'Hostel lock', 'Pen', 'Charging cables', 'Flip-flops', 'Pacifier', 'Camping stove', 'Multi-tool', 'Passport', 'Poncho', 'Hiking boots', 'Portable charger', 'Power bank', 'Trekking poles', 'Snowboard', 'Base layers', 'Bandana', 'Aloe vera gel', 'Gloves', 'Baby blanket', 'Tent', 'Tent', 'Snorkel gear', 'Water filter', 'Diapers', 'Presentation materials', 'Nursing cover', 'Headphones', 'Sunscreen', 'Beach towel', 'Snacks', 'Ski jacket', 'Earplugs', 'Ski goggles', 'Flashlight', 'Neck wallet', 'Swimsuit', 'Notebook', 'Thermal clothing', 'Blanket', 'Snow boots', 'Sleeping bag', 'Lightweight backpack', 'Refillable water bottle', 'Quick-dry towel', 'Comfortable shoes', 'Reusable shopping bags', 'Travel journal', 'Travel pillow', 'Beach bag', 'Reusable coffee mug', 'Reusable water bottle', 'Festival tickets', 'Waterproof phone case', 'Business attire', 'Sunglasses', 'Sunglasses', 'Cooler', 'Baby clothes', 'Fanny pack', 'Beanie', 'First aid kit', 'Emergency roadside kit', 'Dry bag', 'SIM card', 'Energy bars', 'Baby food', 'Work ID badge', 'Packable rain jacket', 'Hand warmers', 'Visa documents', 'Glow sticks', 'Bug spray', 'Travel-sized toiletries', 'Dress shoes', 'Language phrasebook', 'Baby wipes', 'Lip balm', 'Travel insurance documents'], 'scores': [0.013028442859649658, 0.012909057550132275, 0.0124660674482584, 0.012431488372385502, 0.012379261665046215, 0.012377972714602947, 0.012329353019595146, 0.012096051126718521, 0.012086767703294754, 0.011947661638259888, 0.011939236894249916, 0.011935302056372166, 0.011887168511748314, 0.011814153753221035, 0.011788924224674702, 0.011783207766711712, 0.01177265401929617, 0.011771135963499546, 0.011747810058295727, 0.011738969013094902, 0.01169698778539896, 0.01166312862187624, 0.011658026836812496, 0.011596457101404667, 0.01158847101032734, 0.011561167426407337, 0.011526867747306824, 0.01149983424693346, 0.011472185142338276, 0.011455104686319828, 0.011445573531091213, 0.011445573531091213, 0.011444379575550556, 0.011416648514568806, 0.01136692427098751, 0.011363024823367596, 0.011361461132764816, 0.011328471824526787, 0.011299548670649529, 0.011291779577732086, 0.011282541789114475, 0.01127372495830059, 0.011270811781287193, 0.011263585649430752, 0.011179029010236263, 0.011149592697620392, 0.01113132108002901, 0.011122703552246094, 0.011105425655841827, 0.011101326905190945, 0.011090466752648354, 0.011066330596804619, 0.011058374308049679, 0.011055233888328075, 0.01103114802390337, 0.011022195219993591, 0.011012199334800243, 0.01100123766809702, 0.010985593311488628, 0.010961917228996754, 0.010958753526210785, 0.010938071645796299, 0.010903625749051571, 0.010879918932914734, 0.010863620787858963, 0.010824359022080898, 0.010824359022080898, 0.010805793106555939, 0.010763236321508884, 0.010710005648434162, 0.010690474882721901, 0.010647830553352833, 0.010583569295704365, 0.010571518912911415, 0.010570857673883438, 0.010552200488746166, 0.0105352271348238, 0.010523369535803795, 0.010514546185731888, 0.010479346849024296, 0.010450395755469799, 0.010436479933559895, 0.01043587177991867, 0.010400519706308842, 0.010214710608124733, 0.010052643716335297, 0.010041419416666031, 0.010003888048231602, 0.009946384467184544]}\n" + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n" ] } ], "source": [ + "# use model with gradio\n", "from transformers import pipeline\n", "import gradio as gr\n", "\n", - "# Load the model and create a pipeline for zero-shot classification\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", - "\n", - "# Load labels from a txt file\n", - "with open(\"labels.txt\", \"r\", encoding=\"utf-8\") as f:\n", - " class_labels = [line.strip() for line in f if line.strip()]\n", + "# make a function for what I am doing\n", + "def classify(text):\n", + " df = pd.DataFrame(columns=['Superclass', 'class'])\n", + " for i, key in enumerate(keys_list):\n", + " # Run the classification (ca 30 seconds classifying)\n", + " if key == 'activities':\n", + " result = classifier(text, candidate_labels[key], multi_label=True)\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(text, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", "\n", - "# Example text to classify\n", - "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", + " return df\n", "\n", - "# Perform classification\n", - "result = classifier(input_text, class_labels)\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=\"text\",\n", + " outputs=\"dataframe\",\n", + " title=\"Zero-Shot Classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", "\n", - "print(result)" + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch(share=True)" ] }, { @@ -73,7 +1190,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", "metadata": { "scrolled": true @@ -83,15 +1200,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "Running on local URL: http://127.0.0.1:7860\n", + "Running on local URL: http://127.0.0.1:7861\n", + "Running on public URL: https://0f70ba5369d721cf8f.gradio.live\n", "\n", - "To create a public link, set `share=True` in `launch()`.\n" + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -116,50 +1234,16 @@ "\n", "# Launch the Gradio app\n", "if __name__ == \"__main__\":\n", - " demo.launch()" - ] - }, - { - "cell_type": "markdown", - "id": "d6526d18-6ba6-4a66-8310-21337b832d84", - "metadata": {}, - "source": [ - "Simple app" + " demo.launch(share=True)" ] }, { "cell_type": "code", "execution_count": null, - "id": "5496ded9-7294-4da4-af05-00e5846cdd04", + "id": "c8da1c90-d3a3-4b08-801c-b3afa17b2633", "metadata": {}, "outputs": [], - "source": [ - "import gradio as gr\n", - "from transformers import pipeline\n", - "\n", - "# Initialize the zero-shot classification pipeline\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", - "\n", - "# Define the classification function\n", - "def classify_text(text, labels):\n", - " labels = labels.split(\",\") # Convert the comma-separated string into a list\n", - " result = classifier(text, candidate_labels=labels)\n", - " return result\n", - "\n", - "# Set up the Gradio interface\n", - "with gr.Blocks() as demo:\n", - " gr.Markdown(\"# Zero-Shot Classification\")\n", - " text_input = gr.Textbox(label=\"Input Text\")\n", - " label_input = gr.Textbox(label=\"Comma-separated Labels\")\n", - " output = gr.JSON(label=\"Result\")\n", - " classify_button = gr.Button(\"Classify\")\n", - "\n", - " # Link the button to the classification function\n", - " classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output)\n", - "\n", - "# Launch the Gradio interface\n", - "demo.launch()" - ] + "source": [] } ], "metadata": { diff --git a/space/space/space/space/space/space/space/gradio_tryout.ipynb b/space/space/space/space/space/space/space/gradio_tryout.ipynb index cdc47f719da4fb5337ab14f7c2715f2656961a59..fde7eaf2f24c4dda9de0cba61ffdf3dcfe0fcdbc 100644 --- a/space/space/space/space/space/space/space/gradio_tryout.ipynb +++ b/space/space/space/space/space/space/space/gradio_tryout.ipynb @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 40, "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", "metadata": {}, "outputs": [ @@ -39,9 +39,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "First trip: I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands. \n", + "First trip: We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train. \n", "\n", - "Trip type: ['beach vacation', ['swimming', 'going to the beach', 'relaxing', 'hiking'], 'warm destination / summer', 'lightweight (but comfortable)', 'casual', 'indoor', 'no vehicle', 'no special conditions', '7 days']\n" + "Trip type: ['city trip', ['sightseeing'], 'variable weather / spring / autumn', 'luxury (including evening wear)', 'casual', 'indoor', 'no own vehicle', 'no special condition', '3 days']\n" ] } ], @@ -51,9 +51,16 @@ "from transformers import pipeline\n", "import json\n", "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import pickle\n", + "import os\n", + "import time\n", "\n", "# Load the model and create a pipeline for zero-shot classification (1min loading + classifying with 89 labels)\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-large-mnli\")\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli\")\n", + "# tried:\n", + "# facebook/bart-large-mnli\n", + "# sileod/deberta-v3-base-tasksource-nli\n", "\n", "# get candidate labels\n", "with open(\"packing_label_structure.json\", \"r\") as file:\n", @@ -68,9 +75,9 @@ "trip_types = [trip['trip_types'] for trip in packing_data]\n", "\n", "# Access the first trip description\n", - "first_trip = trip_descriptions[0]\n", + "first_trip = trip_descriptions[1]\n", "# Get the packing list for the secondfirst trip\n", - "first_trip_type = trip_types[0]\n", + "first_trip_type = trip_types[1]\n", "\n", "print(f\"First trip: {first_trip} \\n\")\n", "print(f\"Trip type: {first_trip_type}\")" @@ -78,196 +85,385 @@ }, { "cell_type": "code", - "execution_count": 37, - "id": "fed1f8bc-5baf-46e7-8763-9d56fb9c536b", + "execution_count": 41, + "id": "3a762755-872d-43a6-b666-874d6133488c", + "metadata": {}, + "outputs": [], + "source": [ + "# function that returns pandas data frame with predictions\n", + "\n", + "cut_off = 0.5 # used to choose which activities are relevant\n", + "\n", + "def pred_trip(trip_descr, trip_type, cut_off):\n", + " # Create an empty DataFrame with specified columns\n", + " df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + " for i, key in enumerate(keys_list):\n", + " if key == 'activities':\n", + " result = classifier(trip_descr, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cut_off]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(trip_descr, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(result)\n", + " print(classes)\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + " df['true_class'] = trip_type\n", + " return df" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "3b4f3193-3bdd-453c-8664-df84f955600c", + "metadata": {}, + "outputs": [], + "source": [ + "# function for accuracy, perc true classes identified and perc wrong pred classes\n", + "\n", + "def perf_measure(df):\n", + " df['same_value'] = df['pred_class'] == df['true_class']\n", + " correct = sum(df.loc[df.index != 1, 'same_value'])\n", + " total = len(df['same_value'])\n", + " accuracy = correct/total\n", + " pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + " true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + " correct = [label for label in pred_class if label in true_class]\n", + " num_correct = len(correct)\n", + " correct_perc = num_correct/len(true_class)\n", + " num_pred = len(pred_class)\n", + " wrong_perc = (num_pred - num_correct)/num_pred\n", + " df_perf = pd.DataFrame({\n", + " 'accuracy': [accuracy],\n", + " 'true_ident': [correct_perc],\n", + " 'false_pred': [wrong_perc]\n", + " })\n", + " return(df_perf)" + ] + }, + { + "cell_type": "markdown", + "id": "62c5c18c-58f4-465c-a188-c57cfa7ffa90", + "metadata": {}, + "source": [ + "**Now do the same for all trips**" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "4dd01755-be8d-4904-8494-ac28aba2fee7", "metadata": { "scrolled": true }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'nature escape', 'digital nomad trip', 'cultural exploration', 'yoga / wellness retreat', 'festival trip', 'long-distance hike / thru-hike', 'hut trek (summer)', 'city trip', 'road trip (car/camper)', 'ski tour / skitour', 'camping trip (campground)', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'hut trek (winter)'], 'scores': [0.37631064653396606, 0.35016775131225586, 0.13397355377674103, 0.031636204570531845, 0.031270742416381836, 0.012846449390053749, 0.012699575163424015, 0.009526746347546577, 0.008148356340825558, 0.007793044205754995, 0.006512156222015619, 0.005669699050486088, 0.0044484627433121204, 0.004113250877708197, 0.002713854657486081, 0.002169555053114891]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'cultural exploration', 'nature escape', 'digital nomad trip', 'camping trip (campground)', 'camping trip (wild camping)', 'long-distance hike / thru-hike', 'ski tour / skitour', 'hut trek (summer)', 'city trip', 'hut trek (winter)', 'road trip (car/camper)', 'festival trip', 'yoga / wellness retreat', 'snowboard / splitboard trip'], 'scores': [0.37198853492736816, 0.31496119499206543, 0.10890532284975052, 0.09102731198072433, 0.0735681876540184, 0.012933704070746899, 0.009422042407095432, 0.0051276967860758305, 0.004056071396917105, 0.0017408831045031548, 0.001503779087215662, 0.0014244643971323967, 0.0013752576196566224, 0.0009292717440985143, 0.0006881792796775699, 0.0003480584127828479]}\n", "beach vacation\n", "0\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'relaxing', 'hiking', 'swimming', 'sightseeing', 'running', 'hut-to-hut hiking', 'biking', 'photography', 'surfing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'yoga', 'kayaking / canoeing', 'rock climbing', 'fishing', 'paragliding', 'rafting', 'horseback riding', 'snowshoe hiking', 'cross-country skiing', 'ice climbing', 'skiing', 'scuba diving', 'ski touring'], 'scores': [0.9914858341217041, 0.9771362543106079, 0.9426282048225403, 0.21901991963386536, 0.17586199939250946, 0.09854521602392197, 0.08370419591665268, 0.03679152950644493, 0.03668990358710289, 0.03099300153553486, 0.025300050154328346, 0.021451234817504883, 0.011070131324231625, 0.0075112744234502316, 0.006306737195700407, 0.0034973458386957645, 0.002655829070135951, 0.00197031581774354, 0.0015599008183926344, 0.001527810120023787, 0.0015017405385151505, 0.0014336870517581701, 0.0011686616344377398, 0.000789369223639369, 0.0004912536824122071]}\n", - "['going to the beach', 'relaxing', 'hiking']\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['relaxing', 'hiking', 'going to the beach', 'photography', 'sightseeing', 'hut-to-hut hiking', 'snorkeling', 'snowshoe hiking', 'yoga', 'stand-up paddleboarding (SUP)', 'kayaking / canoeing', 'horseback riding', 'swimming', 'paragliding', 'rafting', 'biking', 'rock climbing', 'surfing', 'running', 'ice climbing', 'cross-country skiing', 'fishing', 'ski touring', 'skiing', 'scuba diving'], 'scores': [0.9943736791610718, 0.9631249308586121, 0.9454535841941833, 0.7538902759552002, 0.4525446593761444, 0.1696157604455948, 0.05957728251814842, 0.04234873503446579, 0.01991761103272438, 0.016971556469798088, 0.006959819234907627, 0.00411367928609252, 0.0030609173700213432, 0.00186573073733598, 0.0017515394138172269, 0.00142807571683079, 0.0005748369731009007, 0.00037779140984639525, 0.0003097739245276898, 0.00030914091621525586, 0.0002725012309383601, 0.00027050732751376927, 0.00024376016517635435, 0.00017392759036738425, 0.00014787293912377208]}\n", + "['relaxing', 'hiking', 'going to the beach', 'photography']\n", "1\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'cold destination / winter'], 'scores': [0.6468702554702759, 0.19999535381793976, 0.09394325315952301, 0.05279730260372162, 0.0063938056118786335]}\n", - "warm destination / summer\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['tropical / humid', 'warm destination / summer', 'variable weather / spring / autumn', 'cold destination / winter', 'dry / desert-like'], 'scores': [0.4895477890968323, 0.25917261838912964, 0.24829530715942383, 0.0017174285603687167, 0.0012668712297454476]}\n", + "tropical / humid\n", "2\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.4286234974861145, 0.2564568817615509, 0.2147122174501419, 0.10020739585161209]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'luxury (including evening wear)', 'lightweight (but comfortable)', 'ultralight'], 'scores': [0.7574900984764099, 0.09964746236801147, 0.07804173231124878, 0.06482075154781342]}\n", "minimalist\n", "3\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.6567223072052002, 0.3034382164478302, 0.039839524775743484]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.8163393139839172, 0.11898067593574524, 0.06467998772859573]}\n", "casual\n", "4\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.5007699728012085, 0.34074831008911133, 0.10416240990161896, 0.05431929975748062]}\n", - "huts with half board\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['indoor', 'huts with half board', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.6389047503471375, 0.18624886870384216, 0.13902997970581055, 0.03581654652953148]}\n", + "indoor\n", "5\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.7521055936813354, 0.24789436161518097]}\n", - "vehicle\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['no own vehicle', 'own vehicle'], 'scores': [0.9990958571434021, 0.0009041387238539755]}\n", + "no own vehicle\n", "6\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'no special conditions', 'pet-friendly', 'rainy climate', 'child-friendly', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.46220096945762634, 0.12957870960235596, 0.10651793330907822, 0.09777138382196426, 0.06722460687160492, 0.0632496327161789, 0.04952802509069443, 0.015049820765852928, 0.008878983557224274]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'child-friendly', 'no special conditions', 'pet-friendly', 'rainy climate', 'avalanche-prone terrain', 'high alpine terrain', 'snow and ice'], 'scores': [0.7414510250091553, 0.07683143764734268, 0.055722303688526154, 0.054133761674165726, 0.04852374270558357, 0.006977608893066645, 0.005693929269909859, 0.005599685944616795, 0.005066512618213892]}\n", "off-grid / no electricity\n", "7\n", - "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '6 days', '3 days', '4 days', '7 days', '5 days'], 'scores': [0.21139054000377655, 0.18512114882469177, 0.14520084857940674, 0.0976138487458229, 0.094282366335392, 0.09376301616430283, 0.09161651134490967, 0.08101171255111694]}\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '7 days', '3 days', '4 days', '6 days', '5 days', '1 day'], 'scores': [0.29225289821624756, 0.20232954621315002, 0.1837582290172577, 0.13940994441509247, 0.06562349200248718, 0.04916509613394737, 0.040249694138765335, 0.0272111464291811]}\n", "7+ days\n", - "8\n" + "8\n", + " superclass pred_class \\\n", + "0 activity_type beach vacation \n", + "1 activities [relaxing, hiking, going to the beach, photogr... \n", + "2 climate_or_season tropical / humid \n", + "3 style_or_comfort minimalist \n", + "4 dress_code casual \n", + "5 accommodation indoor \n", + "6 transportation no own vehicle \n", + "7 special_conditions off-grid / no electricity \n", + "8 trip_length_days 7+ days \n", + "\n", + " true_class \n", + "0 beach vacation \n", + "1 [swimming, going to the beach, relaxing, hiking] \n", + "2 warm destination / summer \n", + "3 lightweight (but comfortable) \n", + "4 casual \n", + "5 indoor \n", + "6 no own vehicle \n", + "7 no special conditions \n", + "8 7+ days \n", + " accuracy true_ident false_pred\n", + "0 0.555556 0.75 0.25\n", + "{'sequence': 'We are a couple in our thirties traveling to Vienna for a three-day city trip. We’ll be staying at a friend’s house and plan to explore the city by sightseeing, strolling through the streets, visiting markets, and trying out great restaurants and cafés. We also hope to attend a classical music concert. Our journey to Vienna will be by train.', 'labels': ['city trip', 'cultural exploration', 'micro-adventure / weekend trip', 'ski tour / skitour', 'festival trip', 'digital nomad trip', 'hut trek (winter)', 'camping trip (campground)', 'long-distance hike / thru-hike', 'hut trek (summer)', 'nature escape', 'camping trip (wild camping)', 'yoga / wellness retreat', 'road trip (car/camper)', 'beach vacation', 'snowboard / splitboard trip'], 'scores': [0.517789363861084, 0.297355592250824, 0.1621870994567871, 0.006185388192534447, 0.005294559057801962, 0.002764208009466529, 0.001503965351730585, 0.0014866390265524387, 0.0012240204960107803, 0.0012071850942447782, 0.000757778063416481, 0.0006650012801401317, 0.0005547589971683919, 0.00043604226084426045, 0.00031738984398543835, 0.0002710542466957122]}\n", + "city trip\n", + "0\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[43], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m current_trip \u001b[38;5;241m=\u001b[39m trip_descriptions[i]\n\u001b[1;32m 6\u001b[0m current_type \u001b[38;5;241m=\u001b[39m trip_types[i]\n\u001b[0;32m----> 7\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpred_trip\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcurrent_trip\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcut_off\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(df)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# accuracy, perc true classes identified and perc wrong pred classes\u001b[39;00m\n", + "Cell \u001b[0;32mIn[41], line 10\u001b[0m, in \u001b[0;36mpred_trip\u001b[0;34m(trip_descr, trip_type, cut_off)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, key \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(keys_list):\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mactivities\u001b[39m\u001b[38;5;124m'\u001b[39m:\n\u001b[0;32m---> 10\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mclassifier\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrip_descr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcandidate_labels\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmulti_label\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 11\u001b[0m indices \u001b[38;5;241m=\u001b[39m [i \u001b[38;5;28;01mfor\u001b[39;00m i, score \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mscores\u001b[39m\u001b[38;5;124m'\u001b[39m]) \u001b[38;5;28;01mif\u001b[39;00m score \u001b[38;5;241m>\u001b[39m cut_off]\n\u001b[1;32m 12\u001b[0m classes \u001b[38;5;241m=\u001b[39m [result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlabels\u001b[39m\u001b[38;5;124m'\u001b[39m][i] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m indices]\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:206\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline.__call__\u001b[0;34m(self, sequences, *args, **kwargs)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to understand extra arguments \u001b[39m\u001b[38;5;132;01m{\u001b[39;00margs\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msequences\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1294\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miterate(inputs, preprocess_params, forward_params, postprocess_params)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mframework \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpt\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m, ChunkPipeline):\n\u001b[0;32m-> 1294\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1295\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43miter\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1296\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_iterator\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1297\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43minputs\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnum_workers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbatch_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpreprocess_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforward_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpostprocess_params\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:124\u001b[0m, in \u001b[0;36mPipelineIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_item()\n\u001b[1;32m 123\u001b[0m \u001b[38;5;66;03m# We're out of items within a batch\u001b[39;00m\n\u001b[0;32m--> 124\u001b[0m item \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minfer(item, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mparams)\n\u001b[1;32m 126\u001b[0m \u001b[38;5;66;03m# We now have a batch of \"inferred things\".\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/pt_utils.py:269\u001b[0m, in \u001b[0;36mPipelinePackIterator.__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m accumulator\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_last:\n\u001b[0;32m--> 269\u001b[0m processed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miterator\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloader_batch_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(processed, torch\u001b[38;5;241m.\u001b[39mTensor):\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/base.py:1209\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1207\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1208\u001b[0m model_inputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdevice)\n\u001b[0;32m-> 1209\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_forward\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mforward_params\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1210\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mdevice(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcpu\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 1211\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/pipelines/zero_shot_classification.py:229\u001b[0m, in \u001b[0;36mZeroShotClassificationPipeline._forward\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m inspect\u001b[38;5;241m.\u001b[39msignature(model_forward)\u001b[38;5;241m.\u001b[39mparameters\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 228\u001b[0m model_inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muse_cache\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m--> 229\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mmodel_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 231\u001b[0m model_outputs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 232\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcandidate_label\u001b[39m\u001b[38;5;124m\"\u001b[39m: candidate_label,\n\u001b[1;32m 233\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msequence\u001b[39m\u001b[38;5;124m\"\u001b[39m: sequence,\n\u001b[1;32m 234\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m: inputs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_last\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[1;32m 235\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moutputs,\n\u001b[1;32m 236\u001b[0m }\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m model_outputs\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1297\u001b[0m, in \u001b[0;36mDebertaV2ForSequenceClassification.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, labels, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1289\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;124;03mlabels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;124;03m Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,\u001b[39;00m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;124;03m config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If\u001b[39;00m\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;124;03m `config.num_labels > 1` a classification loss is computed (Cross-Entropy).\u001b[39;00m\n\u001b[1;32m 1294\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1295\u001b[0m return_dict \u001b[38;5;241m=\u001b[39m return_dict \u001b[38;5;28;01mif\u001b[39;00m return_dict \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39muse_return_dict\n\u001b[0;32m-> 1297\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeberta\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1298\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken_type_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken_type_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1301\u001b[0m \u001b[43m \u001b[49m\u001b[43mposition_ids\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mposition_ids\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1302\u001b[0m \u001b[43m \u001b[49m\u001b[43minputs_embeds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs_embeds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1303\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1304\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_hidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1305\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1306\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1308\u001b[0m encoder_layer \u001b[38;5;241m=\u001b[39m outputs[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 1309\u001b[0m pooled_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpooler(encoder_layer)\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:1063\u001b[0m, in \u001b[0;36mDebertaV2Model.forward\u001b[0;34m(self, input_ids, attention_mask, token_type_ids, position_ids, inputs_embeds, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 1053\u001b[0m token_type_ids \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mzeros(input_shape, dtype\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mlong, device\u001b[38;5;241m=\u001b[39mdevice)\n\u001b[1;32m 1055\u001b[0m embedding_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39membeddings(\n\u001b[1;32m 1056\u001b[0m input_ids\u001b[38;5;241m=\u001b[39minput_ids,\n\u001b[1;32m 1057\u001b[0m token_type_ids\u001b[38;5;241m=\u001b[39mtoken_type_ids,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1060\u001b[0m inputs_embeds\u001b[38;5;241m=\u001b[39minputs_embeds,\n\u001b[1;32m 1061\u001b[0m )\n\u001b[0;32m-> 1063\u001b[0m encoder_outputs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1064\u001b[0m \u001b[43m \u001b[49m\u001b[43membedding_output\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1065\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1066\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_hidden_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 1067\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1068\u001b[0m \u001b[43m \u001b[49m\u001b[43mreturn_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreturn_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1069\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1070\u001b[0m encoded_layers \u001b[38;5;241m=\u001b[39m encoder_outputs[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 1072\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz_steps \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:507\u001b[0m, in \u001b[0;36mDebertaV2Encoder.forward\u001b[0;34m(self, hidden_states, attention_mask, output_hidden_states, output_attentions, query_states, relative_pos, return_dict)\u001b[0m\n\u001b[1;32m 497\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_gradient_checkpointing_func(\n\u001b[1;32m 498\u001b[0m layer_module\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__call__\u001b[39m,\n\u001b[1;32m 499\u001b[0m next_kv,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 504\u001b[0m output_attentions,\n\u001b[1;32m 505\u001b[0m )\n\u001b[1;32m 506\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 507\u001b[0m output_states \u001b[38;5;241m=\u001b[39m \u001b[43mlayer_module\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 508\u001b[0m \u001b[43m \u001b[49m\u001b[43mnext_kv\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 510\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 511\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 512\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 513\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 514\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 517\u001b[0m output_states, att_m \u001b[38;5;241m=\u001b[39m output_states\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:355\u001b[0m, in \u001b[0;36mDebertaV2Layer.forward\u001b[0;34m(self, hidden_states, attention_mask, query_states, relative_pos, rel_embeddings, output_attentions)\u001b[0m\n\u001b[1;32m 346\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 348\u001b[0m hidden_states,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 353\u001b[0m output_attentions\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[1;32m 354\u001b[0m ):\n\u001b[0;32m--> 355\u001b[0m attention_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mattention\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 356\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 357\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 358\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 359\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 360\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 361\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 362\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 363\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 364\u001b[0m attention_output, att_matrix \u001b[38;5;241m=\u001b[39m attention_output\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:286\u001b[0m, in \u001b[0;36mDebertaV2Attention.forward\u001b[0;34m(self, hidden_states, attention_mask, output_attentions, query_states, relative_pos, rel_embeddings)\u001b[0m\n\u001b[1;32m 277\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\n\u001b[1;32m 278\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 279\u001b[0m hidden_states,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 284\u001b[0m rel_embeddings\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 285\u001b[0m ):\n\u001b[0;32m--> 286\u001b[0m self_output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mself\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 287\u001b[0m \u001b[43m \u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 288\u001b[0m \u001b[43m \u001b[49m\u001b[43mattention_mask\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 289\u001b[0m \u001b[43m \u001b[49m\u001b[43moutput_attentions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 290\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_states\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_states\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 291\u001b[0m \u001b[43m \u001b[49m\u001b[43mrelative_pos\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrelative_pos\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 292\u001b[0m \u001b[43m \u001b[49m\u001b[43mrel_embeddings\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrel_embeddings\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 293\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 294\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m output_attentions:\n\u001b[1;32m 295\u001b[0m self_output, att_matrix \u001b[38;5;241m=\u001b[39m self_output\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/transformers/models/deberta_v2/modeling_deberta_v2.py:700\u001b[0m, in \u001b[0;36mDisentangledSelfAttention.forward\u001b[0;34m(self, hidden_states, attention_mask, output_attentions, query_states, relative_pos, rel_embeddings)\u001b[0m\n\u001b[1;32m 698\u001b[0m query_states \u001b[38;5;241m=\u001b[39m hidden_states\n\u001b[1;32m 699\u001b[0m query_layer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtranspose_for_scores(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquery_proj(query_states), \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_attention_heads)\n\u001b[0;32m--> 700\u001b[0m key_layer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtranspose_for_scores(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey_proj\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhidden_states\u001b[49m\u001b[43m)\u001b[49m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_attention_heads)\n\u001b[1;32m 701\u001b[0m value_layer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtranspose_for_scores(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvalue_proj(hidden_states), \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnum_attention_heads)\n\u001b[1;32m 703\u001b[0m rel_att \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1511\u001b[0m, in \u001b[0;36mModule._wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_compiled_call_impl(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[1;32m 1510\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_call_impl\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/module.py:1520\u001b[0m, in \u001b[0;36mModule._call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1515\u001b[0m \u001b[38;5;66;03m# If we don't have any hooks, we want to skip the rest of the logic in\u001b[39;00m\n\u001b[1;32m 1516\u001b[0m \u001b[38;5;66;03m# this function, and just call forward.\u001b[39;00m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_forward_pre_hooks\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_backward_pre_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_backward_hooks\n\u001b[1;32m 1519\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m _global_forward_hooks \u001b[38;5;129;01mor\u001b[39;00m _global_forward_pre_hooks):\n\u001b[0;32m-> 1520\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mforward_call\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1522\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1523\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/opt/anaconda3/envs/huggingface_env/lib/python3.8/site-packages/torch/nn/modules/linear.py:116\u001b[0m, in \u001b[0;36mLinear.forward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mforward\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m: Tensor) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Tensor:\n\u001b[0;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mF\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinear\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mweight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbias\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ - "# Create an empty DataFrame with specified columns\n", - "df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", - "cutoff = 0.5 # used to choose which activities are relevant\n", + "result_list = []\n", + "performance = pd.DataFrame(columns=['accuracy', 'true_ident', 'false_pred'])\n", + "\n", + "start_time = time.time()\n", + "for i in range(len(trip_descriptions)):\n", + " current_trip = trip_descriptions[i]\n", + " current_type = trip_types[i]\n", + " df = pred_trip(current_trip, current_type, cut_off = 0.5)\n", + " print(df)\n", + " \n", + " # accuracy, perc true classes identified and perc wrong pred classes\n", + " performance = pd.concat([performance, perf_measure(df)])\n", + " print(performance)\n", + " \n", + " result_list.append(df)" + ] + }, + { + "cell_type": "markdown", + "id": "b5c08703-7166-4d03-9d6b-ee2c12608134", + "metadata": {}, + "source": [ + "**Compute average performance measures**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eb33fd31-94e6-40b5-9c36-a32effe77c01", + "metadata": {}, + "outputs": [], + "source": [ + "# Extract \"same_value\" column from each DataFrame\n", + "sv_columns = [df['same_value'] for df in result_list] # 'same' needs to be changed\n", + "sv_columns.insert(0, result_list[0]['superclass'])\n", "\n", - "# fill DataFrame\n", - "for i, key in enumerate(keys_list):\n", - " # Run the classification (ca 30 seconds classifying)\n", - " if key == 'activities':\n", - " result = classifier(first_trip, candidate_labels[key], multi_label=True)\n", - " indices = [i for i, score in enumerate(result['scores']) if score > cutoff]\n", - " classes = [result['labels'][i] for i in indices]\n", - " else:\n", - " result = classifier(first_trip, candidate_labels[key])\n", - " classes = result[\"labels\"][0]\n", - " print(result)\n", - " print(classes)\n", - " print(i)\n", - " df.loc[i] = [key, classes]\n", + "# Combine into a new DataFrame (columns side-by-side)\n", + "sv_df = pd.concat(sv_columns, axis=1)\n", "\n", - "df['true_class'] = first_trip_type" + "print(sv_df)" ] }, { "cell_type": "code", - "execution_count": 40, - "id": "b3b51280-76a1-4229-a9de-070b925d3463", + "execution_count": null, + "id": "bf7546cb-79ce-49ad-8cee-54d02239220c", + "metadata": {}, + "outputs": [], + "source": [ + "# Compute accuracy per superclass (row means of same_value matrix excluding the first column)\n", + "row_means = sv_df.iloc[:, 1:].mean(axis=1)\n", + "\n", + "df_row_means = pd.DataFrame({\n", + " 'superclass': sv_df['superclass'],\n", + " 'accuracy': row_means\n", + "})\n", + "\n", + "print(df_row_means)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd232953-59e8-4f28-9ce8-11515a2c310b", "metadata": { "scrolled": true }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Superclass pred_class true_class\n", - "0 activity_type beach vacation beach vacation\n", - "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking]\n", - "2 climate_or_season warm destination / summer warm destination / summer\n", - "3 style_or_comfort minimalist lightweight (but comfortable)\n", - "4 dress_code casual casual\n", - "5 accommodation huts with half board indoor\n", - "6 transportation vehicle no vehicle\n", - "7 special_conditions off-grid / no electricity no special conditions\n", - "8 trip_length_days 7+ days 7 days\n" - ] - } - ], + "outputs": [], "source": [ - "pd.set_option('display.width', 1000) \n", - "pd.set_option('display.max_columns', None)\n", - "print(df)" + "# Compute performance measures per trip (mean for each column of performance table)\n", + "column_means = performance.mean()\n", + "print(column_means)\n", + "\n", + "# Plot histograms for all numeric columns\n", + "performance.hist(bins=10, figsize=(10, 6))\n", + "plt.tight_layout()\n", + "plt.show()" ] }, { "cell_type": "code", - "execution_count": 42, - "id": "2ec09e8f-75f5-45b1-b4c0-4fafd685d36b", + "execution_count": null, + "id": "bd682c84-3eb1-4a8d-9621-b741e98e4537", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Superclass pred_class true_class same\n", - "0 activity_type beach vacation beach vacation True\n", - "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking] False\n", - "2 climate_or_season warm destination / summer warm destination / summer True\n", - "3 style_or_comfort minimalist lightweight (but comfortable) False\n", - "4 dress_code casual casual True\n", - "5 accommodation huts with half board indoor False\n", - "6 transportation vehicle no vehicle False\n", - "7 special_conditions off-grid / no electricity no special conditions False\n", - "8 trip_length_days 7+ days 7 days False\n" - ] - } - ], + "outputs": [], "source": [ - "df['same'] = df['pred_class'] == df['true_class']\n", - "print(df)" + "# save results\n", + "# Example data for one model\n", + "model_name = 'model_MoritzLaurer-DeBERTa-v3-base-mnli-fever-anli'\n", + "# Structure to save\n", + "model_result = {\n", + " 'model': model_name,\n", + " 'predictions': result_list,\n", + " 'performance': performance,\n", + " 'perf_summary': column_means,\n", + " 'perf_superclass': df_row_means\n", + "}\n", + "\n", + "# File path with folder\n", + "filename = os.path.join('results', f'{model_name}_results.pkl')\n", + "\n", + "# Save the object\n", + "with open(filename, 'wb') as f:\n", + " pickle.dump(model_result, f)" ] }, { - "cell_type": "code", - "execution_count": 62, - "id": "82ae19c8-8bb7-4f7f-841b-1cb6501a17a7", + "cell_type": "markdown", + "id": "e1cbb54e-abe6-49b6-957e-0683196f3199", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Accuracy (excluding activities): 0.3333333333333333\n" - ] - } - ], "source": [ - "# accuracy excluding activities\n", - "correct = sum(df.loc[df.index != 1, 'same'])\n", - "total = len(df['same'])\n", - "accuracy = correct/total\n", - "print(\"Accuracy (excluding activities):\", accuracy)" + "**Load and compare results**" ] }, { "cell_type": "code", - "execution_count": 64, - "id": "16c0a3ae-34ac-49a4-b59f-411a6f0ce947", + "execution_count": 35, + "id": "62ca82b0-6909-4e6c-9d2c-fed87971e5b6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Percentage of true classes that were identified: 0.75\n", - "Percentage of predicted classes that were wrong: 0.0\n" + "Model: model_a_facebook-bart-large-mnli\n", + "Performance Summary:\n", + "accuracy 0.454545\n", + "true_ident 0.689394\n", + "false_pred 0.409091\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: model_b_sileod-deberta-v3-base-tasksource-nli\n", + "Performance Summary:\n", + "accuracy 0.500000\n", + "true_ident 0.666667\n", + "false_pred 0.551667\n", + "dtype: float64\n", + "----------------------------------------\n", + "Model: model_a_facebook-bart-large-mnli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.8\n", + "1 activities 0.0\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.7\n", + "5 accommodation 0.3\n", + "6 transportation 0.8\n", + "7 special_conditions 0.0\n", + "8 trip_length_days 0.5\n", + "----------------------------------------\n", + "Model: model_b_sileod-deberta-v3-base-tasksource-nli\n", + "Performance Summary:\n", + " superclass accuracy\n", + "0 activity_type 0.7\n", + "1 activities 0.1\n", + "2 climate_or_season 0.6\n", + "3 style_or_comfort 0.4\n", + "4 dress_code 0.6\n", + "5 accommodation 0.9\n", + "6 transportation 0.7\n", + "7 special_conditions 0.1\n", + "8 trip_length_days 0.5\n", + "----------------------------------------\n" ] } ], "source": [ - "pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", - "true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", - "correct = [label for label in pred_class if label in true_class]\n", + "# Folder where your .pkl files are saved\n", + "results_dir = 'results'\n", "\n", - "num_correct = len(correct)\n", - "correct_perc = num_correct/len(true_class)\n", + "# Dictionary to store all loaded results\n", + "all_results = {}\n", "\n", - "num_pred = len(pred_class)\n", - "wrong_perc = (num_pred - num_correct)/num_pred\n", + "# Loop through all .pkl files in the folder\n", + "for filename in os.listdir(results_dir):\n", + " if filename.endswith('.pkl'):\n", + " model_name = filename.replace('_results.pkl', '') # Extract model name\n", + " file_path = os.path.join(results_dir, filename)\n", + " \n", + " # Load the result\n", + " with open(file_path, 'rb') as f:\n", + " result = pickle.load(f)\n", + " all_results[model_name] = result\n", "\n", - "print(\"Percentage of true classes that were identified:\", correct_perc)\n", - "print(\"Percentage of predicted classes that were wrong:\", wrong_perc)" - ] - }, - { - "cell_type": "markdown", - "id": "62c5c18c-58f4-465c-a188-c57cfa7ffa90", - "metadata": {}, - "source": [ - "Now do the same for all trips" + "# Now you can compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_summary']}\")\n", + " print(\"-\" * 40)\n", + "\n", + "\n", + "# Now you can compare performance across models\n", + "for model, data in all_results.items():\n", + " print(f\"Model: {model}\")\n", + " print(f\"Performance Summary:\\n{data['perf_superclass']}\")\n", + " print(\"-\" * 40)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "e4192b42-f1bc-4fcb-a238-dbdb3df7d699", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", diff --git a/space/space/space/space/space/space/space/space/space/space/.DS_Store b/space/space/space/space/space/space/space/space/space/space/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/space/space/space/space/space/space/space/space/space/space/.DS_Store differ diff --git a/space/space/space/space/space/space/space/space/space/space/Candidate labels in Word en idee.docx b/space/space/space/space/space/space/space/space/space/space/Candidate labels in Word en idee.docx new file mode 100644 index 0000000000000000000000000000000000000000..40b5aab42f2e16f8a9038824dfed9b5c4ee3a149 Binary files /dev/null and b/space/space/space/space/space/space/space/space/space/space/Candidate labels in Word en idee.docx differ diff --git a/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb b/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb index f0e770f8ce7bd71d0fc1953ebe17d0a71bb77218..cdc47f719da4fb5337ab14f7c2715f2656961a59 100644 --- a/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb +++ b/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb @@ -8,59 +8,359 @@ "# Try out gradio" ] }, + { + "cell_type": "markdown", + "id": "afd23321-1870-44af-82ed-bb241d055dfa", + "metadata": {}, + "source": [] + }, { "cell_type": "markdown", "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", "metadata": {}, "source": [ - "Try model" + "**Load and try the model**" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "f8c28d2d-8458-49fd-8ebf-5e729d6e861f", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First trip: I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands. \n", + "\n", + "Trip type: ['beach vacation', ['swimming', 'going to the beach', 'relaxing', 'hiking'], 'warm destination / summer', 'lightweight (but comfortable)', 'casual', 'indoor', 'no vehicle', 'no special conditions', '7 days']\n" + ] + } + ], + "source": [ + "# Prerequisites\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", + "import json\n", + "import pandas as pd\n", + "\n", + "# Load the model and create a pipeline for zero-shot classification (1min loading + classifying with 89 labels)\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-large-mnli\")\n", + "\n", + "# get candidate labels\n", + "with open(\"packing_label_structure.json\", \"r\") as file:\n", + " candidate_labels = json.load(file)\n", + "keys_list = list(candidate_labels.keys())\n", + "\n", + "# Load test data (in list of dictionaries)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Extract all trip descriptions and trip_types\n", + "trip_descriptions = [trip['description'] for trip in packing_data]\n", + "trip_types = [trip['trip_types'] for trip in packing_data]\n", + "\n", + "# Access the first trip description\n", + "first_trip = trip_descriptions[0]\n", + "# Get the packing list for the secondfirst trip\n", + "first_trip_type = trip_types[0]\n", + "\n", + "print(f\"First trip: {first_trip} \\n\")\n", + "print(f\"Trip type: {first_trip_type}\")" ] }, { "cell_type": "code", - "execution_count": 1, - "id": "fa0d8126-e346-4412-9197-7d51baf868da", + "execution_count": 37, + "id": "fed1f8bc-5baf-46e7-8763-9d56fb9c536b", "metadata": { "scrolled": true }, "outputs": [ { - "name": "stderr", + "name": "stdout", "output_type": "stream", "text": [ - "Some weights of BartForSequenceClassification were not initialized from the model checkpoint at facebook/bart-base and are newly initialized: ['classification_head.dense.bias', 'classification_head.dense.weight', 'classification_head.out_proj.bias', 'classification_head.out_proj.weight']\n", - "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n", - "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n", - "Failed to determine 'entailment' label id from the label2id mapping in the model config. Setting to -1. Define a descriptive label2id mapping in the model config to ensure correct outputs.\n", - "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['beach vacation', 'micro-adventure / weekend trip', 'nature escape', 'digital nomad trip', 'cultural exploration', 'yoga / wellness retreat', 'festival trip', 'long-distance hike / thru-hike', 'hut trek (summer)', 'city trip', 'road trip (car/camper)', 'ski tour / skitour', 'camping trip (campground)', 'snowboard / splitboard trip', 'camping trip (wild camping)', 'hut trek (winter)'], 'scores': [0.37631064653396606, 0.35016775131225586, 0.13397355377674103, 0.031636204570531845, 0.031270742416381836, 0.012846449390053749, 0.012699575163424015, 0.009526746347546577, 0.008148356340825558, 0.007793044205754995, 0.006512156222015619, 0.005669699050486088, 0.0044484627433121204, 0.004113250877708197, 0.002713854657486081, 0.002169555053114891]}\n", + "beach vacation\n", + "0\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['going to the beach', 'relaxing', 'hiking', 'swimming', 'sightseeing', 'running', 'hut-to-hut hiking', 'biking', 'photography', 'surfing', 'stand-up paddleboarding (SUP)', 'snorkeling', 'yoga', 'kayaking / canoeing', 'rock climbing', 'fishing', 'paragliding', 'rafting', 'horseback riding', 'snowshoe hiking', 'cross-country skiing', 'ice climbing', 'skiing', 'scuba diving', 'ski touring'], 'scores': [0.9914858341217041, 0.9771362543106079, 0.9426282048225403, 0.21901991963386536, 0.17586199939250946, 0.09854521602392197, 0.08370419591665268, 0.03679152950644493, 0.03668990358710289, 0.03099300153553486, 0.025300050154328346, 0.021451234817504883, 0.011070131324231625, 0.0075112744234502316, 0.006306737195700407, 0.0034973458386957645, 0.002655829070135951, 0.00197031581774354, 0.0015599008183926344, 0.001527810120023787, 0.0015017405385151505, 0.0014336870517581701, 0.0011686616344377398, 0.000789369223639369, 0.0004912536824122071]}\n", + "['going to the beach', 'relaxing', 'hiking']\n", + "1\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['warm destination / summer', 'tropical / humid', 'variable weather / spring / autumn', 'dry / desert-like', 'cold destination / winter'], 'scores': [0.6468702554702759, 0.19999535381793976, 0.09394325315952301, 0.05279730260372162, 0.0063938056118786335]}\n", + "warm destination / summer\n", + "2\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['minimalist', 'ultralight', 'lightweight (but comfortable)', 'luxury (including evening wear)'], 'scores': [0.4286234974861145, 0.2564568817615509, 0.2147122174501419, 0.10020739585161209]}\n", + "minimalist\n", + "3\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['casual', 'conservative', 'formal (business trip)'], 'scores': [0.6567223072052002, 0.3034382164478302, 0.039839524775743484]}\n", + "casual\n", + "4\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['huts with half board', 'indoor', 'sleeping in a car', 'sleeping in a tent'], 'scores': [0.5007699728012085, 0.34074831008911133, 0.10416240990161896, 0.05431929975748062]}\n", + "huts with half board\n", + "5\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['vehicle', 'no vehicle'], 'scores': [0.7521055936813354, 0.24789436161518097]}\n", + "vehicle\n", + "6\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['off-grid / no electricity', 'self-supported (bring your own food/cooking)', 'no special conditions', 'pet-friendly', 'rainy climate', 'child-friendly', 'snow and ice', 'high alpine terrain', 'avalanche-prone terrain'], 'scores': [0.46220096945762634, 0.12957870960235596, 0.10651793330907822, 0.09777138382196426, 0.06722460687160492, 0.0632496327161789, 0.04952802509069443, 0.015049820765852928, 0.008878983557224274]}\n", + "off-grid / no electricity\n", + "7\n", + "{'sequence': 'I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands.', 'labels': ['7+ days', '2 days', '1 day', '6 days', '3 days', '4 days', '7 days', '5 days'], 'scores': [0.21139054000377655, 0.18512114882469177, 0.14520084857940674, 0.0976138487458229, 0.094282366335392, 0.09376301616430283, 0.09161651134490967, 0.08101171255111694]}\n", + "7+ days\n", + "8\n" + ] + } + ], + "source": [ + "# Create an empty DataFrame with specified columns\n", + "df = pd.DataFrame(columns=['superclass', 'pred_class'])\n", + "cutoff = 0.5 # used to choose which activities are relevant\n", + "\n", + "# fill DataFrame\n", + "for i, key in enumerate(keys_list):\n", + " # Run the classification (ca 30 seconds classifying)\n", + " if key == 'activities':\n", + " result = classifier(first_trip, candidate_labels[key], multi_label=True)\n", + " indices = [i for i, score in enumerate(result['scores']) if score > cutoff]\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(first_trip, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(result)\n", + " print(classes)\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", + "\n", + "df['true_class'] = first_trip_type" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "b3b51280-76a1-4229-a9de-070b925d3463", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Superclass pred_class true_class\n", + "0 activity_type beach vacation beach vacation\n", + "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking]\n", + "2 climate_or_season warm destination / summer warm destination / summer\n", + "3 style_or_comfort minimalist lightweight (but comfortable)\n", + "4 dress_code casual casual\n", + "5 accommodation huts with half board indoor\n", + "6 transportation vehicle no vehicle\n", + "7 special_conditions off-grid / no electricity no special conditions\n", + "8 trip_length_days 7+ days 7 days\n" + ] + } + ], + "source": [ + "pd.set_option('display.width', 1000) \n", + "pd.set_option('display.max_columns', None)\n", + "print(df)" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "2ec09e8f-75f5-45b1-b4c0-4fafd685d36b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Superclass pred_class true_class same\n", + "0 activity_type beach vacation beach vacation True\n", + "1 activities [going to the beach, relaxing, hiking] [swimming, going to the beach, relaxing, hiking] False\n", + "2 climate_or_season warm destination / summer warm destination / summer True\n", + "3 style_or_comfort minimalist lightweight (but comfortable) False\n", + "4 dress_code casual casual True\n", + "5 accommodation huts with half board indoor False\n", + "6 transportation vehicle no vehicle False\n", + "7 special_conditions off-grid / no electricity no special conditions False\n", + "8 trip_length_days 7+ days 7 days False\n" + ] + } + ], + "source": [ + "df['same'] = df['pred_class'] == df['true_class']\n", + "print(df)" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "82ae19c8-8bb7-4f7f-841b-1cb6501a17a7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy (excluding activities): 0.3333333333333333\n" + ] + } + ], + "source": [ + "# accuracy excluding activities\n", + "correct = sum(df.loc[df.index != 1, 'same'])\n", + "total = len(df['same'])\n", + "accuracy = correct/total\n", + "print(\"Accuracy (excluding activities):\", accuracy)" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "16c0a3ae-34ac-49a4-b59f-411a6f0ce947", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percentage of true classes that were identified: 0.75\n", + "Percentage of predicted classes that were wrong: 0.0\n" + ] + } + ], + "source": [ + "pred_class = df.loc[df.index == 1, 'pred_class'].iloc[0]\n", + "true_class = df.loc[df.index == 1, 'true_class'].iloc[0]\n", + "correct = [label for label in pred_class if label in true_class]\n", + "\n", + "num_correct = len(correct)\n", + "correct_perc = num_correct/len(true_class)\n", + "\n", + "num_pred = len(pred_class)\n", + "wrong_perc = (num_pred - num_correct)/num_pred\n", + "\n", + "print(\"Percentage of true classes that were identified:\", correct_perc)\n", + "print(\"Percentage of predicted classes that were wrong:\", wrong_perc)" + ] + }, + { + "cell_type": "markdown", + "id": "62c5c18c-58f4-465c-a188-c57cfa7ffa90", + "metadata": {}, + "source": [ + "Now do the same for all trips" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e4192b42-f1bc-4fcb-a238-dbdb3df7d699", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "17483df4-55c4-41cd-b8a9-61f7a5c7e8a3", + "metadata": {}, + "source": [ + "**Use gradio for user input**" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "cb7fd425-d0d6-458d-97ca-2150dc55f206", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7861\n", + "Running on public URL: https://aa06d5d85ffadaa92b.gradio.live\n", + "\n", + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Map', 'Compass', 'Laptop', 'Car charger', 'Toys', 'Travel crib', 'Hat', 'Playlist', 'Stroller', 'Currency', 'Travel adapter', 'Hostel lock', 'Pen', 'Charging cables', 'Flip-flops', 'Pacifier', 'Camping stove', 'Multi-tool', 'Passport', 'Poncho', 'Hiking boots', 'Portable charger', 'Power bank', 'Trekking poles', 'Snowboard', 'Base layers', 'Bandana', 'Aloe vera gel', 'Gloves', 'Baby blanket', 'Tent', 'Tent', 'Snorkel gear', 'Water filter', 'Diapers', 'Presentation materials', 'Nursing cover', 'Headphones', 'Sunscreen', 'Beach towel', 'Snacks', 'Ski jacket', 'Earplugs', 'Ski goggles', 'Flashlight', 'Neck wallet', 'Swimsuit', 'Notebook', 'Thermal clothing', 'Blanket', 'Snow boots', 'Sleeping bag', 'Lightweight backpack', 'Refillable water bottle', 'Quick-dry towel', 'Comfortable shoes', 'Reusable shopping bags', 'Travel journal', 'Travel pillow', 'Beach bag', 'Reusable coffee mug', 'Reusable water bottle', 'Festival tickets', 'Waterproof phone case', 'Business attire', 'Sunglasses', 'Sunglasses', 'Cooler', 'Baby clothes', 'Fanny pack', 'Beanie', 'First aid kit', 'Emergency roadside kit', 'Dry bag', 'SIM card', 'Energy bars', 'Baby food', 'Work ID badge', 'Packable rain jacket', 'Hand warmers', 'Visa documents', 'Glow sticks', 'Bug spray', 'Travel-sized toiletries', 'Dress shoes', 'Language phrasebook', 'Baby wipes', 'Lip balm', 'Travel insurance documents'], 'scores': [0.013028442859649658, 0.012909057550132275, 0.0124660674482584, 0.012431488372385502, 0.012379261665046215, 0.012377972714602947, 0.012329353019595146, 0.012096051126718521, 0.012086767703294754, 0.011947661638259888, 0.011939236894249916, 0.011935302056372166, 0.011887168511748314, 0.011814153753221035, 0.011788924224674702, 0.011783207766711712, 0.01177265401929617, 0.011771135963499546, 0.011747810058295727, 0.011738969013094902, 0.01169698778539896, 0.01166312862187624, 0.011658026836812496, 0.011596457101404667, 0.01158847101032734, 0.011561167426407337, 0.011526867747306824, 0.01149983424693346, 0.011472185142338276, 0.011455104686319828, 0.011445573531091213, 0.011445573531091213, 0.011444379575550556, 0.011416648514568806, 0.01136692427098751, 0.011363024823367596, 0.011361461132764816, 0.011328471824526787, 0.011299548670649529, 0.011291779577732086, 0.011282541789114475, 0.01127372495830059, 0.011270811781287193, 0.011263585649430752, 0.011179029010236263, 0.011149592697620392, 0.01113132108002901, 0.011122703552246094, 0.011105425655841827, 0.011101326905190945, 0.011090466752648354, 0.011066330596804619, 0.011058374308049679, 0.011055233888328075, 0.01103114802390337, 0.011022195219993591, 0.011012199334800243, 0.01100123766809702, 0.010985593311488628, 0.010961917228996754, 0.010958753526210785, 0.010938071645796299, 0.010903625749051571, 0.010879918932914734, 0.010863620787858963, 0.010824359022080898, 0.010824359022080898, 0.010805793106555939, 0.010763236321508884, 0.010710005648434162, 0.010690474882721901, 0.010647830553352833, 0.010583569295704365, 0.010571518912911415, 0.010570857673883438, 0.010552200488746166, 0.0105352271348238, 0.010523369535803795, 0.010514546185731888, 0.010479346849024296, 0.010450395755469799, 0.010436479933559895, 0.01043587177991867, 0.010400519706308842, 0.010214710608124733, 0.010052643716335297, 0.010041419416666031, 0.010003888048231602, 0.009946384467184544]}\n" + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n" ] } ], "source": [ + "# use model with gradio\n", "from transformers import pipeline\n", "import gradio as gr\n", "\n", - "# Load the model and create a pipeline for zero-shot classification\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", - "\n", - "# Load labels from a txt file\n", - "with open(\"labels.txt\", \"r\", encoding=\"utf-8\") as f:\n", - " class_labels = [line.strip() for line in f if line.strip()]\n", + "# make a function for what I am doing\n", + "def classify(text):\n", + " df = pd.DataFrame(columns=['Superclass', 'class'])\n", + " for i, key in enumerate(keys_list):\n", + " # Run the classification (ca 30 seconds classifying)\n", + " if key == 'activities':\n", + " result = classifier(text, candidate_labels[key], multi_label=True)\n", + " classes = [result['labels'][i] for i in indices]\n", + " else:\n", + " result = classifier(text, candidate_labels[key])\n", + " classes = result[\"labels\"][0]\n", + " print(i)\n", + " df.loc[i] = [key, classes]\n", "\n", - "# Example text to classify\n", - "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", + " return df\n", "\n", - "# Perform classification\n", - "result = classifier(input_text, class_labels)\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=\"text\",\n", + " outputs=\"dataframe\",\n", + " title=\"Zero-Shot Classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", "\n", - "print(result)" + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch(share=True)" ] }, { @@ -73,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", "metadata": { "scrolled": true @@ -83,15 +383,16 @@ "name": "stdout", "output_type": "stream", "text": [ - "Running on local URL: http://127.0.0.1:7860\n", + "Running on local URL: http://127.0.0.1:7861\n", + "Running on public URL: https://0f70ba5369d721cf8f.gradio.live\n", "\n", - "To create a public link, set `share=True` in `launch()`.\n" + "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -116,50 +417,16 @@ "\n", "# Launch the Gradio app\n", "if __name__ == \"__main__\":\n", - " demo.launch()" - ] - }, - { - "cell_type": "markdown", - "id": "d6526d18-6ba6-4a66-8310-21337b832d84", - "metadata": {}, - "source": [ - "Simple app" + " demo.launch(share=True)" ] }, { "cell_type": "code", "execution_count": null, - "id": "5496ded9-7294-4da4-af05-00e5846cdd04", + "id": "c8da1c90-d3a3-4b08-801c-b3afa17b2633", "metadata": {}, "outputs": [], - "source": [ - "import gradio as gr\n", - "from transformers import pipeline\n", - "\n", - "# Initialize the zero-shot classification pipeline\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", - "\n", - "# Define the classification function\n", - "def classify_text(text, labels):\n", - " labels = labels.split(\",\") # Convert the comma-separated string into a list\n", - " result = classifier(text, candidate_labels=labels)\n", - " return result\n", - "\n", - "# Set up the Gradio interface\n", - "with gr.Blocks() as demo:\n", - " gr.Markdown(\"# Zero-Shot Classification\")\n", - " text_input = gr.Textbox(label=\"Input Text\")\n", - " label_input = gr.Textbox(label=\"Comma-separated Labels\")\n", - " output = gr.JSON(label=\"Result\")\n", - " classify_button = gr.Button(\"Classify\")\n", - "\n", - " # Link the button to the classification function\n", - " classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output)\n", - "\n", - "# Launch the Gradio interface\n", - "demo.launch()" - ] + "source": [] } ], "metadata": { diff --git a/space/space/space/space/space/space/space/space/space/space/packing_label_hierarchical_mapping.json b/space/space/space/space/space/space/space/space/space/space/packing_label_hierarchical_mapping.json new file mode 100644 index 0000000000000000000000000000000000000000..bc07fbd9f3e6fd46e3d17f0af9e97e900f485cd3 --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/packing_label_hierarchical_mapping.json @@ -0,0 +1,290 @@ +{ + "ski touring": { + "category": "activities", + "superclass": "winter sport" + }, + "cross-country skiing": { + "category": "activities", + "superclass": "winter sport" + }, + "skiing": { + "category": "activities", + "superclass": "winter sport" + }, + "snowboard / splitboard trip": { + "category": "activity_type", + "superclass": "winter sport" + }, + "snowshoe hiking": { + "category": "activities", + "superclass": "winter sport" + }, + "ice climbing": { + "category": "activities", + "superclass": "winter sport" + }, + "hiking": { + "category": "activities", + "superclass": "outdoor land" + }, + "hut-to-hut hiking": { + "category": "activities", + "superclass": "outdoor land" + }, + "huttentocht (zomer)": { + "category": "activity_type", + "superclass": "outdoor land" + }, + "huttentocht (winter)": { + "category": "activity_type", + "superclass": "winter sport" + }, + "rock climbing": { + "category": "activities", + "superclass": "outdoor land" + }, + "biking": { + "category": "activities", + "superclass": "outdoor land" + }, + "running": { + "category": "activities", + "superclass": "fitness" + }, + "swimming": { + "category": "activities", + "superclass": "water sport" + }, + "kayaking / canoeing": { + "category": "activities", + "superclass": "water sport" + }, + "stand-up paddleboarding (SUP)": { + "category": "activities", + "superclass": "water sport" + }, + "snorkeling": { + "category": "activities", + "superclass": "water sport" + }, + "scuba diving": { + "category": "activities", + "superclass": "water sport" + }, + "surfing": { + "category": "activities", + "superclass": "water sport" + }, + "fishing": { + "category": "activities", + "superclass": "water sport" + }, + "rafting": { + "category": "activities", + "superclass": "water sport" + }, + "paragliding": { + "category": "activities", + "superclass": "adventure sport" + }, + "horseback riding": { + "category": "activities", + "superclass": "outdoor land" + }, + "photography": { + "category": "activities", + "superclass": "leisure" + }, + "relaxing": { + "category": "activities", + "superclass": "leisure" + }, + "sightseeing": { + "category": "activities", + "superclass": "cultural" + }, + "yoga": { + "category": "activities", + "superclass": "wellness" + }, + "festivaltrip": { + "category": "activity_type", + "superclass": "urban / event" + }, + "stedentrip": { + "category": "activity_type", + "superclass": "urban / cultural" + }, + "roadtrip (auto/camper)": { + "category": "activity_type", + "superclass": "travel mode" + }, + "digitale nomade reis": { + "category": "activity_type", + "superclass": "remote work" + }, + "kampeerreis (wildkamperen)": { + "category": "activity_type", + "superclass": "outdoor overnight" + }, + "kampeerreis (camping)": { + "category": "activity_type", + "superclass": "outdoor overnight" + }, + "langeafstandswandeling / thru-hike": { + "category": "activity_type", + "superclass": "backpacking" + }, + "microavontuur / weekendtrip": { + "category": "activity_type", + "superclass": "short trip" + }, + "yoga / wellness retreat": { + "category": "activity_type", + "superclass": "wellness" + }, + "strandvakantie": { + "category": "activity_type", + "superclass": "beach / leisure" + }, + "warme bestemming / zomer": { + "category": "climate_or_season", + "superclass": "warm" + }, + "koude bestemming / winter": { + "category": "climate_or_season", + "superclass": "cold" + }, + "wisselvallig / lente / herfst": { + "category": "climate_or_season", + "superclass": "mild" + }, + "tropisch / vochtig": { + "category": "climate_or_season", + "superclass": "humid" + }, + "droog / woestijnachtig": { + "category": "climate_or_season", + "superclass": "dry" + }, + "ultralight": { + "category": "style_or_comfort", + "superclass": "packing style" + }, + "lichtgewicht (maar comfortabel)": { + "category": "style_or_comfort", + "superclass": "packing style" + }, + "luxe (inclusief avondkleding)": { + "category": "style_or_comfort", + "superclass": "comfort / luxury" + }, + "casual": { + "category": "dress_code", + "superclass": "informal" + }, + "formeel (zakelijke reis)": { + "category": "dress_code", + "superclass": "formal" + }, + "conservative": { + "category": "dress_code", + "superclass": "cultural" + }, + "minimalistisch": { + "category": "style_or_comfort", + "superclass": "packing style" + }, + "off-grid / geen stroom": { + "category": "special_conditions", + "superclass": "independent" + }, + "self-supported (eten/koken zelf meenemen)": { + "category": "special_conditions", + "superclass": "independent" + }, + "regenachtig klimaat": { + "category": "special_conditions", + "superclass": "weather" + }, + "sneeuw en ijs": { + "category": "special_conditions", + "superclass": "weather" + }, + "hoog alpine terrein": { + "category": "special_conditions", + "superclass": "terrain" + }, + "lawinegevoelig terrein": { + "category": "special_conditions", + "superclass": "terrain" + }, + "hutten met halfpension": { + "category": "accommodation", + "superclass": "type" + }, + "slapen in tent": { + "category": "accommodation", + "superclass": "type" + }, + "slapen in auto": { + "category": "accommodation", + "superclass": "type" + }, + "kindvriendelijk": { + "category": "special_conditions", + "superclass": "target group" + }, + "huisdiervriendelijk": { + "category": "special_conditions", + "superclass": "target group" + }, + "accommodation: outdoor": { + "category": "accommodation", + "superclass": "type" + }, + "accommodation: indoor": { + "category": "accommodation", + "superclass": "type" + }, + "transportation: vehicle": { + "category": "transportation", + "superclass": "mode" + }, + "transportation: no vehicle": { + "category": "transportation", + "superclass": "mode" + }, + "1 day": { + "category": "trip_length_days", + "superclass": "duration" + }, + "2 days": { + "category": "trip_length_days", + "superclass": "duration" + }, + "3 days": { + "category": "trip_length_days", + "superclass": "duration" + }, + "4 days": { + "category": "trip_length_days", + "superclass": "duration" + }, + "5 days": { + "category": "trip_length_days", + "superclass": "duration" + }, + "6 days": { + "category": "trip_length_days", + "superclass": "duration" + }, + "7 days": { + "category": "trip_length_days", + "superclass": "duration" + }, + "7+ days": { + "category": "trip_length_days", + "superclass": "duration" + } +} \ No newline at end of file diff --git a/space/space/space/space/space/space/space/space/space/space/packing_label_structure.json b/space/space/space/space/space/space/space/space/space/space/packing_label_structure.json new file mode 100644 index 0000000000000000000000000000000000000000..af7794ca5cc915d12d029197bb1135661e86e1ae --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/packing_label_structure.json @@ -0,0 +1,96 @@ +{ + "activity_type": [ + "hut trek (summer)", + "hut trek (winter)", + "camping trip (wild camping)", + "camping trip (campground)", + "ski tour / skitour", + "snowboard / splitboard trip", + "long-distance hike / thru-hike", + "digital nomad trip", + "city trip", + "road trip (car/camper)", + "festival trip", + "yoga / wellness retreat", + "micro-adventure / weekend trip", + "beach vacation", + "cultural exploration", + "nature escape" + ], + "activities": [ + "swimming", + "going to the beach", + "relaxing", + "sightseeing", + "biking", + "running", + "skiing", + "cross-country skiing", + "ski touring", + "hiking", + "hut-to-hut hiking", + "rock climbing", + "ice climbing", + "snowshoe hiking", + "kayaking / canoeing", + "stand-up paddleboarding (SUP)", + "snorkeling", + "scuba diving", + "surfing", + "paragliding", + "horseback riding", + "photography", + "fishing", + "rafting", + "yoga" + ], + "climate_or_season": [ + "cold destination / winter", + "warm destination / summer", + "variable weather / spring / autumn", + "tropical / humid", + "dry / desert-like" + ], + "style_or_comfort": [ + "ultralight", + "lightweight (but comfortable)", + "luxury (including evening wear)", + "minimalist" + ], + "dress_code": [ + "casual", + "formal (business trip)", + "conservative" + ], + "accommodation": [ + "indoor", + "huts with half board", + "sleeping in a tent", + "sleeping in a car" + ], + "transportation": [ + "vehicle", + "no vehicle" + ], + "special_conditions": [ + "off-grid / no electricity", + "self-supported (bring your own food/cooking)", + "child-friendly", + "pet-friendly", + "rainy climate", + "snow and ice", + "high alpine terrain", + "avalanche-prone terrain", + "no special conditions" + ], + "trip_length_days": [ + "1 day", + "2 days", + "3 days", + "4 days", + "5 days", + "6 days", + "7 days", + "7+ days" + ] +} \ No newline at end of file diff --git a/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb b/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb index f6197119ef00f69c7b8c1c74ecbb1219a22db2fb..ab17f0aefb232ee1a54ef3d6da67e95d9fb78b52 100644 --- a/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb +++ b/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb @@ -59,61 +59,6 @@ "print(output)\n" ] }, - { - "cell_type": "markdown", - "id": "fb7e69c7-b590-4b40-8478-76d055583f2a", - "metadata": {}, - "source": [ - "**Try packing list labels**" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "c5f75916-aaf2-4ca7-8d1a-070579940952", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'error': ['Error in `parameters.candidate_labels`: ensure this value has at most 10 items']}\n" - ] - } - ], - "source": [ - "# Input text to classify\n", - "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", - "\n", - "# Candidate labels\n", - "candidate_labels = [\n", - " \"Swimsuit\", \"Sunscreen\", \"Flip-flops\", \"Beach towel\", \"Sunglasses\", \n", - " \"Waterproof phone case\", \"Hat\", \"Beach bag\", \"Snorkel gear\", \"Aloe vera gel\",\n", - " \"Tent\", \"Sleeping bag\", \"Camping stove\", \"Flashlight\", \"Hiking boots\",\n", - " \"Water filter\", \"Compass\", \"First aid kit\", \"Bug spray\", \"Multi-tool\",\n", - " \"Thermal clothing\", \"Ski jacket\", \"Ski goggles\", \"Snow boots\", \"Gloves\",\n", - " \"Hand warmers\", \"Beanie\", \"Lip balm\", \"Snowboard\", \"Base layers\",\n", - " \"Passport\", \"Visa documents\", \"Travel adapter\", \"Currency\", \"Language phrasebook\",\n", - " \"SIM card\", \"Travel pillow\", \"Neck wallet\", \"Travel insurance documents\", \"Power bank\",\n", - " \"Laptop\", \"Notebook\", \"Business attire\", \"Dress shoes\", \"Charging cables\",\n", - " \"Presentation materials\", \"Work ID badge\", \"Pen\", \"Headphones\", \n", - " \"Lightweight backpack\", \"Travel-sized toiletries\", \"Packable rain jacket\",\n", - " \"Reusable water bottle\", \"Dry bag\", \"Trekking poles\", \"Hostel lock\", \"Quick-dry towel\",\n", - " \"Travel journal\", \"Energy bars\", \"Car charger\", \"Snacks\", \"Map\",\n", - " \"Sunglasses\", \"Cooler\", \"Blanket\", \"Emergency roadside kit\", \"Reusable coffee mug\",\n", - " \"Playlist\", \"Reusable shopping bags\", \"Earplugs\", \"Fanny pack\", \"Portable charger\",\n", - " \"Poncho\", \"Bandana\", \"Comfortable shoes\", \"Tent\", \"Refillable water bottle\",\n", - " \"Glow sticks\", \"Festival tickets\", \"Diapers\", \"Baby wipes\", \"Baby food\",\n", - " \"Stroller\", \"Pacifier\", \"Baby clothes\", \"Baby blanket\", \"Travel crib\",\n", - " \"Toys\", \"Nursing cover\"\n", - "]\n", - "\n", - "\n", - "# Get the prediction\n", - "output = query({\"inputs\": input_text, \"parameters\": {\"candidate_labels\": candidate_labels}})\n", - "print(output)" - ] - }, { "cell_type": "markdown", "id": "edf44387-d166-4e0f-a8ad-621230aee115", @@ -158,7 +103,7 @@ "trips = list(packing_data.keys())\n", "# Access the first trip description\n", "first_trip = trips[0]\n", - "# Get the packing list for the second trip\n", + "# Get the packing list for the secondfirst trip\n", "first_trip_items = packing_data[first_trip]\n", "\n", "print(f\"First trip: {first_trip} \\n\")\n", @@ -243,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "id": "116c7ee3-2b59-4623-a416-162c487aab70", "metadata": {}, "outputs": [], @@ -254,10 +199,204 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "id": "8591425b-ce55-4a36-a4b6-70974e8d4e59", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| bart_base | bart_large_mnli |\n", + "+======================================================================+======================================================================+\n", + "| bandana | travel adapter |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| lip balm | travel journal |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| hand warmers | light jacket |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sim card | sim card |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| neck wallet | bathing suit |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| tent | multi-tool |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| poncho | dry bag |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| gloves | travel pillow |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| painkiller | base layers |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| pen | day pack |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| thin scarf | entertainment for downtime (e.g. book/ebook, games, laptop, journal) |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| wallet | passport |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sleeping bag | thin scarf |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| dry bag | comfortable shoes |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| gifts | lightweight backpack |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| fanny pack | beach bag |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| beach towel | swimsuit |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| underwear | short pants/skirts |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| swimsuit | quick-dry towel |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| blanket | sunhat |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| laptop | local currency |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| quick-dry towel | tickets |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| ski jacket | wallet |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| emergency roadside kit | cardigan/sweater |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| passport | refillable water bottle |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| necessary medication | fanny pack |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| snacks for the journey | poncho |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| snow boots | thermal clothing |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sunglasses | laptop |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| flip-flops | pen |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| phone and charger | big backpack/suitcase |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| socks | beach towel |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| local currency | currency |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| t-shirts/tops | blanket |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| bathing suit | compass |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| currency | beanie |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| cardigan/sweater | sunscreen |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| snowboard | phone and charger |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| visa documents | reusable coffee mug |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| shirts | power bank |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| headphones | personal toiletries (e.g. toothbrush, toothpaste) |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| pants | packable rain jacket |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| refillable water bottle | bandana |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| beach bag | short pants |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| big backpack/suitcase | business attire |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| multi-tool | sleeping bag |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sandals | flashlight |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| tickets | t-shirts/tops |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| thermal clothing | waterproof phone case |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| short pants/skirts | long pants |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| light jacket | travel-sized toiletries |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| base layers | visa documents |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| snacks | sandals |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| comfortable shoes | hand warmers |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| lightweight backpack | hostel lock |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| winter shoes | headphones |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| dress shoes | emergency roadside kit |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| power bank | ski jacket |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| packable rain jacket | shirts |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| first aid kit | first aid kit |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| water filter | reusable shopping bags |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| short pants | flip-flops |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| ski goggles | camping stove |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| waterproof phone case | water filter |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sunhat | gloves |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| flashlight | dress shoes |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| earplugs | tent |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| beanie | sunglasses |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| hostel lock | pants |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| personal toiletries (e.g. toothbrush, toothpaste) | charging cables |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| travel journal | snacks |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| reusable coffee mug | neck wallet |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sunscreen | snacks for the journey |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| travel pillow | ski goggles |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| trekking poles | mosquito repellant |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| business attire | snorkel gear |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| snorkel gear | bug spray |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| reusable shopping bags | earplugs |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| sleep wear | travel insurance documents |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| camping stove | painkiller |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| travel-sized toiletries | hiking boots |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| hiking boots | necessary medication |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| travel insurance documents | socks |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| long pants | underwear |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| charging cables | trekking poles |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| entertainment for downtime (e.g. book/ebook, games, laptop, journal) | sleep wear |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| bug spray | gifts |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| day pack | lip balm |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| travel adapter | snowboard |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| malaria medication | malaria medication |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| compass | snow boots |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n", + "| mosquito repellant | winter shoes |\n", + "+----------------------------------------------------------------------+----------------------------------------------------------------------+\n" + ] + } + ], "source": [ "# Creating a table\n", "table = zip(result_bart_base[\"labels\"], \n", diff --git a/space/space/space/space/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json b/space/space/space/space/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json new file mode 100644 index 0000000000000000000000000000000000000000..038e192aa1e8c88a7a1d397c618c6bc029e7f756 --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/packing_templates_self_supported_offgrid_expanded.json @@ -0,0 +1,696 @@ +{ + "hut trek (summer)": [ + "lichtgewicht trekkingrugzak (30\u201345 liter)", + "waterzak of drinkflessen", + "sneldrogende kleding", + "regenjas", + "snacks/energierepen", + "wandelschoenen", + "hoed of pet", + "zonnebrandcr\u00e8me", + "lakenzak", + "oordoppen" + ], + "hut trek (winter)": [ + "slaapzak (lichte, warme variant)", + "lakenzak", + "binnenkleding voor hut (thermo / fleece)", + "hutpantoffels / Crocs", + "oordoppen", + "snacks voor onderweg", + "contant geld voor hutbetalingen" + ], + "camping trip (wild camping)": [ + "tent of tarp", + "slaapmat", + "slaapzak", + "hoofdlamp", + "mes of multitool", + "waterfilter", + "kookset + brander", + "voedsel en snacks", + "aansteker", + "toilettas met biologisch afbreekbare zeep" + ], + "camping trip (campground)": [ + "tent", + "kussen", + "stoeltje", + "kampeertafel (optioneel)", + "lamp of lantaarn", + "verlengsnoer (voor stroomcamping)", + "koelbox", + "servies & bestek", + "afwasspullen", + "boodschappen" + ], + "skitocht / skitour": [ + "touringski's of splitboard", + "stijgvellen", + "lawinepieper (transceiver)", + "schep", + "sonde", + "gore-tex jas en broek", + "donsjas of warme isolatielaag", + "helm", + "handschoenen (2 paar)", + "ski- of zonnebril", + "thermosfles", + "sneldrogende baselayers", + "gamaschen (bij diepe sneeuw)", + "tourrugzak met ski-bevestiging", + "laagjes voor temperatuurregeling", + "energierepen of sportvoeding", + "GPS of offline kaarten", + "EHBO-set", + "lichte handschoenen voor het stijgen" + ], + "snowboard / splitboard trip": [ + "splitboard of snowboard", + "lawinepieper", + "helm", + "dikke handschoenen", + "skibril", + "laagjes kleding", + "tourbindingen (voor splitboard)", + "stijgvellen", + "sonde en schep", + "lichte handschoenen voor het stijgen" + ], + "long-distance hike / thru-hike": [ + "lichtgewicht rugzak", + "waterfilter", + "voedselvoorraad", + "navigatie (kaart/kompas/GPS)", + "first aid kit", + "trail runners of lichte wandelschoenen", + "zonbescherming", + "regenbescherming", + "natte doekjes", + "sneldrogende handdoek" + ], + "digital nomad trip": [ + "laptop en oplader", + "wereldstekker", + "noise-cancelling koptelefoon", + "wifi-hotspot of lokale simkaart", + "powerbank", + "notitieboekje", + "lichte kleding", + "comfortabele rugzak of trolley", + "mifi-router of portable wifi-hotspot" + ], + "city trip": [ + "dagrugzak", + "oplader voor telefoon", + "stadsplattegrond / offline maps", + "betaalkaart / contant geld", + "comfortabele schoenen", + "waterfles", + "reisgids of highlightslijst", + "lichte jas of regenjas" + ], + "road trip (car/camper)": [ + "autopapieren", + "EHBO-kit", + "snacks en drinken", + "telefoonhouder / navigatie", + "kampeeruitrusting (indien overnachten)", + "reisgids of kaarten", + "zonnebril", + "stoel en tafel", + "vermaak (boek, muziek, spelletjes)" + ], + "festivaltrip": [ + "tent", + "matje en slaapzak", + "oordoppen", + "poncho of regenjas", + "glitter / outfit", + "herbruikbare beker", + "zonnebrand", + "cash / pinpas", + "vriendenafspraken", + "snacks" + ], + "yoga / wellness retreat": [ + "yogamat of yogahanddoek", + "comfortabele kleding", + "waterfles", + "dagboek / pen", + "warme trui of sjaal", + "sandalen", + "etherische olie (optioneel)", + "boek / meditatiemateriaal" + ], + "micro-adventure / weekend trip": [ + "dagrugzak", + "snacks en drinken", + "regenjas", + "warme laag", + "kaart of GPS", + "toilettasje", + "hoofddeksel", + "compacte slaapuitrusting (indien overnachting)" + ], + "beach vacation": [ + "zwemkleding", + "strandlaken", + "zonnebrandcr\u00e8me", + "zonnebril", + "hoed of pet", + "slippers", + "luchtige kleding", + "waterfles", + "strandtas", + "boek of e-reader" + ], + "cultural exploration": [ + "dagrugzak", + "oplader voor telefoon", + "stadsplattegrond / offline maps", + "betaalkaart / contant geld", + "comfortabele schoenen", + "waterfles", + "reisgids of highlightslijst", + "lichte jas of regenjas" + ], + "nature escape": [ + "dagrugzak", + "oplader voor telefoon", + "betaalkaart / contant geld", + "comfortabele schoenen", + "waterfles", + "downtime entertainment (e.g. book/ebook, games, laptop, journal)" + ], + "swimming": [ + "badkleding", + "handdoek", + "zonnebrandcr\u00e8me", + "slippers", + "zwembril", + "waterfles" + ], + "going to the beach": [ + "strandlaken", + "zwemkleding", + "zonnebrand", + "koeltas", + "strandstoel", + "zonnehoed" + ], + "relaxing": [ + "comfortabele kleding", + "boek of e-reader", + "zitkussen of strandmat", + "muziek / koptelefoon" + ], + "sightseeing": [ + "dagrugzak", + "waterfles", + "camera of smartphone", + "kaart of offline maps", + "zonnebril" + ], + "biking": [ + "fiets of huurfiets", + "helm", + "sportkleding", + "fietslicht en slot", + "reparatieset" + ], + "running": [ + "hardloopschoenen", + "sportkleding", + "zweetband of pet", + "waterfles of belt", + "sporthorloge (optioneel)" + ], + "skiing": [ + "ski\u2019s en stokken", + "skischoenen", + "helm", + "skibril", + "skipas", + "dikke handschoenen", + "gore-tex kleding" + ], + "cross-country skiing": [ + "langlaufski's en stokken", + "langlaufschoenen", + "ademende thermokleding", + "winddichte en waterafstotende buitenlaag", + "dunne handschoenen", + "muts of hoofdband", + "zonnebril of sportbril", + "buff of nekwarmer", + "lichte rugzak met water en snacks", + "EHBO-set" + ], + "ski touring": [ + "algemene items voor deze situatie", + "extra kleding of uitrusting indien nodig" + ], + "hiking": [ + "wandelschoenen of trailrunners", + "hiking sokken (anti-blaren)", + "hikingstokken", + "dagrugzak", + "regenjas of poncho", + "waterfles of waterzak", + "snacks / energierepen", + "zonnebrand en zonnebril", + "pet of hoed", + "blarenpleisters of tape", + "EHBO-set", + "navigatie (kaart, kompas of GPS)" + ], + "hut-to-hut hiking": [ + "lichtgewicht trekkingrugzak (30\u201345 liter)", + "waterflessen of waterzak", + "snacks voor onderweg", + "regenjas", + "licht donsjack of warme laag", + "sneldrogende kleding", + "wandelschoenen", + "lakenzak", + "pantoffels of slippers voor hut", + "oordoppen", + "reserveringsbevestiging / contant geld voor hut" + ], + "rock climbing": [ + "klimschoenen", + "klimgordel", + "zekeringsapparaat", + "chalk bag", + "helm" + ], + "ice climbing": [ + "ijsbijlen", + "crampons", + "klimtouw", + "warme isolatielagen", + "klimgordel en helm" + ], + "snowshoe hiking": [ + "algemene items voor deze situatie", + "extra kleding of uitrusting indien nodig" + ], + "kayaking / canoeing": [ + "kayak of kano", + "peddel", + "reddingsvest", + "drybag", + "waterschoenen" + ], + "stand-up paddleboarding (SUP)": [ + "SUP-board en peddel", + "reddingsvest", + "drybag", + "zonnebril met koord" + ], + "snorkeling": [ + "snorkel en duikbril", + "zwemvliezen", + "badkleding", + "waterdichte tas" + ], + "scuba diving": [ + "duikbril en snorkel", + "wetsuit", + "vinnen", + "duikcomputer", + "ademautomaat (indien eigen)" + ], + "surfing": [ + "surfboard", + "wetsuit", + "wax", + "board leash", + "poncho of handdoek" + ], + "paragliding": [ + "paraglider", + "helm", + "handschoenen", + "wandelschoenen", + "windjack" + ], + "horseback riding": [ + "rijbroek", + "rijlaarzen of schoenen met hak", + "handschoenen", + "helm", + "eventueel eigen zadel of stijgbeugels" + ], + "photography": [ + "camera + lenzen", + "statief", + "geheugenkaart(en)", + "extra accu's", + "lensdoekje" + ], + "fishing": [ + "hengel", + "aas / kunstaas", + "visvergunning", + "laarzen of waadpak", + "koelbox (optioneel)" + ], + "rafting": [ + "reddingsvest", + "waterdichte tas", + "waterschoenen", + "sneldrogende kleding", + "helm" + ], + "yoga": [ + "algemene items voor deze situatie", + "extra kleding of uitrusting indien nodig" + ], + "cold destination / winter": [ + "thermokleding", + "muts en handschoenen", + "warme jas", + "waterdichte schoenen", + "lippenbalsem" + ], + "warm destination / summer": [ + "luchtige kleding", + "zonnebril", + "zonnecr\u00e8me", + "waterfles", + "hoed of pet" + ], + "variable weather / spring / autumn": [ + "regenjas", + "laagjeskleding", + "warme trui", + "waterdichte schoenen" + ], + "tropical / humid": [ + "lichtgewicht kleding", + "insectenspray", + "zonnecr\u00e8me", + "regenponcho", + "sneldrogende handdoek" + ], + "dry / desert-like": [ + "zonnebril", + "zonnecr\u00e8me", + "hoofdbescherming", + "lichte lange mouwen", + "veel water" + ], + "ultralight": [ + "lichtgewicht rugzak (< 1kg)", + "minimalistische shelter (tarp of tent)", + "lichtgewicht slaapmat", + "quilt of donsdeken", + "titanium kookset", + "beperkte kleding (laagjes!)", + "compacte regenjas", + "sneldrogende handdoek", + "tandenborstel (afgezaagd ;))" + ], + "lightweight (but comfortable)": [ + "lichte tent of tarp", + "comfortabele slaapmat", + "lichtgewicht kookset", + "compact kledingpakket", + "sneldrogende handdoek" + ], + "luxury (including evening wear)": [ + "nette schoenen", + "jurk of overhemd", + "parfum/deodorant", + "accessoires", + "reistoilettas met essentials" + ], + "minimalist": [ + "1 set kleding voor elke situatie", + "compacte tandenborstel", + "alles-in-\u00e9\u00e9n zeep", + "lichtgewicht handdoek", + "kleine rugzak" + ], + "casual": [ + "jeans of comfortabele broek", + "t-shirts", + "trui of hoodie", + "sneakers", + "zonnebril" + ], + "formal (business trip)": [ + "overhemd / blouse", + "net jasje", + "nette schoenen", + "laptop en oplader", + "naamkaartjes / documenten" + ], + "conservative": [ + "bedekkende kleding", + "sjaal of omslagdoek", + "lange broek of rok", + "gesloten schoenen" + ], + "outdoor": [ + "regenjas", + "waterdichte schoenen", + "bivakzak of tarp", + "hoofdlamp", + "navigatie" + ], + "indoor": [ + "pantoffels", + "comfortabele kleding", + "pyjama", + "oplader", + "toilettas" + ], + "huts with half board": [ + "reserveringsbevestiging", + "lakenzak (vaak verplicht)", + "pantoffels of slippers voor binnen", + "lichte pyjama of slaapkleding", + "oorstopjes", + "waterfles", + "snacks voor onderweg", + "kleine toilettas", + "contant geld voor betalingen", + "lichte handdoek", + "zaklamp of hoofdlamp" + ], + "sleeping in a tent": [ + "tent (1- of 2-persoons, afhankelijk van reis)", + "grondzeil", + "slaapmat", + "slaapzak (passend bij temperatuur)", + "hoofdlamp of zaklamp", + "sneldrogende handdoek", + "kussen of opblaasbaar hoofdkussen", + "oorstopjes", + "toilettas", + "powerbank", + "waterfles", + "boek of e-reader", + "EHBO-set" + ], + "sleeping in a car": [ + "slaapmat die past in auto", + "warme slaapzak", + "zonneschermen of verduistering", + "kussen", + "waterfles binnen handbereik", + "powerbank of 12V-lader", + "toilettas", + "snacks voor de nacht", + "thermische deken (voor koude nachten)" + ], + "vehicle": [ + "rijbewijs", + "autopapieren", + "EHBO-set", + "navigatie of smartphone", + "telefoonhouder" + ], + "no vehicle": [ + "rugzak", + "waterfles", + "lichte schoenen", + "openbaar vervoer app of ticket" + ], + "off-grid / no electricity": [ + "powerbank (minstens 10.000 mAh)", + "zonnepaneel of draagbaar laadsysteem", + "hoofdlamp + extra batterijen", + "oplaadbare batterijen en oplader", + "back-up verlichting (bijv. kleine zaklamp)", + "papieren kaart en kompas", + "notitieboekje + pen", + "noodcommunicatie (bijv. GPS beacon of satellietboodschapper)", + "opvouwbaar zonnepaneel (indien langere tochten)", + "navigatieapparaat met offline kaarten", + "extra opladerkabels", + "USB-hub (voor meerdere devices)", + "verpakking om elektronica droog te houden" + ], + "self-supported (bring your own food/cooking)": [ + "lichtgewicht kooktoestel (gas, benzine of alcohol)", + "brandstof (voldoende voor aantal dagen)", + "pan of keteltje", + "spork of lepel", + "opvouwbaar snijplankje (optioneel)", + "aandrukbare kom of beker", + "aansteker + lucifers (waterdicht verpakt)", + "gedroogde of gevriesdroogde maaltijden", + "snacks / noodbars", + "afwasmiddel (biologisch afbreekbaar) + sponsje", + "opslagzakken voor afval", + "waterfilter of -pomp", + "chloordruppels of zuiveringstabletten", + "minstens 2 liter wateropslag per persoon", + "food bag of hangzak voor voedsel (wild-safe)" + ], + "child-friendly": [ + "snacks en speelgoed", + "EHBO-set met pleisters", + "extra kleding", + "kinderdrager of buggy", + "zonbescherming", + "extra snacks voor kinderen", + "favoriet speelgoed of knuffel", + "reisstoel of draagzak", + "natte doekjes", + "luiers of potje (afhankelijk van leeftijd)", + "extra set kleding per dag", + "reisapotheek voor kinderen", + "kinderzonnebrand", + "activiteitenboekje of tablet met filmpjes", + "snelle snacks voor onderweg", + "kinder slaapzak of slaapmat", + "reisbedje of matrasje (voor jonge kinderen)", + "luiers of oefenbroekjes", + "flesjes en voeding (indien van toepassing)", + "babyfoon (voor verblijf op locatie)", + "speen of fopspeen", + "kinder EHBO-set (inclusief thermometer)", + "zonnehoedje of muts", + "regenhoes voor kinderwagen of draagzak", + "hydraterende cr\u00e8me (voor gevoelige huid)" + ], + "pet-friendly": [ + "voer en waterbak", + "hondenriem of tuigje", + "poepzakjes", + "reismatje of deken", + "vaccinatieboekje" + ], + "rainy climate": [ + "regenjas of poncho", + "waterdichte rugzakhoes", + "sneldrogende kleding", + "rubberen schoenen" + ], + "snow and ice": [ + "warme laarzen", + "dikke handschoenen", + "sneeuwbril", + "thermokleding", + "gripzolen / spikes" + ], + "high alpine terrain": [ + "wandelstokken", + "kaart en kompas", + "wind- en waterdichte jas", + "extra voeding", + "EHBO-kit" + ], + "avalanche-prone terrain": [ + "lawinepieper", + "schep", + "sonde", + "airbag rugzak (indien beschikbaar)", + "kennis van lawineveiligheid / cursus", + "kaart en kompas / GPS", + "partner check voor vertrek" + ], + "no special conditions": [ + ] + "1 day": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "2 days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "3 days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "4 days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "5 days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "6 days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "7 days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "7+ days": [ + "ondergoed per dag", + "sokken per dag", + "toilettas", + "extra kledinglaag", + "aantal maaltijden/snacks afgestemd op duur" + ], + "default_items": [ + "telefoon + oplader", + "powerbank", + "identiteitsbewijs of paspoort", + "betaalmiddelen (pinpas / contant geld)", + "verzekeringspas / reisverzekering-info", + "toilettas (tandpasta, borstel, deodorant, zeep)", + "zonnebrandcr\u00e8me", + "lippenbalsem", + "ondergoed", + "sokken", + "regenjas of windjack", + "waterfles", + "snacks", + "zonnebril", + "oorstopjes", + "slaapmasker", + "herbruikbare tas", + "zakdoekjes of toiletpapier" + ] +} \ No newline at end of file diff --git a/space/space/space/space/space/space/space/space/space/space/space/labels.txt b/space/space/space/space/space/space/space/space/space/space/space/labels.txt index ec24df45c966bdd13193d1b2d83aadcc95b2567e..bb0a47ce96735e65087594d4e4733637a2d1c1e4 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/labels.txt +++ b/space/space/space/space/space/space/space/space/space/space/space/labels.txt @@ -1,89 +1,93 @@ -Swimsuit -Sunscreen -Flip-flops -Beach towel -Sunglasses -Waterproof phone case -Hat -Beach bag -Snorkel gear -Aloe vera gel -Tent -Sleeping bag -Camping stove -Flashlight -Hiking boots -Water filter -Compass -First aid kit -Bug spray -Multi-tool -Thermal clothing -Ski jacket -Ski goggles -Snow boots -Gloves -Hand warmers -Beanie -Lip balm -Snowboard -Base layers -Passport -Visa documents -Travel adapter -Currency -Language phrasebook -SIM card -Travel pillow -Neck wallet -Travel insurance documents -Power bank -Laptop -Notebook -Business attire -Dress shoes -Charging cables -Presentation materials -Work ID badge -Pen -Headphones -Lightweight backpack -Travel-sized toiletries -Packable rain jacket -Reusable water bottle -Dry bag -Trekking poles -Hostel lock -Quick-dry towel -Travel journal -Energy bars -Car charger -Snacks -Map -Sunglasses -Cooler -Blanket -Emergency roadside kit -Reusable coffee mug -Playlist -Reusable shopping bags -Earplugs -Fanny pack -Portable charger -Poncho -Bandana -Comfortable shoes -Tent -Refillable water bottle -Glow sticks -Festival tickets -Diapers -Baby wipes -Baby food -Stroller -Pacifier -Baby clothes -Baby blanket -Travel crib -Toys -Nursing cover +sunscreen +sunglasses +sunhat +flip-flops +swimsuit +beach towel +waterproof phone case +beach bag +snorkel gear +tent +sleeping bag +camping stove +flashlight +hiking boots +water filter +compass +first aid kit +bug spray +multi-tool +thermal clothing +ski jacket +ski goggles +snow boots +gloves +hand warmers +beanie +lip balm +snowboard +base layers +passport +visa documents +travel adapter +currency +sim card +travel pillow +neck wallet +travel insurance documents +power bank +laptop +business attire +dress shoes +charging cables +pen +headphones +lightweight backpack +travel-sized toiletries +packable rain jacket +dry bag +trekking poles +hostel lock +quick-dry towel +travel journal +snacks +blanket +emergency roadside kit +reusable coffee mug +reusable shopping bags +earplugs +fanny pack +poncho +bandana +comfortable shoes +bathing suit +sandals +light jacket +entertainment for downtime (e.g. book/ebook, games, laptop, journal) +short pants/skirts +t-shirts/tops +thin scarf +pants +shirts +cardigan/sweater +gifts +winter shoes +long pants +short pants +malaria medication +mosquito repellant +local currency +wallet +tickets +phone and charger +painkiller +necessary medication +personal toiletries (e.g. toothbrush, toothpaste) +underwear +socks +sleep wear +snacks for the journey +refillable water bottle +day pack +big backpack/suitcase + diff --git a/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb b/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb index 222a6c895349dca116b79704b3ccd40e88c2f17c..f6197119ef00f69c7b8c1c74ecbb1219a22db2fb 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb +++ b/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb @@ -124,7 +124,58 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 35, + "id": "1d01a363-572b-450c-8fce-0721234f9a1a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First trip: 7-Day Island Beach Holiday in Greece (Summer). I am planning a trip to Greece with my boyfriend, where we will visit two islands. We have booked an apartment on each island for a few days and plan to spend most of our time relaxing. Our main goals are to enjoy the beach, try delicious local food, and possibly go on a hike—if it’s not too hot. We will be relying solely on public transport. We’re in our late 20s and traveling from the Netherlands. \n", + "\n", + "Packing list: ['bathing suit', 'beach towel', 'beach bag', 'sandals', 'comfortable walking shoes', 'light jacket', 'sunscreen', 'sunglasses', 'sunhat', 'entertainment for downtime (e.g. book/ebook, games, laptop, journal)', 'short pants/skirts', 't-shirts/tops']\n" + ] + } + ], + "source": [ + "# Prerequisites\n", + "from tabulate import tabulate\n", + "from transformers import pipeline\n", + "import json\n", + "\n", + "# input text\n", + "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", + "\n", + "# Load labels from a txt file\n", + "with open(\"labels.txt\", \"r\", encoding=\"utf-8\") as f:\n", + " class_labels = [line.strip() for line in f if line.strip()]\n", + "\n", + "# Load test data (in dictionary)\n", + "with open(\"test_data.json\", \"r\") as file:\n", + " packing_data = json.load(file)\n", + "# Get a list of trip descriptions (keys)\n", + "trips = list(packing_data.keys())\n", + "# Access the first trip description\n", + "first_trip = trips[0]\n", + "# Get the packing list for the second trip\n", + "first_trip_items = packing_data[first_trip]\n", + "\n", + "print(f\"First trip: {first_trip} \\n\")\n", + "print(f\"Packing list: {first_trip_items}\")" + ] + }, + { + "cell_type": "markdown", + "id": "88aa1d7e-8a32-4530-9ddd-60fa38e4a342", + "metadata": {}, + "source": [ + "Load classifiers" + ] + }, + { + "cell_type": "code", + "execution_count": 36, "id": "d0d8f7c0-c2d9-4fbe-b1a7-699a5b99466c", "metadata": {}, "outputs": [ @@ -140,82 +191,89 @@ } ], "source": [ - "from transformers import pipeline\n", - "\n", - "# Load the model and create a pipeline for zero-shot classification\n", - "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")" + "# Load smaller the model and create a pipeline for zero-shot classification (1min loading + classifying with 89 labels)\n", + "classifier_bart_base = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")" ] }, { "cell_type": "code", - "execution_count": 6, - "id": "4682d620-c9a6-40ad-ab4c-268ee0ef7212", + "execution_count": 37, + "id": "a971ca1c-d478-489f-9592-bc243d587eb4", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n" ] - }, + } + ], + "source": [ + "# Load larger the model and create a pipeline for zero-shot classification (5min loading model + classifying with 89 labels)\n", + "classifier_bart_large_mnli = pipeline(\"zero-shot-classification\", model=\"facebook/bart-large-mnli\")" + ] + }, + { + "cell_type": "markdown", + "id": "38805499-9919-40fe-9d42-de6869ba01dc", + "metadata": {}, + "source": [ + "Try classifiers" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "abb13524-71c6-448d-948d-fb22a0e0ceeb", + "metadata": {}, + "outputs": [ { - "name": "stdout", + "name": "stderr", "output_type": "stream", "text": [ - "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Swimsuit', 'Travel crib', 'Business attire', 'Toys', 'Notebook', 'Travel adapter', 'Compass', 'Travel pillow', 'Headphones', 'Travel journal', 'Playlist', 'Flip-flops', 'Hiking boots', 'Reusable coffee mug', 'Comfortable shoes', 'Nursing cover', 'Gloves', 'Tent', 'Tent', 'Sunglasses', 'Sunglasses', 'Charging cables', 'Travel-sized toiletries', 'Refillable water bottle', 'Energy bars', 'Dress shoes', 'Festival tickets', 'Lightweight backpack', 'Packable rain jacket', 'Flashlight', 'Hostel lock', 'Presentation materials', 'Thermal clothing', 'Snowboard', 'Camping stove', 'Reusable shopping bags', 'Reusable water bottle', 'Blanket', 'Diapers', 'Snorkel gear', 'Snacks', 'Emergency roadside kit', 'Beach towel', 'Sunscreen', 'Car charger', 'Bug spray', 'Passport', 'Currency', 'Beach bag', 'Ski jacket', 'First aid kit', 'Cooler', 'Quick-dry towel', 'Laptop', 'Aloe vera gel', 'Earplugs', 'Baby wipes', 'Ski goggles', 'Travel insurance documents', 'Portable charger', 'Beanie', 'Bandana', 'Multi-tool', 'Pacifier', 'Stroller', 'Language phrasebook', 'Waterproof phone case', 'Dry bag', 'Map', 'Lip balm', 'Fanny pack', 'Trekking poles', 'Power bank', 'Baby clothes', 'Baby food', 'Poncho', 'Sleeping bag', 'Work ID badge', 'Visa documents', 'SIM card', 'Water filter', 'Snow boots', 'Hand warmers', 'Baby blanket', 'Base layers', 'Pen', 'Hat', 'Neck wallet', 'Glow sticks'], 'scores': [0.012542711570858955, 0.012216676957905293, 0.012068654410541058, 0.011977529153227806, 0.011932261288166046, 0.011920000426471233, 0.011883101426064968, 0.011842883192002773, 0.011819617822766304, 0.011810989119112492, 0.011761271394789219, 0.011756575666368008, 0.011726364493370056, 0.011664840392768383, 0.011632450856268406, 0.01163020171225071, 0.01158054918050766, 0.011572858318686485, 0.011572858318686485, 0.011541635729372501, 0.011541635729372501, 0.011517350561916828, 0.011510960757732391, 0.011489875614643097, 0.011469963937997818, 0.011466587893664837, 0.011442759074270725, 0.011438597925007343, 0.011437375098466873, 0.011433145962655544, 0.011407203041017056, 0.011401104740798473, 0.01135423593223095, 0.011333385482430458, 0.011328010819852352, 0.011325137689709663, 0.01131997536867857, 0.011306566186249256, 0.011299673467874527, 0.011281789280474186, 0.011264320462942123, 0.011257764883339405, 0.011256475001573563, 0.011253912933170795, 0.011252702213823795, 0.011248898692429066, 0.011247594840824604, 0.011239985004067421, 0.01121864840388298, 0.011208567768335342, 0.011174682527780533, 0.011166973039507866, 0.011159253306686878, 0.011151333339512348, 0.011140624061226845, 0.011139076203107834, 0.01113345380872488, 0.011126152239739895, 0.011093570850789547, 0.011078842915594578, 0.011067545972764492, 0.011044573038816452, 0.01101986039429903, 0.011016158387064934, 0.011015082709491253, 0.011007890105247498, 0.010997296310961246, 0.010962157510221004, 0.01095755398273468, 0.010940180160105228, 0.01088095735758543, 0.010869039222598076, 0.010858545079827309, 0.010820968076586723, 0.01080892514437437, 0.010798529721796513, 0.01077410951256752, 0.010764310136437416, 0.010748079977929592, 0.010681436397135258, 0.010675576515495777, 0.010557047091424465, 0.010552684776484966, 0.010509641841053963, 0.010396942496299744, 0.01037551462650299, 0.01033466774970293, 0.010237698443233967, 0.009954877197742462]}\n" + "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" ] } ], "source": [ - "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", - "\n", - "# Candidate labels\n", - "candidate_labels = [\n", - " \"Swimsuit\", \"Sunscreen\", \"Flip-flops\", \"Beach towel\", \"Sunglasses\", \n", - " \"Waterproof phone case\", \"Hat\", \"Beach bag\", \"Snorkel gear\", \"Aloe vera gel\",\n", - " \"Tent\", \"Sleeping bag\", \"Camping stove\", \"Flashlight\", \"Hiking boots\",\n", - " \"Water filter\", \"Compass\", \"First aid kit\", \"Bug spray\", \"Multi-tool\",\n", - " \"Thermal clothing\", \"Ski jacket\", \"Ski goggles\", \"Snow boots\", \"Gloves\",\n", - " \"Hand warmers\", \"Beanie\", \"Lip balm\", \"Snowboard\", \"Base layers\",\n", - " \"Passport\", \"Visa documents\", \"Travel adapter\", \"Currency\", \"Language phrasebook\",\n", - " \"SIM card\", \"Travel pillow\", \"Neck wallet\", \"Travel insurance documents\", \"Power bank\",\n", - " \"Laptop\", \"Notebook\", \"Business attire\", \"Dress shoes\", \"Charging cables\",\n", - " \"Presentation materials\", \"Work ID badge\", \"Pen\", \"Headphones\", \n", - " \"Lightweight backpack\", \"Travel-sized toiletries\", \"Packable rain jacket\",\n", - " \"Reusable water bottle\", \"Dry bag\", \"Trekking poles\", \"Hostel lock\", \"Quick-dry towel\",\n", - " \"Travel journal\", \"Energy bars\", \"Car charger\", \"Snacks\", \"Map\",\n", - " \"Sunglasses\", \"Cooler\", \"Blanket\", \"Emergency roadside kit\", \"Reusable coffee mug\",\n", - " \"Playlist\", \"Reusable shopping bags\", \"Earplugs\", \"Fanny pack\", \"Portable charger\",\n", - " \"Poncho\", \"Bandana\", \"Comfortable shoes\", \"Tent\", \"Refillable water bottle\",\n", - " \"Glow sticks\", \"Festival tickets\", \"Diapers\", \"Baby wipes\", \"Baby food\",\n", - " \"Stroller\", \"Pacifier\", \"Baby clothes\", \"Baby blanket\", \"Travel crib\",\n", - " \"Toys\", \"Nursing cover\"\n", - "]\n", - "\n", - "\n", - "# Run the classification\n", - "result = classifier(input_text, candidate_labels)\n", - "\n", - "# Print the result\n", - "print(result)" + "# Run the classification (ca 30 seconds classifying)\n", + "result_bart_base = classifier_bart_base(first_trip, class_labels)" ] }, { "cell_type": "code", "execution_count": null, - "id": "a344a80f-7645-4c2c-b960-580aa0b345f6", + "id": "116c7ee3-2b59-4623-a416-162c487aab70", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# Run the classification (ca 1 minute classifying)\n", + "result_bart_large_mnli = classifier_bart_large_mnli(first_trip, class_labels)" + ] }, { "cell_type": "code", "execution_count": null, - "id": "5eb705d6-c31c-406c-9739-ff45b66c7ca4", + "id": "8591425b-ce55-4a36-a4b6-70974e8d4e59", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# Creating a table\n", + "table = zip(result_bart_base[\"labels\"], \n", + " result_bart_large_mnli[\"labels\"])\n", + "headers = [\"bart_base\", \"bart_large_mnli\"]\n", + "\n", + "print(tabulate(table, headers=headers, tablefmt=\"grid\"))\n" + ] + }, + { + "cell_type": "markdown", + "id": "21a35d0c-9451-433a-b14c-87e8dac21d68", + "metadata": {}, + "source": [ + "**Try simple prompt engineering**" + ] }, { "cell_type": "code", @@ -224,21 +282,17 @@ "metadata": {}, "outputs": [], "source": [ - "# Example text to classify\n", - "text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", - "\n", "# No prompt\n", - "no_prompt = text\n", - "no_result = classifier(no_prompt, candidate_labels)\n", - "\n", + "no_prompt = input_text\n", + "no_result = classifier(no_prompt, class_labels)\n", "\n", "# Simple prompt\n", - "simple_prompt = \"Classify the following text: \" + text\n", - "simple_result = classifier(simple_prompt, candidate_labels)\n", + "simple_prompt = \"Classify the following text: \" + input_text\n", + "simple_result = classifier(simple_prompt, class_labels)\n", "\n", "# Primed prompt\n", - "primed_prompt = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july. What are the most important things to pack for the trip?\"\n", - "primed_result = classifier(primed_prompt, candidate_labels)" + "primed_prompt = input_text + \"What are the most important things to pack for the trip?\"\n", + "primed_result = classifier(primed_prompt, class_labels)" ] }, { @@ -436,9 +490,6 @@ } ], "source": [ - "from tabulate import tabulate\n", - "\n", - "\n", "# Creating a table\n", "table = zip(no_result[\"labels\"], no_result[\"scores\"], \n", " simple_result[\"labels\"], simple_result[\"scores\"], \n", @@ -447,14 +498,6 @@ "\n", "print(tabulate(table, headers=headers, tablefmt=\"grid\"))\n" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5ed9bda0-41f2-4c7c-b055-27c1998c1d4e", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/app-checkpoint.py b/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/app-checkpoint.py index b04ea6d9db58b6fd21796e0c0e013a2b1d3f40bd..948b66b2b3571417237381958a3e5ee68345a6a8 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/app-checkpoint.py +++ b/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/app-checkpoint.py @@ -1,25 +1,25 @@ -import gradio as gr from transformers import pipeline +import gradio as gr -# Initialize the zero-shot classification pipeline +# Load the model and create a pipeline for zero-shot classification classifier = pipeline("zero-shot-classification", model="facebook/bart-base") -# Define the classification function -def classify_text(text, labels): - labels = labels.split(",") # Convert the comma-separated string into a list - result = classifier(text, candidate_labels=labels) - return result +# Load labels from a txt file +with open("labels.txt", "r", encoding="utf-8") as f: + class_labels = [line.strip() for line in f if line.strip()] -# Set up the Gradio interface -with gr.Blocks() as demo: - gr.Markdown("# Zero-Shot Classification") - text_input = gr.Textbox(label="Input Text") - label_input = gr.Textbox(label="Comma-separated Labels") - output = gr.JSON(label="Result") - classify_button = gr.Button("Classify") +# Define the Gradio interface +def classify(text): + return classifier(text, class_labels) - # Link the button to the classification function - classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output) +demo = gr.Interface( + fn=classify, + inputs="text", + outputs="json", + title="Zero-Shot Classification", + description="Enter a text describing your trip", +) -# Launch the Gradio interface -demo.launch() +# Launch the Gradio app +if __name__ == "__main__": + demo.launch() \ No newline at end of file diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb b/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb index 363fcab7ed6e9634e198cf5555ceb88932c9a245..f0e770f8ce7bd71d0fc1953ebe17d0a71bb77218 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb +++ b/space/space/space/space/space/space/space/space/space/space/space/space/.ipynb_checkpoints/gradio_tryout-checkpoint.ipynb @@ -1,6 +1,186 @@ { - "cells": [], - "metadata": {}, + "cells": [ + { + "cell_type": "markdown", + "id": "e25090fa-f990-4f1a-84f3-b12159eedae8", + "metadata": {}, + "source": [ + "# Try out gradio" + ] + }, + { + "cell_type": "markdown", + "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", + "metadata": {}, + "source": [ + "Try model" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "fa0d8126-e346-4412-9197-7d51baf868da", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Some weights of BartForSequenceClassification were not initialized from the model checkpoint at facebook/bart-base and are newly initialized: ['classification_head.dense.bias', 'classification_head.dense.weight', 'classification_head.out_proj.bias', 'classification_head.out_proj.weight']\n", + "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n", + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n", + "Failed to determine 'entailment' label id from the label2id mapping in the model config. Setting to -1. Define a descriptive label2id mapping in the model config to ensure correct outputs.\n", + "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Map', 'Compass', 'Laptop', 'Car charger', 'Toys', 'Travel crib', 'Hat', 'Playlist', 'Stroller', 'Currency', 'Travel adapter', 'Hostel lock', 'Pen', 'Charging cables', 'Flip-flops', 'Pacifier', 'Camping stove', 'Multi-tool', 'Passport', 'Poncho', 'Hiking boots', 'Portable charger', 'Power bank', 'Trekking poles', 'Snowboard', 'Base layers', 'Bandana', 'Aloe vera gel', 'Gloves', 'Baby blanket', 'Tent', 'Tent', 'Snorkel gear', 'Water filter', 'Diapers', 'Presentation materials', 'Nursing cover', 'Headphones', 'Sunscreen', 'Beach towel', 'Snacks', 'Ski jacket', 'Earplugs', 'Ski goggles', 'Flashlight', 'Neck wallet', 'Swimsuit', 'Notebook', 'Thermal clothing', 'Blanket', 'Snow boots', 'Sleeping bag', 'Lightweight backpack', 'Refillable water bottle', 'Quick-dry towel', 'Comfortable shoes', 'Reusable shopping bags', 'Travel journal', 'Travel pillow', 'Beach bag', 'Reusable coffee mug', 'Reusable water bottle', 'Festival tickets', 'Waterproof phone case', 'Business attire', 'Sunglasses', 'Sunglasses', 'Cooler', 'Baby clothes', 'Fanny pack', 'Beanie', 'First aid kit', 'Emergency roadside kit', 'Dry bag', 'SIM card', 'Energy bars', 'Baby food', 'Work ID badge', 'Packable rain jacket', 'Hand warmers', 'Visa documents', 'Glow sticks', 'Bug spray', 'Travel-sized toiletries', 'Dress shoes', 'Language phrasebook', 'Baby wipes', 'Lip balm', 'Travel insurance documents'], 'scores': [0.013028442859649658, 0.012909057550132275, 0.0124660674482584, 0.012431488372385502, 0.012379261665046215, 0.012377972714602947, 0.012329353019595146, 0.012096051126718521, 0.012086767703294754, 0.011947661638259888, 0.011939236894249916, 0.011935302056372166, 0.011887168511748314, 0.011814153753221035, 0.011788924224674702, 0.011783207766711712, 0.01177265401929617, 0.011771135963499546, 0.011747810058295727, 0.011738969013094902, 0.01169698778539896, 0.01166312862187624, 0.011658026836812496, 0.011596457101404667, 0.01158847101032734, 0.011561167426407337, 0.011526867747306824, 0.01149983424693346, 0.011472185142338276, 0.011455104686319828, 0.011445573531091213, 0.011445573531091213, 0.011444379575550556, 0.011416648514568806, 0.01136692427098751, 0.011363024823367596, 0.011361461132764816, 0.011328471824526787, 0.011299548670649529, 0.011291779577732086, 0.011282541789114475, 0.01127372495830059, 0.011270811781287193, 0.011263585649430752, 0.011179029010236263, 0.011149592697620392, 0.01113132108002901, 0.011122703552246094, 0.011105425655841827, 0.011101326905190945, 0.011090466752648354, 0.011066330596804619, 0.011058374308049679, 0.011055233888328075, 0.01103114802390337, 0.011022195219993591, 0.011012199334800243, 0.01100123766809702, 0.010985593311488628, 0.010961917228996754, 0.010958753526210785, 0.010938071645796299, 0.010903625749051571, 0.010879918932914734, 0.010863620787858963, 0.010824359022080898, 0.010824359022080898, 0.010805793106555939, 0.010763236321508884, 0.010710005648434162, 0.010690474882721901, 0.010647830553352833, 0.010583569295704365, 0.010571518912911415, 0.010570857673883438, 0.010552200488746166, 0.0105352271348238, 0.010523369535803795, 0.010514546185731888, 0.010479346849024296, 0.010450395755469799, 0.010436479933559895, 0.01043587177991867, 0.010400519706308842, 0.010214710608124733, 0.010052643716335297, 0.010041419416666031, 0.010003888048231602, 0.009946384467184544]}\n" + ] + } + ], + "source": [ + "from transformers import pipeline\n", + "import gradio as gr\n", + "\n", + "# Load the model and create a pipeline for zero-shot classification\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", + "\n", + "# Load labels from a txt file\n", + "with open(\"labels.txt\", \"r\", encoding=\"utf-8\") as f:\n", + " class_labels = [line.strip() for line in f if line.strip()]\n", + "\n", + "# Example text to classify\n", + "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", + "\n", + "# Perform classification\n", + "result = classifier(input_text, class_labels)\n", + "\n", + "print(result)" + ] + }, + { + "cell_type": "markdown", + "id": "8e856a9c-a66c-4c4b-b7cf-8c52abbbc6fa", + "metadata": {}, + "source": [ + "Use model with gradio" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7860\n", + "\n", + "To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Define the Gradio interface\n", + "def classify(text):\n", + " return classifier(text, class_labels)\n", + "\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=\"text\",\n", + " outputs=\"json\",\n", + " title=\"Zero-Shot Classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", + "\n", + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch()" + ] + }, + { + "cell_type": "markdown", + "id": "d6526d18-6ba6-4a66-8310-21337b832d84", + "metadata": {}, + "source": [ + "Simple app" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5496ded9-7294-4da4-af05-00e5846cdd04", + "metadata": {}, + "outputs": [], + "source": [ + "import gradio as gr\n", + "from transformers import pipeline\n", + "\n", + "# Initialize the zero-shot classification pipeline\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", + "\n", + "# Define the classification function\n", + "def classify_text(text, labels):\n", + " labels = labels.split(\",\") # Convert the comma-separated string into a list\n", + " result = classifier(text, candidate_labels=labels)\n", + " return result\n", + "\n", + "# Set up the Gradio interface\n", + "with gr.Blocks() as demo:\n", + " gr.Markdown(\"# Zero-Shot Classification\")\n", + " text_input = gr.Textbox(label=\"Input Text\")\n", + " label_input = gr.Textbox(label=\"Comma-separated Labels\")\n", + " output = gr.JSON(label=\"Result\")\n", + " classify_button = gr.Button(\"Classify\")\n", + "\n", + " # Link the button to the classification function\n", + " classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output)\n", + "\n", + "# Launch the Gradio interface\n", + "demo.launch()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python (huggingface_env)", + "language": "python", + "name": "huggingface_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.20" + } + }, "nbformat": 4, "nbformat_minor": 5 } diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/app.py b/space/space/space/space/space/space/space/space/space/space/space/space/app.py index b04ea6d9db58b6fd21796e0c0e013a2b1d3f40bd..948b66b2b3571417237381958a3e5ee68345a6a8 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/space/app.py +++ b/space/space/space/space/space/space/space/space/space/space/space/space/app.py @@ -1,25 +1,25 @@ -import gradio as gr from transformers import pipeline +import gradio as gr -# Initialize the zero-shot classification pipeline +# Load the model and create a pipeline for zero-shot classification classifier = pipeline("zero-shot-classification", model="facebook/bart-base") -# Define the classification function -def classify_text(text, labels): - labels = labels.split(",") # Convert the comma-separated string into a list - result = classifier(text, candidate_labels=labels) - return result +# Load labels from a txt file +with open("labels.txt", "r", encoding="utf-8") as f: + class_labels = [line.strip() for line in f if line.strip()] -# Set up the Gradio interface -with gr.Blocks() as demo: - gr.Markdown("# Zero-Shot Classification") - text_input = gr.Textbox(label="Input Text") - label_input = gr.Textbox(label="Comma-separated Labels") - output = gr.JSON(label="Result") - classify_button = gr.Button("Classify") +# Define the Gradio interface +def classify(text): + return classifier(text, class_labels) - # Link the button to the classification function - classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output) +demo = gr.Interface( + fn=classify, + inputs="text", + outputs="json", + title="Zero-Shot Classification", + description="Enter a text describing your trip", +) -# Launch the Gradio interface -demo.launch() +# Launch the Gradio app +if __name__ == "__main__": + demo.launch() \ No newline at end of file diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb b/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb index a384bce4e058330cb0bdd8c568539bd75799a3ce..f0e770f8ce7bd71d0fc1953ebe17d0a71bb77218 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb +++ b/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "id": "fa0d8126-e346-4412-9197-7d51baf868da", "metadata": { "scrolled": true @@ -39,7 +39,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Compass', 'Travel insurance documents', 'Cooler', 'Poncho', 'Comfortable shoes', 'Thermal clothing', 'Business attire', 'Stroller', 'Refillable water bottle', 'Sunscreen', 'Hiking boots', 'Trekking poles', 'Tent', 'Tent', 'Swimsuit', 'Lightweight backpack', 'Diapers', 'Pen', 'Lip balm', 'Bandana', 'Presentation materials', 'Snorkel gear', 'Sunglasses', 'Sunglasses', 'Snowboard', 'Baby wipes', 'Emergency roadside kit', 'Blanket', 'Passport', 'Aloe vera gel', 'Currency', 'Beanie', 'Hand warmers', 'Reusable shopping bags', 'Hat', 'Travel-sized toiletries', 'Waterproof phone case', 'Energy bars', 'Baby food', 'Reusable water bottle', 'Flashlight', 'Gloves', 'Baby clothes', 'Hostel lock', 'Visa documents', 'Camping stove', 'Bug spray', 'Packable rain jacket', 'Travel pillow', 'Power bank', 'Earplugs', 'Quick-dry towel', 'Reusable coffee mug', 'Travel journal', 'Fanny pack', 'Headphones', 'Notebook', 'Dress shoes', 'Nursing cover', 'Playlist', 'Base layers', 'Work ID badge', 'Festival tickets', 'Sleeping bag', 'Laptop', 'Baby blanket', 'Charging cables', 'Snow boots', 'First aid kit', 'Snacks', 'Flip-flops', 'Toys', 'Car charger', 'Ski jacket', 'Dry bag', 'Pacifier', 'Map', 'Portable charger', 'Travel crib', 'Multi-tool', 'Beach bag', 'Ski goggles', 'SIM card', 'Glow sticks', 'Beach towel', 'Travel adapter', 'Neck wallet', 'Language phrasebook', 'Water filter'], 'scores': [0.011984821408987045, 0.011970506981015205, 0.011933253146708012, 0.011915490962564945, 0.011904211714863777, 0.011892491020262241, 0.01188766211271286, 0.011866495944559574, 0.011842762120068073, 0.011789090000092983, 0.011770269833505154, 0.011769718490540981, 0.011746660806238651, 0.011746660806238651, 0.011718676425516605, 0.01164235919713974, 0.011551206931471825, 0.011529732495546341, 0.011518468149006367, 0.011516833677887917, 0.011508049443364143, 0.011507270857691765, 0.01149584911763668, 0.01149584911763668, 0.011495097540318966, 0.01149324607104063, 0.011486946605145931, 0.01148668210953474, 0.011478666216135025, 0.011473646387457848, 0.011412998661398888, 0.011398673988878727, 0.011378799565136433, 0.01135518029332161, 0.011335738934576511, 0.011330211535096169, 0.011329339817166328, 0.011324702762067318, 0.01131915021687746, 0.01131164189428091, 0.011294065974652767, 0.011273612268269062, 0.011272135190665722, 0.011252084746956825, 0.01122584380209446, 0.011216048151254654, 0.011204490438103676, 0.011203117668628693, 0.01117485947906971, 0.01117344293743372, 0.011145292781293392, 0.011137993074953556, 0.011128612793982029, 0.011123239994049072, 0.011122280731797218, 0.011065744794905186, 0.011053262278437614, 0.011045967228710651, 0.011041177436709404, 0.011033336631953716, 0.01102971937507391, 0.0110141197219491, 0.01100961398333311, 0.011002525687217712, 0.010937424376606941, 0.01093329582363367, 0.010918675921857357, 0.010917853564023972, 0.010890142060816288, 0.01088369358330965, 0.010871977545320988, 0.010870742611587048, 0.010863195173442364, 0.010844682343304157, 0.01084016915410757, 0.010835953988134861, 0.010834810324013233, 0.010826902464032173, 0.010796850547194481, 0.010746038518846035, 0.010692491196095943, 0.010686952620744705, 0.010679351165890694, 0.010655333288013935, 0.010604050010442734, 0.010574583895504475, 0.010439733043313026, 0.010402928106486797, 0.010294477455317974]}\n" + "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Map', 'Compass', 'Laptop', 'Car charger', 'Toys', 'Travel crib', 'Hat', 'Playlist', 'Stroller', 'Currency', 'Travel adapter', 'Hostel lock', 'Pen', 'Charging cables', 'Flip-flops', 'Pacifier', 'Camping stove', 'Multi-tool', 'Passport', 'Poncho', 'Hiking boots', 'Portable charger', 'Power bank', 'Trekking poles', 'Snowboard', 'Base layers', 'Bandana', 'Aloe vera gel', 'Gloves', 'Baby blanket', 'Tent', 'Tent', 'Snorkel gear', 'Water filter', 'Diapers', 'Presentation materials', 'Nursing cover', 'Headphones', 'Sunscreen', 'Beach towel', 'Snacks', 'Ski jacket', 'Earplugs', 'Ski goggles', 'Flashlight', 'Neck wallet', 'Swimsuit', 'Notebook', 'Thermal clothing', 'Blanket', 'Snow boots', 'Sleeping bag', 'Lightweight backpack', 'Refillable water bottle', 'Quick-dry towel', 'Comfortable shoes', 'Reusable shopping bags', 'Travel journal', 'Travel pillow', 'Beach bag', 'Reusable coffee mug', 'Reusable water bottle', 'Festival tickets', 'Waterproof phone case', 'Business attire', 'Sunglasses', 'Sunglasses', 'Cooler', 'Baby clothes', 'Fanny pack', 'Beanie', 'First aid kit', 'Emergency roadside kit', 'Dry bag', 'SIM card', 'Energy bars', 'Baby food', 'Work ID badge', 'Packable rain jacket', 'Hand warmers', 'Visa documents', 'Glow sticks', 'Bug spray', 'Travel-sized toiletries', 'Dress shoes', 'Language phrasebook', 'Baby wipes', 'Lip balm', 'Travel insurance documents'], 'scores': [0.013028442859649658, 0.012909057550132275, 0.0124660674482584, 0.012431488372385502, 0.012379261665046215, 0.012377972714602947, 0.012329353019595146, 0.012096051126718521, 0.012086767703294754, 0.011947661638259888, 0.011939236894249916, 0.011935302056372166, 0.011887168511748314, 0.011814153753221035, 0.011788924224674702, 0.011783207766711712, 0.01177265401929617, 0.011771135963499546, 0.011747810058295727, 0.011738969013094902, 0.01169698778539896, 0.01166312862187624, 0.011658026836812496, 0.011596457101404667, 0.01158847101032734, 0.011561167426407337, 0.011526867747306824, 0.01149983424693346, 0.011472185142338276, 0.011455104686319828, 0.011445573531091213, 0.011445573531091213, 0.011444379575550556, 0.011416648514568806, 0.01136692427098751, 0.011363024823367596, 0.011361461132764816, 0.011328471824526787, 0.011299548670649529, 0.011291779577732086, 0.011282541789114475, 0.01127372495830059, 0.011270811781287193, 0.011263585649430752, 0.011179029010236263, 0.011149592697620392, 0.01113132108002901, 0.011122703552246094, 0.011105425655841827, 0.011101326905190945, 0.011090466752648354, 0.011066330596804619, 0.011058374308049679, 0.011055233888328075, 0.01103114802390337, 0.011022195219993591, 0.011012199334800243, 0.01100123766809702, 0.010985593311488628, 0.010961917228996754, 0.010958753526210785, 0.010938071645796299, 0.010903625749051571, 0.010879918932914734, 0.010863620787858963, 0.010824359022080898, 0.010824359022080898, 0.010805793106555939, 0.010763236321508884, 0.010710005648434162, 0.010690474882721901, 0.010647830553352833, 0.010583569295704365, 0.010571518912911415, 0.010570857673883438, 0.010552200488746166, 0.0105352271348238, 0.010523369535803795, 0.010514546185731888, 0.010479346849024296, 0.010450395755469799, 0.010436479933559895, 0.01043587177991867, 0.010400519706308842, 0.010214710608124733, 0.010052643716335297, 0.010041419416666031, 0.010003888048231602, 0.009946384467184544]}\n" ] } ], @@ -73,15 +73,17 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 2, "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Running on local URL: http://127.0.0.1:7866\n", + "Running on local URL: http://127.0.0.1:7860\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] @@ -89,7 +91,7 @@ { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -116,6 +118,48 @@ "if __name__ == \"__main__\":\n", " demo.launch()" ] + }, + { + "cell_type": "markdown", + "id": "d6526d18-6ba6-4a66-8310-21337b832d84", + "metadata": {}, + "source": [ + "Simple app" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5496ded9-7294-4da4-af05-00e5846cdd04", + "metadata": {}, + "outputs": [], + "source": [ + "import gradio as gr\n", + "from transformers import pipeline\n", + "\n", + "# Initialize the zero-shot classification pipeline\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", + "\n", + "# Define the classification function\n", + "def classify_text(text, labels):\n", + " labels = labels.split(\",\") # Convert the comma-separated string into a list\n", + " result = classifier(text, candidate_labels=labels)\n", + " return result\n", + "\n", + "# Set up the Gradio interface\n", + "with gr.Blocks() as demo:\n", + " gr.Markdown(\"# Zero-Shot Classification\")\n", + " text_input = gr.Textbox(label=\"Input Text\")\n", + " label_input = gr.Textbox(label=\"Comma-separated Labels\")\n", + " output = gr.JSON(label=\"Result\")\n", + " classify_button = gr.Button(\"Classify\")\n", + "\n", + " # Link the button to the classification function\n", + " classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output)\n", + "\n", + "# Launch the Gradio interface\n", + "demo.launch()" + ] } ], "metadata": { diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb b/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb index c38efb265206802f2e224e6b96ab35b64064752b..222a6c895349dca116b79704b3ccd40e88c2f17c 100644 --- a/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb +++ b/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 2, "id": "05a29daa-b70e-4c7c-ba03-9ab641f424cb", "metadata": {}, "outputs": [], @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 3, "id": "21b4f8b6-e774-45ad-8054-bf5db2b7b07c", "metadata": {}, "outputs": [ @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 4, "id": "c5f75916-aaf2-4ca7-8d1a-070579940952", "metadata": {}, "outputs": [ @@ -114,66 +114,6 @@ "print(output)" ] }, - { - "cell_type": "markdown", - "id": "8a6318c1-fa5f-4d16-8507-eaebe6294ac0", - "metadata": {}, - "source": [ - "**Use batches of 10 labels and combine results**" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "fe42a222-5ff4-4442-93f4-42fc22001af6", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'sequence': \"I'm going on a 2-week hiking trip in the Alps during winter.\", 'labels': ['Map', 'Backpack', 'Tent', 'Thermal clothing', 'Hiking boots', 'Flashlight', 'Gloves', 'Camping stove', 'Water filter', 'Sleeping bag'], 'scores': [0.30358555912971497, 0.12884855270385742, 0.10985139012336731, 0.10500500351190567, 0.10141848027706146, 0.08342219144105911, 0.0704946368932724, 0.05127469450235367, 0.024876652285456657, 0.021222807466983795]}\n", - "{'sequence': \"I'm going on a 2-week hiking trip in the Alps during winter.\", 'labels': ['Ski jacket', 'Snow boots', 'Hand warmers', 'Beanie', 'Ski goggles', 'Flip-flops', 'First aid kit', 'Sunscreen', 'Swimsuit', 'Lip balm'], 'scores': [0.20171622931957245, 0.1621972620487213, 0.12313881516456604, 0.10742709040641785, 0.09418268501758575, 0.08230196684598923, 0.07371978461742401, 0.06208840385079384, 0.05506424233317375, 0.038163457065820694]}\n", - "\n", - "Recommended packing list: ['Map', 'Backpack', 'Tent', 'Thermal clothing', 'Hiking boots', 'Ski jacket', 'Snow boots', 'Hand warmers', 'Beanie']\n" - ] - } - ], - "source": [ - "\n", - "input_text = \"I'm going on a 2-week hiking trip in the Alps during winter.\"\n", - "\n", - "\n", - "# Define the full list of possible packing items (split into groups of 10)\n", - "candidate_labels = [\n", - " [\"Hiking boots\", \"Tent\", \"Sleeping bag\", \"Camping stove\", \"Backpack\",\n", - " \"Water filter\", \"Flashlight\", \"Thermal clothing\", \"Gloves\", \"Map\"],\n", - " \n", - " [\"Swimsuit\", \"Sunscreen\", \"Flip-flops\", \"Ski jacket\", \"Ski goggles\",\n", - " \"Snow boots\", \"Beanie\", \"Hand warmers\", \"Lip balm\", \"First aid kit\"]\n", - "]\n", - "\n", - "# Run classification in batches\n", - "packing_list = []\n", - "for batch in candidate_labels:\n", - " result = query({\"inputs\": input_text, \"parameters\": {\"candidate_labels\": batch}})\n", - " print(result)\n", - " for label, score in zip(result[\"labels\"], result[\"scores\"]):\n", - " if score > 0.1: # Adjust threshold as needed\n", - " packing_list.append(label)\n", - "\n", - "# Print the final packing list\n", - "print(\"\\nRecommended packing list:\", packing_list)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "660072ea-b72f-4bee-a9ed-81019775ae85", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "edf44387-d166-4e0f-a8ad-621230aee115", @@ -184,92 +124,16 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 5, "id": "d0d8f7c0-c2d9-4fbe-b1a7-699a5b99466c", "metadata": {}, "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5e371dee58d64e7b8bf6635e0e88f8db", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "config.json: 0%| | 0.00/1.72k [00:00 0.1: # Adjust threshold as needed\n", + " packing_list.append(label)\n", + "\n", + "# Print the final packing list\n", + "print(\"\\nRecommended packing list:\", packing_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "953b244c-0611-4706-a941-eac5064c643f", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python (huggingface_env)", + "language": "python", + "name": "huggingface_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.20" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/app.py b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/app.py new file mode 100644 index 0000000000000000000000000000000000000000..b04ea6d9db58b6fd21796e0c0e013a2b1d3f40bd --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/app.py @@ -0,0 +1,25 @@ +import gradio as gr +from transformers import pipeline + +# Initialize the zero-shot classification pipeline +classifier = pipeline("zero-shot-classification", model="facebook/bart-base") + +# Define the classification function +def classify_text(text, labels): + labels = labels.split(",") # Convert the comma-separated string into a list + result = classifier(text, candidate_labels=labels) + return result + +# Set up the Gradio interface +with gr.Blocks() as demo: + gr.Markdown("# Zero-Shot Classification") + text_input = gr.Textbox(label="Input Text") + label_input = gr.Textbox(label="Comma-separated Labels") + output = gr.JSON(label="Result") + classify_button = gr.Button("Classify") + + # Link the button to the classification function + classify_button.click(classify_text, inputs=[text_input, label_input], outputs=output) + +# Launch the Gradio interface +demo.launch() diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..a384bce4e058330cb0bdd8c568539bd75799a3ce --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/gradio_tryout.ipynb @@ -0,0 +1,142 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e25090fa-f990-4f1a-84f3-b12159eedae8", + "metadata": {}, + "source": [ + "# Try out gradio" + ] + }, + { + "cell_type": "markdown", + "id": "3bbee2e4-55c8-4b06-9929-72026edf7932", + "metadata": {}, + "source": [ + "Try model" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "fa0d8126-e346-4412-9197-7d51baf868da", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Some weights of BartForSequenceClassification were not initialized from the model checkpoint at facebook/bart-base and are newly initialized: ['classification_head.dense.bias', 'classification_head.dense.weight', 'classification_head.out_proj.bias', 'classification_head.out_proj.weight']\n", + "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n", + "Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n", + "Failed to determine 'entailment' label id from the label2id mapping in the model config. Setting to -1. Define a descriptive label2id mapping in the model config to ensure correct outputs.\n", + "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.', 'labels': ['Compass', 'Travel insurance documents', 'Cooler', 'Poncho', 'Comfortable shoes', 'Thermal clothing', 'Business attire', 'Stroller', 'Refillable water bottle', 'Sunscreen', 'Hiking boots', 'Trekking poles', 'Tent', 'Tent', 'Swimsuit', 'Lightweight backpack', 'Diapers', 'Pen', 'Lip balm', 'Bandana', 'Presentation materials', 'Snorkel gear', 'Sunglasses', 'Sunglasses', 'Snowboard', 'Baby wipes', 'Emergency roadside kit', 'Blanket', 'Passport', 'Aloe vera gel', 'Currency', 'Beanie', 'Hand warmers', 'Reusable shopping bags', 'Hat', 'Travel-sized toiletries', 'Waterproof phone case', 'Energy bars', 'Baby food', 'Reusable water bottle', 'Flashlight', 'Gloves', 'Baby clothes', 'Hostel lock', 'Visa documents', 'Camping stove', 'Bug spray', 'Packable rain jacket', 'Travel pillow', 'Power bank', 'Earplugs', 'Quick-dry towel', 'Reusable coffee mug', 'Travel journal', 'Fanny pack', 'Headphones', 'Notebook', 'Dress shoes', 'Nursing cover', 'Playlist', 'Base layers', 'Work ID badge', 'Festival tickets', 'Sleeping bag', 'Laptop', 'Baby blanket', 'Charging cables', 'Snow boots', 'First aid kit', 'Snacks', 'Flip-flops', 'Toys', 'Car charger', 'Ski jacket', 'Dry bag', 'Pacifier', 'Map', 'Portable charger', 'Travel crib', 'Multi-tool', 'Beach bag', 'Ski goggles', 'SIM card', 'Glow sticks', 'Beach towel', 'Travel adapter', 'Neck wallet', 'Language phrasebook', 'Water filter'], 'scores': [0.011984821408987045, 0.011970506981015205, 0.011933253146708012, 0.011915490962564945, 0.011904211714863777, 0.011892491020262241, 0.01188766211271286, 0.011866495944559574, 0.011842762120068073, 0.011789090000092983, 0.011770269833505154, 0.011769718490540981, 0.011746660806238651, 0.011746660806238651, 0.011718676425516605, 0.01164235919713974, 0.011551206931471825, 0.011529732495546341, 0.011518468149006367, 0.011516833677887917, 0.011508049443364143, 0.011507270857691765, 0.01149584911763668, 0.01149584911763668, 0.011495097540318966, 0.01149324607104063, 0.011486946605145931, 0.01148668210953474, 0.011478666216135025, 0.011473646387457848, 0.011412998661398888, 0.011398673988878727, 0.011378799565136433, 0.01135518029332161, 0.011335738934576511, 0.011330211535096169, 0.011329339817166328, 0.011324702762067318, 0.01131915021687746, 0.01131164189428091, 0.011294065974652767, 0.011273612268269062, 0.011272135190665722, 0.011252084746956825, 0.01122584380209446, 0.011216048151254654, 0.011204490438103676, 0.011203117668628693, 0.01117485947906971, 0.01117344293743372, 0.011145292781293392, 0.011137993074953556, 0.011128612793982029, 0.011123239994049072, 0.011122280731797218, 0.011065744794905186, 0.011053262278437614, 0.011045967228710651, 0.011041177436709404, 0.011033336631953716, 0.01102971937507391, 0.0110141197219491, 0.01100961398333311, 0.011002525687217712, 0.010937424376606941, 0.01093329582363367, 0.010918675921857357, 0.010917853564023972, 0.010890142060816288, 0.01088369358330965, 0.010871977545320988, 0.010870742611587048, 0.010863195173442364, 0.010844682343304157, 0.01084016915410757, 0.010835953988134861, 0.010834810324013233, 0.010826902464032173, 0.010796850547194481, 0.010746038518846035, 0.010692491196095943, 0.010686952620744705, 0.010679351165890694, 0.010655333288013935, 0.010604050010442734, 0.010574583895504475, 0.010439733043313026, 0.010402928106486797, 0.010294477455317974]}\n" + ] + } + ], + "source": [ + "from transformers import pipeline\n", + "import gradio as gr\n", + "\n", + "# Load the model and create a pipeline for zero-shot classification\n", + "classifier = pipeline(\"zero-shot-classification\", model=\"facebook/bart-base\")\n", + "\n", + "# Load labels from a txt file\n", + "with open(\"labels.txt\", \"r\", encoding=\"utf-8\") as f:\n", + " class_labels = [line.strip() for line in f if line.strip()]\n", + "\n", + "# Example text to classify\n", + "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", + "\n", + "# Perform classification\n", + "result = classifier(input_text, class_labels)\n", + "\n", + "print(result)" + ] + }, + { + "cell_type": "markdown", + "id": "8e856a9c-a66c-4c4b-b7cf-8c52abbbc6fa", + "metadata": {}, + "source": [ + "Use model with gradio" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "521d9118-b59d-4cc6-b637-20202eaf8f33", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Running on local URL: http://127.0.0.1:7866\n", + "\n", + "To create a public link, set `share=True` in `launch()`.\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Define the Gradio interface\n", + "def classify(text):\n", + " return classifier(text, class_labels)\n", + "\n", + "demo = gr.Interface(\n", + " fn=classify,\n", + " inputs=\"text\",\n", + " outputs=\"json\",\n", + " title=\"Zero-Shot Classification\",\n", + " description=\"Enter a text describing your trip\",\n", + ")\n", + "\n", + "# Launch the Gradio app\n", + "if __name__ == \"__main__\":\n", + " demo.launch()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python (huggingface_env)", + "language": "python", + "name": "huggingface_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.20" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/labels.txt b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/labels.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec24df45c966bdd13193d1b2d83aadcc95b2567e --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/labels.txt @@ -0,0 +1,89 @@ +Swimsuit +Sunscreen +Flip-flops +Beach towel +Sunglasses +Waterproof phone case +Hat +Beach bag +Snorkel gear +Aloe vera gel +Tent +Sleeping bag +Camping stove +Flashlight +Hiking boots +Water filter +Compass +First aid kit +Bug spray +Multi-tool +Thermal clothing +Ski jacket +Ski goggles +Snow boots +Gloves +Hand warmers +Beanie +Lip balm +Snowboard +Base layers +Passport +Visa documents +Travel adapter +Currency +Language phrasebook +SIM card +Travel pillow +Neck wallet +Travel insurance documents +Power bank +Laptop +Notebook +Business attire +Dress shoes +Charging cables +Presentation materials +Work ID badge +Pen +Headphones +Lightweight backpack +Travel-sized toiletries +Packable rain jacket +Reusable water bottle +Dry bag +Trekking poles +Hostel lock +Quick-dry towel +Travel journal +Energy bars +Car charger +Snacks +Map +Sunglasses +Cooler +Blanket +Emergency roadside kit +Reusable coffee mug +Playlist +Reusable shopping bags +Earplugs +Fanny pack +Portable charger +Poncho +Bandana +Comfortable shoes +Tent +Refillable water bottle +Glow sticks +Festival tickets +Diapers +Baby wipes +Baby food +Stroller +Pacifier +Baby clothes +Baby blanket +Travel crib +Toys +Nursing cover diff --git a/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..c38efb265206802f2e224e6b96ab35b64064752b --- /dev/null +++ b/space/space/space/space/space/space/space/space/space/space/space/space/space/space/space/packing_list_api.ipynb @@ -0,0 +1,617 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "7b73f12d-1104-4eea-ac08-3716aa9af45b", + "metadata": {}, + "source": [ + "**Zero shot classification**" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "05a29daa-b70e-4c7c-ba03-9ab641f424cb", + "metadata": {}, + "outputs": [], + "source": [ + "from dotenv import load_dotenv\n", + "import os\n", + "import requests\n", + "\n", + "load_dotenv() # Load environment variables from .env file, contains personal access token (HF_API_TOKEN=your_token)\n", + "\n", + "API_URL = \"https://api-inference.huggingface.co/models/facebook/bart-large-mnli\"\n", + "# API_URL = \"https://api-inference.huggingface.co/models/MoritzLaurer/mDeBERTa-v3-base-mnli-xnli\"\n", + "# API_URL = \"https://api-inference.huggingface.co/models/cross-encoder/nli-deberta-v3-base\"\n", + "# API_URL = \"https://api-inference.huggingface.co/models/valhalla/distilbart-mnli-12-3\"\n", + "headers = {\"Authorization\": f\"Bearer {os.getenv('HF_API_TOKEN')}\"}\n", + "\n", + "def query(payload):\n", + " response = requests.post(API_URL, headers=headers, json=payload)\n", + " return response.json()\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "21b4f8b6-e774-45ad-8054-bf5db2b7b07c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': 'I just bought a new laptop, and it works amazing!', 'labels': ['technology', 'health', 'sports', 'politics'], 'scores': [0.9709171652793884, 0.014999167993664742, 0.008272457867860794, 0.005811102222651243]}\n" + ] + } + ], + "source": [ + "# Input text to classify\n", + "input_text = \"I just bought a new laptop, and it works amazing!\"\n", + "\n", + "# Candidate labels\n", + "candidate_labels = [\"technology\", \"sports\", \"politics\", \"health\"]\n", + "\n", + "# Get the prediction\n", + "output = query({\"inputs\": input_text, \"parameters\": {\"candidate_labels\": candidate_labels}})\n", + "print(output)\n" + ] + }, + { + "cell_type": "markdown", + "id": "fb7e69c7-b590-4b40-8478-76d055583f2a", + "metadata": {}, + "source": [ + "**Try packing list labels**" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "c5f75916-aaf2-4ca7-8d1a-070579940952", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'error': ['Error in `parameters.candidate_labels`: ensure this value has at most 10 items']}\n" + ] + } + ], + "source": [ + "# Input text to classify\n", + "input_text = \"I like to cycle and I burn easily. I also love culture and like to post on social media about my food. I will go on a trip to italy in july.\"\n", + "\n", + "# Candidate labels\n", + "candidate_labels = [\n", + " \"Swimsuit\", \"Sunscreen\", \"Flip-flops\", \"Beach towel\", \"Sunglasses\", \n", + " \"Waterproof phone case\", \"Hat\", \"Beach bag\", \"Snorkel gear\", \"Aloe vera gel\",\n", + " \"Tent\", \"Sleeping bag\", \"Camping stove\", \"Flashlight\", \"Hiking boots\",\n", + " \"Water filter\", \"Compass\", \"First aid kit\", \"Bug spray\", \"Multi-tool\",\n", + " \"Thermal clothing\", \"Ski jacket\", \"Ski goggles\", \"Snow boots\", \"Gloves\",\n", + " \"Hand warmers\", \"Beanie\", \"Lip balm\", \"Snowboard\", \"Base layers\",\n", + " \"Passport\", \"Visa documents\", \"Travel adapter\", \"Currency\", \"Language phrasebook\",\n", + " \"SIM card\", \"Travel pillow\", \"Neck wallet\", \"Travel insurance documents\", \"Power bank\",\n", + " \"Laptop\", \"Notebook\", \"Business attire\", \"Dress shoes\", \"Charging cables\",\n", + " \"Presentation materials\", \"Work ID badge\", \"Pen\", \"Headphones\", \n", + " \"Lightweight backpack\", \"Travel-sized toiletries\", \"Packable rain jacket\",\n", + " \"Reusable water bottle\", \"Dry bag\", \"Trekking poles\", \"Hostel lock\", \"Quick-dry towel\",\n", + " \"Travel journal\", \"Energy bars\", \"Car charger\", \"Snacks\", \"Map\",\n", + " \"Sunglasses\", \"Cooler\", \"Blanket\", \"Emergency roadside kit\", \"Reusable coffee mug\",\n", + " \"Playlist\", \"Reusable shopping bags\", \"Earplugs\", \"Fanny pack\", \"Portable charger\",\n", + " \"Poncho\", \"Bandana\", \"Comfortable shoes\", \"Tent\", \"Refillable water bottle\",\n", + " \"Glow sticks\", \"Festival tickets\", \"Diapers\", \"Baby wipes\", \"Baby food\",\n", + " \"Stroller\", \"Pacifier\", \"Baby clothes\", \"Baby blanket\", \"Travel crib\",\n", + " \"Toys\", \"Nursing cover\"\n", + "]\n", + "\n", + "\n", + "# Get the prediction\n", + "output = query({\"inputs\": input_text, \"parameters\": {\"candidate_labels\": candidate_labels}})\n", + "print(output)" + ] + }, + { + "cell_type": "markdown", + "id": "8a6318c1-fa5f-4d16-8507-eaebe6294ac0", + "metadata": {}, + "source": [ + "**Use batches of 10 labels and combine results**" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "fe42a222-5ff4-4442-93f4-42fc22001af6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'sequence': \"I'm going on a 2-week hiking trip in the Alps during winter.\", 'labels': ['Map', 'Backpack', 'Tent', 'Thermal clothing', 'Hiking boots', 'Flashlight', 'Gloves', 'Camping stove', 'Water filter', 'Sleeping bag'], 'scores': [0.30358555912971497, 0.12884855270385742, 0.10985139012336731, 0.10500500351190567, 0.10141848027706146, 0.08342219144105911, 0.0704946368932724, 0.05127469450235367, 0.024876652285456657, 0.021222807466983795]}\n", + "{'sequence': \"I'm going on a 2-week hiking trip in the Alps during winter.\", 'labels': ['Ski jacket', 'Snow boots', 'Hand warmers', 'Beanie', 'Ski goggles', 'Flip-flops', 'First aid kit', 'Sunscreen', 'Swimsuit', 'Lip balm'], 'scores': [0.20171622931957245, 0.1621972620487213, 0.12313881516456604, 0.10742709040641785, 0.09418268501758575, 0.08230196684598923, 0.07371978461742401, 0.06208840385079384, 0.05506424233317375, 0.038163457065820694]}\n", + "\n", + "Recommended packing list: ['Map', 'Backpack', 'Tent', 'Thermal clothing', 'Hiking boots', 'Ski jacket', 'Snow boots', 'Hand warmers', 'Beanie']\n" + ] + } + ], + "source": [ + "\n", + "input_text = \"I'm going on a 2-week hiking trip in the Alps during winter.\"\n", + "\n", + "\n", + "# Define the full list of possible packing items (split into groups of 10)\n", + "candidate_labels = [\n", + " [\"Hiking boots\", \"Tent\", \"Sleeping bag\", \"Camping stove\", \"Backpack\",\n", + " \"Water filter\", \"Flashlight\", \"Thermal clothing\", \"Gloves\", \"Map\"],\n", + " \n", + " [\"Swimsuit\", \"Sunscreen\", \"Flip-flops\", \"Ski jacket\", \"Ski goggles\",\n", + " \"Snow boots\", \"Beanie\", \"Hand warmers\", \"Lip balm\", \"First aid kit\"]\n", + "]\n", + "\n", + "# Run classification in batches\n", + "packing_list = []\n", + "for batch in candidate_labels:\n", + " result = query({\"inputs\": input_text, \"parameters\": {\"candidate_labels\": batch}})\n", + " print(result)\n", + " for label, score in zip(result[\"labels\"], result[\"scores\"]):\n", + " if score > 0.1: # Adjust threshold as needed\n", + " packing_list.append(label)\n", + "\n", + "# Print the final packing list\n", + "print(\"\\nRecommended packing list:\", packing_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "660072ea-b72f-4bee-a9ed-81019775ae85", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "edf44387-d166-4e0f-a8ad-621230aee115", + "metadata": {}, + "source": [ + "**Try to run a model locally**" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "d0d8f7c0-c2d9-4fbe-b1a7-699a5b99466c", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5e371dee58d64e7b8bf6635e0e88f8db", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "config.json: 0%| | 0.00/1.72k [00:00