e06fe8e8c6
Secret Leaks / trufflehog (push) Failing after 1s
Build documentation / build (push) Failing after 1s
Build documentation / build_other_lang (push) Failing after 0s
CodeQL Security Analysis / CodeQL Analysis (push) Failing after 0s
PR CI / pr-ci (push) Failing after 1s
Slow tests on important models (on Push - A10) / Get all modified files (push) Failing after 1s
Slow tests on important models (on Push - A10) / Model CI (push) Has been skipped
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
28 lines
1.4 KiB
Python
28 lines
1.4 KiB
Python
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
|
# This file was automatically generated from examples/modular-transformers/modular_new_imgproc_model.py.
|
|
# Do NOT edit this file manually as any edits will be overwritten by the generation of
|
|
# the file from the modular. If any change should be done, please apply the change to the
|
|
# modular_new_imgproc_model.py file directly. One of our CI enforces this.
|
|
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
|
import torch
|
|
|
|
from ...image_processing_backends import TorchvisionBackend
|
|
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, PILImageResampling
|
|
from ...utils import auto_docstring
|
|
|
|
|
|
@auto_docstring
|
|
class ImgprocModelImageProcessor(TorchvisionBackend):
|
|
resample = PILImageResampling.BICUBIC
|
|
image_mean = OPENAI_CLIP_MEAN
|
|
image_std = OPENAI_CLIP_STD
|
|
size = {"height": 384, "width": 384}
|
|
default_to_square = True
|
|
do_resize = True
|
|
do_rescale = True
|
|
do_normalize = True
|
|
do_convert_rgb = True
|
|
|
|
def new_image_processing_method(self, pixel_values: torch.FloatTensor):
|
|
return pixel_values / 2
|