ariG23498 HF Staff commited on
Commit
38da216
·
verified ·
1 Parent(s): f1f206b

Upload PowerInfer_SmallThinker-21BA3B-Instruct_0.py with huggingface_hub

Browse files
PowerInfer_SmallThinker-21BA3B-Instruct_0.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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="PowerInfer/SmallThinker-21BA3B-Instruct")
14
+ with open('PowerInfer_SmallThinker-21BA3B-Instruct_0.txt', 'w') as f:
15
+ f.write('Everything was good in PowerInfer_SmallThinker-21BA3B-Instruct_0.txt')
16
+ except Exception as e:
17
+ with open('PowerInfer_SmallThinker-21BA3B-Instruct_0.txt', 'w') as f:
18
+ import traceback
19
+ traceback.print_exc(file=f)
20
+ finally:
21
+ from huggingface_hub import upload_file
22
+ upload_file(
23
+ path_or_fileobj='PowerInfer_SmallThinker-21BA3B-Instruct_0.txt',
24
+ repo_id='model-metadata/custom_code_execution_files',
25
+ path_in_repo='PowerInfer_SmallThinker-21BA3B-Instruct_0.txt',
26
+ repo_type='dataset',
27
+ )