ariG23498 HF Staff commited on
Commit
dde343f
·
verified ·
1 Parent(s): 7b4591e

Upload ArliAI_gpt-oss-120b-Derestricted_0.py with huggingface_hub

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