ariG23498 HF Staff commited on
Commit
e6d1184
·
verified ·
1 Parent(s): 8312954

Upload aquif-ai_aquif-3.5-Max-42B-A3B_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. aquif-ai_aquif-3.5-Max-42B-A3B_0.py +64 -0
aquif-ai_aquif-3.5-Max-42B-A3B_0.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "numpy",
5
+ # "einops",
6
+ # "pandas",
7
+ # "protobuf",
8
+ # "torch",
9
+ # "torchvision",
10
+ # "transformers",
11
+ # "timm",
12
+ # "diffusers",
13
+ # "sentence-transformers",
14
+ # "accelerate",
15
+ # "peft",
16
+ # "slack-sdk",
17
+ # ]
18
+ # ///
19
+
20
+ try:
21
+ # Use a pipeline as a high-level helper
22
+ from transformers import pipeline
23
+
24
+ pipe = pipeline("text-generation", model="aquif-ai/aquif-3.5-Max-42B-A3B")
25
+ messages = [
26
+ {"role": "user", "content": "Who are you?"},
27
+ ]
28
+ pipe(messages)
29
+ with open('aquif-ai_aquif-3.5-Max-42B-A3B_0.txt', 'w', encoding='utf-8') as f:
30
+ f.write('Everything was good in aquif-ai_aquif-3.5-Max-42B-A3B_0.txt')
31
+ except Exception as e:
32
+ import os
33
+ from slack_sdk import WebClient
34
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
35
+ client.chat_postMessage(
36
+ channel='#hub-model-metadata-snippets-sprint',
37
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/aquif-ai_aquif-3.5-Max-42B-A3B_0.txt|aquif-ai_aquif-3.5-Max-42B-A3B_0.txt>',
38
+ )
39
+
40
+ with open('aquif-ai_aquif-3.5-Max-42B-A3B_0.txt', 'a', encoding='utf-8') as f:
41
+ import traceback
42
+ f.write('''```CODE:
43
+ # Use a pipeline as a high-level helper
44
+ from transformers import pipeline
45
+
46
+ pipe = pipeline("text-generation", model="aquif-ai/aquif-3.5-Max-42B-A3B")
47
+ messages = [
48
+ {"role": "user", "content": "Who are you?"},
49
+ ]
50
+ pipe(messages)
51
+ ```
52
+
53
+ ERROR:
54
+ ''')
55
+ traceback.print_exc(file=f)
56
+
57
+ finally:
58
+ from huggingface_hub import upload_file
59
+ upload_file(
60
+ path_or_fileobj='aquif-ai_aquif-3.5-Max-42B-A3B_0.txt',
61
+ repo_id='model-metadata/code_execution_files',
62
+ path_in_repo='aquif-ai_aquif-3.5-Max-42B-A3B_0.txt',
63
+ repo_type='dataset',
64
+ )