ariG23498 HF Staff commited on
Commit
7a1dd81
·
verified ·
1 Parent(s): 6e67417

Upload Motif-Technologies_Motif-2-12.7B-Instruct_1.py with huggingface_hub

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