Upload Qwen_Qwen3-Embedding-0.6B_2.py with huggingface_hub
Browse files
Qwen_Qwen3-Embedding-0.6B_2.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "torch",
|
| 5 |
+
# "torchvision",
|
| 6 |
+
# "transformers",
|
| 7 |
+
# "accelerate",
|
| 8 |
+
# "peft",
|
| 9 |
+
# "slack-sdk",
|
| 10 |
+
# ]
|
| 11 |
+
# ///
|
| 12 |
+
|
| 13 |
+
try:
|
| 14 |
+
import os
|
| 15 |
+
from huggingface_hub import InferenceClient
|
| 16 |
+
|
| 17 |
+
client = InferenceClient(
|
| 18 |
+
provider="auto",
|
| 19 |
+
api_key=os.environ["HF_TOKEN"],
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
result = client.feature_extraction(
|
| 23 |
+
"Today is a sunny day and I will get some ice cream.",
|
| 24 |
+
model="Qwen/Qwen3-Embedding-0.6B",
|
| 25 |
+
)
|
| 26 |
+
with open('Qwen_Qwen3-Embedding-0.6B_2.txt', 'w', encoding='utf-8') as f:
|
| 27 |
+
f.write('Everything was good in Qwen_Qwen3-Embedding-0.6B_2.txt')
|
| 28 |
+
except Exception as e:
|
| 29 |
+
import os
|
| 30 |
+
from slack_sdk import WebClient
|
| 31 |
+
client = WebClient(token=os.environ['SLACK_TOKEN'])
|
| 32 |
+
client.chat_postMessage(
|
| 33 |
+
channel='#exp-slack-alerts',
|
| 34 |
+
text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/Qwen_Qwen3-Embedding-0.6B_2.txt|Qwen_Qwen3-Embedding-0.6B_2.txt>',
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
with open('Qwen_Qwen3-Embedding-0.6B_2.txt', 'a', encoding='utf-8') as f:
|
| 38 |
+
import traceback
|
| 39 |
+
f.write('''```CODE:
|
| 40 |
+
import os
|
| 41 |
+
from huggingface_hub import InferenceClient
|
| 42 |
+
|
| 43 |
+
client = InferenceClient(
|
| 44 |
+
provider="auto",
|
| 45 |
+
api_key=os.environ["HF_TOKEN"],
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
result = client.feature_extraction(
|
| 49 |
+
"Today is a sunny day and I will get some ice cream.",
|
| 50 |
+
model="Qwen/Qwen3-Embedding-0.6B",
|
| 51 |
+
)
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
ERROR:
|
| 55 |
+
''')
|
| 56 |
+
traceback.print_exc(file=f)
|
| 57 |
+
|
| 58 |
+
finally:
|
| 59 |
+
from huggingface_hub import upload_file
|
| 60 |
+
upload_file(
|
| 61 |
+
path_or_fileobj='Qwen_Qwen3-Embedding-0.6B_2.txt',
|
| 62 |
+
repo_id='model-metadata/code_execution_files',
|
| 63 |
+
path_in_repo='Qwen_Qwen3-Embedding-0.6B_2.txt',
|
| 64 |
+
repo_type='dataset',
|
| 65 |
+
)
|