ariG23498 HF Staff commited on
Commit
9ad6dd1
·
verified ·
1 Parent(s): 9e2ab5c

Upload nvidia_audio-flamingo-3-hf_0.py with huggingface_hub

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