ariG23498 HF Staff commited on
Commit
1f37340
·
verified ·
1 Parent(s): 0613c82

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

Browse files
ArliAI_gpt-oss-20b-Derestricted_0.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-20b-Derestricted")
27
+ with open('ArliAI_gpt-oss-20b-Derestricted_0.txt', 'w', encoding='utf-8') as f:
28
+ f.write('Everything was good in ArliAI_gpt-oss-20b-Derestricted_0.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/ArliAI_gpt-oss-20b-Derestricted_0.txt|ArliAI_gpt-oss-20b-Derestricted_0.txt>',
36
+ )
37
+
38
+ with open('ArliAI_gpt-oss-20b-Derestricted_0.txt', 'a', encoding='utf-8') as f:
39
+ import traceback
40
+ f.write('''```CODE:
41
+ # Use a pipeline as a high-level helper
42
+ from transformers import pipeline
43
+
44
+ pipe = pipeline("text-generation", model="ArliAI/gpt-oss-20b-Derestricted")
45
+ ```
46
+
47
+ ERROR:
48
+ ''')
49
+ traceback.print_exc(file=f)
50
+
51
+ finally:
52
+ from huggingface_hub import upload_file
53
+ upload_file(
54
+ path_or_fileobj='ArliAI_gpt-oss-20b-Derestricted_0.txt',
55
+ repo_id='model-metadata/code_execution_files',
56
+ path_in_repo='ArliAI_gpt-oss-20b-Derestricted_0.txt',
57
+ repo_type='dataset',
58
+ )