ariG23498 HF Staff commited on
Commit
25f5828
·
verified ·
1 Parent(s): 5260b6c

Upload stepfun-ai_Step-Audio-EditX_1.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. stepfun-ai_Step-Audio-EditX_1.py +57 -0
stepfun-ai_Step-Audio-EditX_1.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "numpy",
5
+ # "einops",
6
+ # "pandas",
7
+ # "matplotlib",
8
+ # "paddleorc",
9
+ # "protobuf",
10
+ # "torch",
11
+ # "sentencepiece",
12
+ # "torchvision",
13
+ # "transformers",
14
+ # "timm",
15
+ # "diffusers",
16
+ # "sentence-transformers",
17
+ # "accelerate",
18
+ # "peft",
19
+ # "slack-sdk",
20
+ # ]
21
+ # ///
22
+
23
+ try:
24
+ # Load model directly
25
+ from transformers import AutoModelForCausalLM
26
+ model = AutoModelForCausalLM.from_pretrained("stepfun-ai/Step-Audio-EditX", trust_remote_code=True, dtype="auto")
27
+ with open('stepfun-ai_Step-Audio-EditX_1.txt', 'w', encoding='utf-8') as f:
28
+ f.write('Everything was good in stepfun-ai_Step-Audio-EditX_1.txt')
29
+ except Exception as e:
30
+ import os
31
+ from slack_sdk import WebClient
32
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
33
+ client.chat_postMessage(
34
+ channel='#hub-model-metadata-snippets-sprint',
35
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/stepfun-ai_Step-Audio-EditX_1.txt|stepfun-ai_Step-Audio-EditX_1.txt>',
36
+ )
37
+
38
+ with open('stepfun-ai_Step-Audio-EditX_1.txt', 'a', encoding='utf-8') as f:
39
+ import traceback
40
+ f.write('''```CODE:
41
+ # Load model directly
42
+ from transformers import AutoModelForCausalLM
43
+ model = AutoModelForCausalLM.from_pretrained("stepfun-ai/Step-Audio-EditX", trust_remote_code=True, dtype="auto")
44
+ ```
45
+
46
+ ERROR:
47
+ ''')
48
+ traceback.print_exc(file=f)
49
+
50
+ finally:
51
+ from huggingface_hub import upload_file
52
+ upload_file(
53
+ path_or_fileobj='stepfun-ai_Step-Audio-EditX_1.txt',
54
+ repo_id='model-metadata/code_execution_files',
55
+ path_in_repo='stepfun-ai_Step-Audio-EditX_1.txt',
56
+ repo_type='dataset',
57
+ )