Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for modular with fast image processors #35379

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yonigozlan
Copy link
Member

What does this PR do?

Add support for using modular with fast image processors

Also add a fix for using modular on files other than modeling, which seem to have been broken by a recent change

Who can review?

@Cyrilvallez

Comment on lines +127 to +143
def post_process_segmentation():
raise NotImplementedError("Segmentation post-processing is not implemented for Deformable DETR yet.")

def post_process_instance():
raise NotImplementedError("Instance post-processing is not implemented for Deformable DETR yet.")

def post_process_panoptic():
raise NotImplementedError("Panoptic post-processing is not implemented for Deformable DETR yet.")

def post_process_instance_segmentation():
raise NotImplementedError("Segmentation post-processing is not implemented for Deformable DETR yet.")

def post_process_semantic_segmentation():
raise NotImplementedError("Semantic segmentation post-processing is not implemented for Deformable DETR yet.")

def post_process_panoptic_segmentation():
raise NotImplementedError("Panoptic segmentation post-processing is not implemented for Deformable DETR yet.")
Copy link
Member Author

@yonigozlan yonigozlan Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I wanted to remove these inherited functions. Somehow this works, but I'm not sure if there is a better way to do this?

Using modular the other way (with DetrImageProcessorFast inheriting from DeformableDetrImageProcessorFast) would solve the problem, but this wouldn't make sense chronologically.

Comment on lines +553 to +575
def from_dict():
raise NotImplementedError("No need to override this method for RT-DETR yet.")

def post_process():
raise NotImplementedError("Post-processing is not implemented for RT-DETR yet.")

def post_process_segmentation():
raise NotImplementedError("Segmentation post-processing is not implemented for RT-DETR yet.")

def post_process_instance():
raise NotImplementedError("Instance post-processing is not implemented for RT-DETR yet.")

def post_process_panoptic():
raise NotImplementedError("Panoptic post-processing is not implemented for RT-DETR yet.")

def post_process_instance_segmentation():
raise NotImplementedError("Segmentation post-processing is not implemented for RT-DETR yet.")

def post_process_semantic_segmentation():
raise NotImplementedError("Semantic segmentation post-processing is not implemented for RT-DETR yet.")

def post_process_panoptic_segmentation():
raise NotImplementedError("Panoptic segmentation post-processing is not implemented for RT-DETR yet.")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines +13 to +15
if dep_name == node_name:
# Skip self dependencies for topological sort as they create cycles
continue
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the case in ijepa for example, where we import IJepaConfig in modular

@@ -54,7 +59,7 @@ def extract_classes_and_imports(file_path):
for node in ast.walk(tree):
if isinstance(node, (ast.Import, ast.ImportFrom)):
module = node.module if isinstance(node, ast.ImportFrom) else None
if module and (".modeling_" in module):
if module and (".modeling_" in module or "transformers.models" in module):
Copy link
Member Author

@yonigozlan yonigozlan Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArthurZucker @Cyrilvallez This was changed in a recent PR, but seems to have broken modular for generating files other than modeling

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants