ariG23498 HF Staff commited on
Commit
2b58c1c
·
verified ·
1 Parent(s): c56cf1d

Upload ByteDance_Ouro-2.6B-Thinking_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. ByteDance_Ouro-2.6B-Thinking_0.py +59 -0
ByteDance_Ouro-2.6B-Thinking_0.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Use a pipeline as a high-level helper
17
+ from transformers import pipeline
18
+
19
+ pipe = pipeline("text-generation", model="ByteDance/Ouro-2.6B-Thinking", trust_remote_code=True)
20
+ messages = [
21
+ {"role": "user", "content": "Who are you?"},
22
+ ]
23
+ pipe(messages)
24
+ with open('ByteDance_Ouro-2.6B-Thinking_0.txt', 'w', encoding='utf-8') as f:
25
+ f.write('Everything was good in ByteDance_Ouro-2.6B-Thinking_0.txt')
26
+ except Exception as e:
27
+ import os
28
+ from slack_sdk import WebClient
29
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
30
+ client.chat_postMessage(
31
+ channel='#hub-model-metadata-snippets-sprint',
32
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/ByteDance_Ouro-2.6B-Thinking_0.txt|ByteDance_Ouro-2.6B-Thinking_0.txt>',
33
+ )
34
+
35
+ with open('ByteDance_Ouro-2.6B-Thinking_0.txt', 'a', encoding='utf-8') as f:
36
+ import traceback
37
+ f.write('''```CODE:
38
+ # Use a pipeline as a high-level helper
39
+ from transformers import pipeline
40
+
41
+ pipe = pipeline("text-generation", model="ByteDance/Ouro-2.6B-Thinking", trust_remote_code=True)
42
+ messages = [
43
+ {"role": "user", "content": "Who are you?"},
44
+ ]
45
+ pipe(messages)
46
+ ```
47
+
48
+ ERROR:
49
+ ''')
50
+ traceback.print_exc(file=f)
51
+
52
+ finally:
53
+ from huggingface_hub import upload_file
54
+ upload_file(
55
+ path_or_fileobj='ByteDance_Ouro-2.6B-Thinking_0.txt',
56
+ repo_id='model-metadata/code_execution_files',
57
+ path_in_repo='ByteDance_Ouro-2.6B-Thinking_0.txt',
58
+ repo_type='dataset',
59
+ )