ariG23498 HF Staff commited on
Commit
6d93fd5
·
verified ·
1 Parent(s): 9454dc8

Upload google_translategemma-4b-it_1.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. google_translategemma-4b-it_1.txt +68 -0
google_translategemma-4b-it_1.txt ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```CODE:
2
+ # Use a pipeline as a high-level helper
3
+ from transformers import pipeline
4
+
5
+ pipe = pipeline("image-text-to-text", model="google/translategemma-4b-it")
6
+ messages = [
7
+ {
8
+ "role": "user",
9
+ "content": [
10
+ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
11
+ {"type": "text", "text": "What animal is on the candy?"}
12
+ ]
13
+ },
14
+ ]
15
+ pipe(text=messages)
16
+ ```
17
+
18
+ ERROR:
19
+ Traceback (most recent call last):
20
+ File "/tmp/google_translategemma-4b-it_1ZjxVq5.py", line 36, in <module>
21
+ pipe(text=messages)
22
+ ~~~~^^^^^^^^^^^^^^^
23
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/pipelines/image_text_to_text.py", line 346, in __call__
24
+ return super().__call__(Chat(text, images), **kwargs)
25
+ ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/pipelines/base.py", line 1467, in __call__
27
+ return self.run_single(inputs, preprocess_params, forward_params, postprocess_params)
28
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/pipelines/base.py", line 1473, in run_single
30
+ model_inputs = self.preprocess(inputs, **preprocess_params)
31
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/pipelines/image_text_to_text.py", line 395, in preprocess
32
+ model_inputs = self.processor.apply_chat_template(
33
+ inputs.messages,
34
+ ...<4 lines>...
35
+ return_dict=True,
36
+ )
37
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/utils/deprecation.py", line 172, in wrapped_func
38
+ return func(*args, **kwargs)
39
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/utils/deprecation.py", line 172, in wrapped_func
40
+ return func(*args, **kwargs)
41
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/processing_utils.py", line 1675, in apply_chat_template
42
+ prompt, generation_indices = render_jinja_template(
43
+ ~~~~~~~~~~~~~~~~~~~~~^
44
+ conversations=conversations,
45
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46
+ ...<2 lines>...
47
+ **self.tokenizer.special_tokens_map, # tokenizer special tokens are used by some templates
48
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49
+ )
50
+ ^
51
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/utils/chat_template_utils.py", line 539, in render_jinja_template
52
+ rendered_chat = compiled_template.render(
53
+ messages=chat,
54
+ ...<3 lines>...
55
+ **kwargs,
56
+ )
57
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/jinja2/environment.py", line 1295, in render
58
+ self.environment.handle_exception()
59
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
60
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/jinja2/environment.py", line 942, in handle_exception
61
+ raise rewrite_traceback_stack(source=source)
62
+ File "<template>", line 601, in top-level template code
63
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/jinja2/sandbox.py", line 401, in call
64
+ return __context.call(__obj, *args, **kwargs)
65
+ ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
66
+ File "/tmp/.cache/uv/environments-v2/023332a3b9521ce5/lib/python3.13/site-packages/transformers/utils/chat_template_utils.py", line 447, in raise_exception
67
+ raise jinja2.exceptions.TemplateError(message)
68
+ jinja2.exceptions.TemplateError: User role must provide `content` as an iterable with exactly one item. That item must be a `mapping(type:'text' | 'image', source_lang_code:string, target_lang_code:string, text:string | none, image:string | none)`.