ariG23498 HF Staff commited on
Commit
46d98bb
·
verified ·
1 Parent(s): df0fee0

Upload Hunyuan-A13B-Instruct_idx.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. Hunyuan-A13B-Instruct_idx.py +30 -0
Hunyuan-A13B-Instruct_idx.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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="tencent/Hunyuan-A13B-Instruct", trust_remote_code=True)
14
+ messages = [
15
+ {"role": "user", "content": "Who are you?"},
16
+ ]
17
+ pipe(messages)
18
+ except Exception as e:
19
+ exception_file = 'tencent_Hunyuan-A13B-Instruct_0_exception.txt'
20
+ with open(exception_file, 'w') as f:
21
+ import traceback
22
+ traceback.print_exc(file=f)
23
+ # Upload exception log to HuggingFace
24
+ from huggingface_hub import upload_file
25
+ upload_file(
26
+ path_or_fileobj=exception_file,
27
+ repo_id='model-metadata/model-code-exception',
28
+ path_in_repo='09-07-25/tencent_Hunyuan-A13B-Instruct_0_exception.txt',
29
+ repo_type='dataset',
30
+ )