Download reference_words.py from Pixelkram/Embedding_Before_After_Attention: direct link, hf CLI and curl.
- Browser
- Download file 2.66 kB
-
https://huggingface.co/spaces/Pixelkram/Embedding_Before_After_Attention/resolve/main/reference_words.py
- Command line
-
hf download hf://spaces/Pixelkram/Embedding_Before_After_Attention/reference_words.py
-
curl -L -o reference_words.py https://huggingface.co/spaces/Pixelkram/Embedding_Before_After_Attention/resolve/main/reference_words.py
2.66 kB
| """Reference words the target word is compared with: 9 groups x 20 words. | |
| Rules for this list | |
| - every word is a single token in both BERT (uncased) and GPT-2 (with a leading space). Words split into | |
| several pieces get blurry "average" vectors that end up close to everything, which spoils the neighbours. | |
| - strongly ambiguous words (apple, mouse, bank, python, jaguar, rock, crane, orange, java, ...) are left out, | |
| so each group stands for one clear meaning. | |
| """ | |
| REFERENCE_WORDS = { | |
| "fruit & food": [ | |
| "banana", "pear", "cherry", "grape", "peach", "lemon", "mango", "strawberry", "plum", "bread", | |
| "cheese", "pie", "juice", "salad", "honey", "butter", "cake", "soup", "potato", "fruit", | |
| ], | |
| "tech companies & devices": [ | |
| "Microsoft", "Google", "Samsung", "Intel", "Sony", "Nokia", "Facebook", "IBM", "Dell", "Motorola", | |
| "Android", "laptop", "computer", "smartphone", "tablet", "software", "app", "website", "internet", "phone", | |
| ], | |
| "animals": [ | |
| "dog", "cat", "horse", "lion", "tiger", "wolf", "fox", "rabbit", "deer", "snake", | |
| "frog", "eagle", "owl", "cow", "sheep", "elephant", "monkey", "rat", "bird", "goat", | |
| ], | |
| "nature & landscape": [ | |
| "river", "lake", "ocean", "forest", "mountain", "valley", "hill", "beach", "island", "stone", | |
| "cliff", "shore", "stream", "desert", "cave", "field", "pond", "sea", "creek", "woods", | |
| ], | |
| "money & business": [ | |
| "money", "cash", "loan", "credit", "salary", "investment", "stock", "shares", "profit", "finance", | |
| "account", "payment", "budget", "debt", "tax", "price", "market", "economy", "dollar", "mortgage", | |
| ], | |
| "music": [ | |
| "guitar", "drums", "piano", "song", "melody", "concert", "album", "singer", "violin", "jazz", | |
| "rhythm", "orchestra", "lyrics", "trumpet", "opera", "chorus", "punk", "blues", "band", "music", | |
| ], | |
| "sports": [ | |
| "football", "soccer", "tennis", "baseball", "basketball", "golf", "hockey", "goal", "stadium", "referee", | |
| "team", "player", "athlete", "coach", "marathon", "swimming", "boxing", "skiing", "cricket", "league", | |
| ], | |
| "cars & machines": [ | |
| "car", "truck", "engine", "motor", "wheel", "tire", "brake", "tractor", "machine", "factory", | |
| "robot", "drill", "hammer", "Porsche", "Ferrari", "sedan", "motorcycle", "vehicle", "pump", "bus", | |
| ], | |
| "programming": [ | |
| "code", "compiler", "function", "variable", "algorithm", "database", "programming", "developer", | |
| "syntax", "script", "server", "Linux", "API", "terminal", "framework", "HTML", "coding", "query", | |
| "array", "kernel", | |
| ], | |
| } | |