ariG23498 HF Staff commited on
Commit
ee28d73
·
verified ·
1 Parent(s): f4a82d5

Upload cerebras_GLM-4.5-Air-REAP-82B-A12B_0.py with huggingface_hub

Browse files
cerebras_GLM-4.5-Air-REAP-82B-A12B_0.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "torch",
5
+ # "torchvision",
6
+ # "transformers",
7
+ # "accelerate",
8
+ # "peft",
9
+ # ]
10
+ # ///
11
+
12
+ try:
13
+ # Use a pipeline as a high-level helper
14
+ from transformers import pipeline
15
+
16
+ pipe = pipeline("text-generation", model="cerebras/GLM-4.5-Air-REAP-82B-A12B")
17
+ messages = [
18
+ {"role": "user", "content": "Who are you?"},
19
+ ]
20
+ pipe(messages)
21
+ with open('cerebras_GLM-4.5-Air-REAP-82B-A12B_0.txt', 'w', encoding='utf-8') as f:
22
+ f.write('Everything was good in cerebras_GLM-4.5-Air-REAP-82B-A12B_0.txt')
23
+ except Exception as e:
24
+ with open('cerebras_GLM-4.5-Air-REAP-82B-A12B_0.txt', 'w', encoding='utf-8') as f:
25
+ import traceback
26
+ traceback.print_exc(file=f)
27
+ finally:
28
+ from huggingface_hub import upload_file
29
+ upload_file(
30
+ path_or_fileobj='cerebras_GLM-4.5-Air-REAP-82B-A12B_0.txt',
31
+ repo_id='model-metadata/code_execution_files',
32
+ path_in_repo='cerebras_GLM-4.5-Air-REAP-82B-A12B_0.txt',
33
+ repo_type='dataset',
34
+ )