| ```CODE: | |
| # The sentences to encode | |
| sentence_high = [ | |
| "The chef prepared a delicious meal for the guests.", | |
| "A tasty dinner was cooked by the chef for the visitors." | |
| ] | |
| sentence_medium = [ | |
| "She is an expert in machine learning.", | |
| "He has a deep interest in artificial intelligence." | |
| ] | |
| sentence_low = [ | |
| "The weather in Tokyo is sunny today.", | |
| "I need to buy groceries for the week." | |
| ] | |
| for sentence in [sentence_high, sentence_medium, sentence_low]: | |
| print("๐โโ๏ธ") | |
| print(sentence) | |
| embeddings = model.encode(sentence) | |
| similarities = model.similarity(embeddings[0], embeddings[1]) | |
| print("`-> ๐ค score: ", similarities.numpy()[0][0]) | |
| ``` | |
| ERROR: | |
| Traceback (most recent call last): | |
| File "/tmp/google_embeddinggemma-300m_4PP3WIF.py", line 31, in <module> | |
| embeddings = model.encode(sentence) | |
| ^^^^^ | |
| NameError: name 'model' is not defined | |