ariG23498 HF Staff commited on
Commit
144cbb3
·
verified ·
1 Parent(s): 5a5c81a

Upload HuggingFaceTB_SmolLM3-3B_2.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. HuggingFaceTB_SmolLM3-3B_2.py +53 -0
HuggingFaceTB_SmolLM3-3B_2.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ messages = [
17
+ {"role": "system", "content": "/no_think"},
18
+ {"role": "user", "content": "Give me a brief explanation of gravity in simple terms."},
19
+ ]
20
+ pipe(messages)
21
+ with open('HuggingFaceTB_SmolLM3-3B_2.txt', 'w', encoding='utf-8') as f:
22
+ f.write('Everything was good in HuggingFaceTB_SmolLM3-3B_2.txt')
23
+ except Exception as e:
24
+ import os
25
+ from slack_sdk import WebClient
26
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
27
+ client.chat_postMessage(
28
+ channel='#hub-model-metadata-snippets-sprint',
29
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/HuggingFaceTB_SmolLM3-3B_2.txt|HuggingFaceTB_SmolLM3-3B_2.txt>',
30
+ )
31
+
32
+ with open('HuggingFaceTB_SmolLM3-3B_2.txt', 'a', encoding='utf-8') as f:
33
+ import traceback
34
+ f.write('''```CODE:
35
+ messages = [
36
+ {"role": "system", "content": "/no_think"},
37
+ {"role": "user", "content": "Give me a brief explanation of gravity in simple terms."},
38
+ ]
39
+ pipe(messages)
40
+ ```
41
+
42
+ ERROR:
43
+ ''')
44
+ traceback.print_exc(file=f)
45
+
46
+ finally:
47
+ from huggingface_hub import upload_file
48
+ upload_file(
49
+ path_or_fileobj='HuggingFaceTB_SmolLM3-3B_2.txt',
50
+ repo_id='model-metadata/code_execution_files',
51
+ path_in_repo='HuggingFaceTB_SmolLM3-3B_2.txt',
52
+ repo_type='dataset',
53
+ )