Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
82fe48ec
Unverified
Commit
82fe48ec
authored
Apr 16, 2025
by
achervyakov
Committed by
GitHub
Apr 17, 2025
Browse files
init pixels before tokenizer creation (#2911)
parent
cb316a18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lm_eval/models/hf_vlms.py
lm_eval/models/hf_vlms.py
+5
-3
No files found.
lm_eval/models/hf_vlms.py
View file @
82fe48ec
...
...
@@ -49,6 +49,11 @@ class HFMultimodalLM(HFLM):
max_pixels
:
Optional
[
int
]
=
None
,
**
kwargs
,
):
# init pixels before calling tokenizer creation to avoid errors
self
.
pixels
=
({
"min_pixels"
:
min_pixels
}
if
min_pixels
else
{})
|
(
{
"max_pixels"
:
max_pixels
}
if
max_pixels
else
{}
)
# We initialize using HFLM's init. Sub-methods like _create_model and _create_tokenizer
# modify init behavior.
super
().
__init__
(
pretrained
,
**
kwargs
)
...
...
@@ -65,9 +70,6 @@ class HFMultimodalLM(HFLM):
self
.
interleave
=
interleave
self
.
max_images
=
max_images
self
.
rgb
=
convert_img_format
self
.
pixels
=
({
"min_pixels"
:
min_pixels
}
if
min_pixels
else
{})
|
(
{
"max_pixels"
:
max_pixels
}
if
max_pixels
else
{}
)
# WARNING: improperly set image_token_id can lead to ignored image input or other (potentially silent) errors!
if
not
image_string
:
self
.
image_token_id
=
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment