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
chenpangpang
transformers
Commits
9fd606db
Unverified
Commit
9fd606db
authored
May 16, 2024
by
NielsRogge
Committed by
GitHub
May 16, 2024
Browse files
[LLaVa-NeXT] Small fixes (#30841)
* First draft * Update docstring
parent
4b3eb19f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
src/transformers/models/llava_next/image_processing_llava_next.py
...sformers/models/llava_next/image_processing_llava_next.py
+8
-6
No files found.
src/transformers/models/llava_next/image_processing_llava_next.py
View file @
9fd606db
...
@@ -156,8 +156,8 @@ class LlavaNextImageProcessor(BaseImageProcessor):
...
@@ -156,8 +156,8 @@ class LlavaNextImageProcessor(BaseImageProcessor):
number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
Can be overridden by the `image_std` parameter in the `preprocess` method.
Can be overridden by the `image_std` parameter in the `preprocess` method.
do_pad (`bool`, *optional*, defaults to `True`):
do_pad (`bool`, *optional*, defaults to `True`):
Whether to pad the image. If `True` will pad the images in the batch to the largest
image in the batch
Whether to pad the image. If `True`
,
will pad the
patch dimension of the
images in the batch to the largest
and create a pixel mask
. Padding will be applied to the bottom and right
of the image
with zeros.
number of patches in the batch
. Padding will be applied to the bottom and right with zeros.
do_convert_rgb (`bool`, *optional*, defaults to `True`):
do_convert_rgb (`bool`, *optional*, defaults to `True`):
Whether to convert the image to RGB.
Whether to convert the image to RGB.
"""
"""
...
@@ -203,6 +203,7 @@ class LlavaNextImageProcessor(BaseImageProcessor):
...
@@ -203,6 +203,7 @@ class LlavaNextImageProcessor(BaseImageProcessor):
self
.
do_normalize
=
do_normalize
self
.
do_normalize
=
do_normalize
self
.
image_mean
=
image_mean
if
image_mean
is
not
None
else
OPENAI_CLIP_MEAN
self
.
image_mean
=
image_mean
if
image_mean
is
not
None
else
OPENAI_CLIP_MEAN
self
.
image_std
=
image_std
if
image_std
is
not
None
else
OPENAI_CLIP_STD
self
.
image_std
=
image_std
if
image_std
is
not
None
else
OPENAI_CLIP_STD
self
.
do_pad
=
do_pad
self
.
do_convert_rgb
=
do_convert_rgb
self
.
do_convert_rgb
=
do_convert_rgb
# Copied from transformers.models.clip.image_processing_clip.CLIPImageProcessor.resize with CLIP->LLaVa
# Copied from transformers.models.clip.image_processing_clip.CLIPImageProcessor.resize with CLIP->LLaVa
...
@@ -572,7 +573,7 @@ class LlavaNextImageProcessor(BaseImageProcessor):
...
@@ -572,7 +573,7 @@ class LlavaNextImageProcessor(BaseImageProcessor):
do_normalize
:
bool
=
None
,
do_normalize
:
bool
=
None
,
image_mean
:
Optional
[
Union
[
float
,
List
[
float
]]]
=
None
,
image_mean
:
Optional
[
Union
[
float
,
List
[
float
]]]
=
None
,
image_std
:
Optional
[
Union
[
float
,
List
[
float
]]]
=
None
,
image_std
:
Optional
[
Union
[
float
,
List
[
float
]]]
=
None
,
do_pad
:
Optional
[
bool
]
=
Tru
e
,
do_pad
:
Optional
[
bool
]
=
Non
e
,
do_convert_rgb
:
bool
=
None
,
do_convert_rgb
:
bool
=
None
,
return_tensors
:
Optional
[
Union
[
str
,
TensorType
]]
=
None
,
return_tensors
:
Optional
[
Union
[
str
,
TensorType
]]
=
None
,
data_format
:
Optional
[
ChannelDimension
]
=
ChannelDimension
.
FIRST
,
data_format
:
Optional
[
ChannelDimension
]
=
ChannelDimension
.
FIRST
,
...
@@ -609,9 +610,9 @@ class LlavaNextImageProcessor(BaseImageProcessor):
...
@@ -609,9 +610,9 @@ class LlavaNextImageProcessor(BaseImageProcessor):
image_std (`float` or `List[float]`, *optional*, defaults to `self.image_std`):
image_std (`float` or `List[float]`, *optional*, defaults to `self.image_std`):
Image standard deviation to use for normalization. Only has an effect if `do_normalize` is set to
Image standard deviation to use for normalization. Only has an effect if `do_normalize` is set to
`True`.
`True`.
do_pad (`bool`, *optional*, defaults to self.do_pad):
do_pad (`bool`, *optional*, defaults to
`
self.do_pad
`
):
Whether to pad the image. If `True` will pad the images in the batch to the largest
image in the batch
Whether to pad the image. If `True`
,
will pad the
patch dimension of the
images in the batch to the largest
and create a pixel mask
. Padding will be applied to the bottom and right
of the image
with zeros.
number of patches in the batch
. Padding will be applied to the bottom and right with zeros.
do_convert_rgb (`bool`, *optional*, defaults to `self.do_convert_rgb`):
do_convert_rgb (`bool`, *optional*, defaults to `self.do_convert_rgb`):
Whether to convert the image to RGB.
Whether to convert the image to RGB.
return_tensors (`str` or `TensorType`, *optional*):
return_tensors (`str` or `TensorType`, *optional*):
...
@@ -647,6 +648,7 @@ class LlavaNextImageProcessor(BaseImageProcessor):
...
@@ -647,6 +648,7 @@ class LlavaNextImageProcessor(BaseImageProcessor):
do_normalize
=
do_normalize
if
do_normalize
is
not
None
else
self
.
do_normalize
do_normalize
=
do_normalize
if
do_normalize
is
not
None
else
self
.
do_normalize
image_mean
=
image_mean
if
image_mean
is
not
None
else
self
.
image_mean
image_mean
=
image_mean
if
image_mean
is
not
None
else
self
.
image_mean
image_std
=
image_std
if
image_std
is
not
None
else
self
.
image_std
image_std
=
image_std
if
image_std
is
not
None
else
self
.
image_std
do_pad
=
do_pad
if
do_pad
is
not
None
else
self
.
do_pad
do_convert_rgb
=
do_convert_rgb
if
do_convert_rgb
is
not
None
else
self
.
do_convert_rgb
do_convert_rgb
=
do_convert_rgb
if
do_convert_rgb
is
not
None
else
self
.
do_convert_rgb
images
=
make_list_of_images
(
images
)
images
=
make_list_of_images
(
images
)
...
...
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