ariG23498 HF Staff commited on
Commit
fac7702
·
verified ·
1 Parent(s): d61e2d7

Upload Open-Bee_Bee-8B-RL_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. Open-Bee_Bee-8B-RL_0.py +40 -0
Open-Bee_Bee-8B-RL_0.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "torch",
5
+ # "torchvision",
6
+ # "transformers",
7
+ # "accelerate",
8
+ # "peft",
9
+ # ]
10
+ # ///
11
+
12
+ try:
13
+ # Use a pipeline as a high-level helper
14
+ from transformers import pipeline
15
+
16
+ pipe = pipeline("image-text-to-text", model="Open-Bee/Bee-8B-RL", trust_remote_code=True)
17
+ messages = [
18
+ {
19
+ "role": "user",
20
+ "content": [
21
+ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
22
+ {"type": "text", "text": "What animal is on the candy?"}
23
+ ]
24
+ },
25
+ ]
26
+ pipe(text=messages)
27
+ with open('Open-Bee_Bee-8B-RL_0.txt', 'w', encoding='utf-8') as f:
28
+ f.write('Everything was good in Open-Bee_Bee-8B-RL_0.txt')
29
+ except Exception as e:
30
+ with open('Open-Bee_Bee-8B-RL_0.txt', 'w', encoding='utf-8') as f:
31
+ import traceback
32
+ traceback.print_exc(file=f)
33
+ finally:
34
+ from huggingface_hub import upload_file
35
+ upload_file(
36
+ path_or_fileobj='Open-Bee_Bee-8B-RL_0.txt',
37
+ repo_id='model-metadata/code_execution_files',
38
+ path_in_repo='Open-Bee_Bee-8B-RL_0.txt',
39
+ repo_type='dataset',
40
+ )