ariG23498 HF Staff commited on
Commit
2ac43fe
·
verified ·
1 Parent(s): 4899ad6

Upload rednote-hilab_dots.vlm1.inst_0.py with huggingface_hub

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