Upload Qwen_Qwen3-30B-A3B-Instruct-2507_0.py with huggingface_hub
Browse files
Qwen_Qwen3-30B-A3B-Instruct-2507_0.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.12"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "transformers",
|
| 5 |
+
# "torch",
|
| 6 |
+
# ]
|
| 7 |
+
# ///
|
| 8 |
+
|
| 9 |
+
try:
|
| 10 |
+
# Use a pipeline as a high-level helper
|
| 11 |
+
from transformers import pipeline
|
| 12 |
+
|
| 13 |
+
pipe = pipeline("text-generation", model="Qwen/Qwen3-30B-A3B-Instruct-2507")
|
| 14 |
+
messages = [
|
| 15 |
+
{"role": "user", "content": "Who are you?"},
|
| 16 |
+
]
|
| 17 |
+
pipe(messages)
|
| 18 |
+
with open('Qwen_Qwen3-30B-A3B-Instruct-2507_0.txt', 'w') as f:
|
| 19 |
+
f.write('Everything was good in Qwen_Qwen3-30B-A3B-Instruct-2507_0.txt')
|
| 20 |
+
except Exception as e:
|
| 21 |
+
with open('Qwen_Qwen3-30B-A3B-Instruct-2507_0.txt', 'w') as f:
|
| 22 |
+
import traceback
|
| 23 |
+
traceback.print_exc(file=f)
|
| 24 |
+
finally:
|
| 25 |
+
from huggingface_hub import upload_file
|
| 26 |
+
upload_file(
|
| 27 |
+
path_or_fileobj='Qwen_Qwen3-30B-A3B-Instruct-2507_0.txt',
|
| 28 |
+
repo_id='model-metadata/custom_code_execution_files',
|
| 29 |
+
path_in_repo='Qwen_Qwen3-30B-A3B-Instruct-2507_0.txt',
|
| 30 |
+
repo_type='dataset',
|
| 31 |
+
)
|