Add glpn fast processor#38461
Conversation
|
cc @yonigozlan |
yonigozlan
left a comment
There was a problem hiding this comment.
Hi @aryanchauhan31 ! Please follow thoroughly the instructions in #36978, and use the command
transformers-cli add-fast-image-processor --model-name model_nameto get started.
You're missing docs, tests, auto configs etc.
| from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, PILImageResampling | ||
|
|
||
|
|
||
| class GLPNImageProcessorFast(BaseImageProcessorFast): |
There was a problem hiding this comment.
You are missing the post_process_depth_estimation method. The slow and fast image processors must have the same functionalities!
| import_structure = { | ||
| "configuration_glpn": ["GLPNConfig"], | ||
| "feature_extraction_glpn": ["GLPNFeatureExtractor"], | ||
| "image_processing_glpn": ["GLPNImageProcessor"], | ||
| "image_processing_glpn_fast": ["GLPNImageProcessorFast"], | ||
| "modeling_glpn": [ | ||
| "GLPNModel", | ||
| "GLPNForDepthEstimation", | ||
| "GLPNPreTrainedModel", | ||
| ], | ||
| } | ||
|
|
||
| if TYPE_CHECKING: | ||
| from .configuration_glpn import * | ||
| from .feature_extraction_glpn import * | ||
| from .image_processing_glpn import * | ||
| from .modeling_glpn import * | ||
| from .configuration_glpn import GLPNConfig | ||
| from .feature_extraction_glpn import GLPNFeatureExtractor | ||
| from .image_processing_glpn import GLPNImageProcessor | ||
| from .image_processing_glpn_fast import GLPNImageProcessorFast | ||
| from .modeling_glpn import ( | ||
| GLPNForDepthEstimation, | ||
| GLPNModel, | ||
| GLPNPreTrainedModel, | ||
| ) | ||
| else: | ||
| import os | ||
| import sys | ||
|
|
||
| _file = globals()["__file__"] | ||
| sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__) | ||
| sys.modules[__name__] = _LazyModule(__name__, _file, import_structure, module_spec=__spec__) |
There was a problem hiding this comment.
You only need to add this:
from .image_processing_glpn_fast import *after
from .image_processing_glpn import *No need to modify anything else here.
There was a problem hiding this comment.
Hey @yonigozlan
Thanks for the heads-up! I’ll go through the checklist in #36978 and rerun transformers-cli add-fast-image-processor to make sure everything’s in place — docs, tests, auto configs, and all.
Appreciate the nudge — I’ll push the updates soon
|
Closing this PR to give opportunities to others to contribute, as it appears to be stale. |
This PR adds support for
GLPNImageProcessorFast, enabling fast inference for the GLPN model using TorchVision backends.Changes:
GLPNImageProcessorFastimplementation inimage_processing_glpn_fast.py.__init__.pyto include the new fast processor inimport_structure.max abs diff < 1e-7).Let me know if further refactoring or docs are needed.