Upload google_embeddinggemma-300m_4.txt with huggingface_hub
Browse files
google_embeddinggemma-300m_4.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```CODE:
|
| 2 |
+
# The sentences to encode
|
| 3 |
+
sentence_high = [
|
| 4 |
+
"The chef prepared a delicious meal for the guests.",
|
| 5 |
+
"A tasty dinner was cooked by the chef for the visitors."
|
| 6 |
+
]
|
| 7 |
+
sentence_medium = [
|
| 8 |
+
"She is an expert in machine learning.",
|
| 9 |
+
"He has a deep interest in artificial intelligence."
|
| 10 |
+
]
|
| 11 |
+
sentence_low = [
|
| 12 |
+
"The weather in Tokyo is sunny today.",
|
| 13 |
+
"I need to buy groceries for the week."
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
for sentence in [sentence_high, sentence_medium, sentence_low]:
|
| 17 |
+
print("🙋♂️")
|
| 18 |
+
print(sentence)
|
| 19 |
+
embeddings = model.encode(sentence)
|
| 20 |
+
similarities = model.similarity(embeddings[0], embeddings[1])
|
| 21 |
+
print("`-> 🤖 score: ", similarities.numpy()[0][0])
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
ERROR:
|
| 25 |
+
Traceback (most recent call last):
|
| 26 |
+
File "/tmp/google_embeddinggemma-300m_4PP3WIF.py", line 31, in <module>
|
| 27 |
+
embeddings = model.encode(sentence)
|
| 28 |
+
^^^^^
|
| 29 |
+
NameError: name 'model' is not defined
|