You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ConditionalDetrImageProcessor still accepts the deprecated parameter max_size #37939
if"max_size"inkwargs:
logger.warning_once(
"The `max_size` parameter is deprecated and will be removed in v4.26. ""Please specify in `size['longest_edge'] instead`.",
)
max_size=kwargs.pop("max_size")
else:
max_size=NoneifsizeisNoneelse1333
But the version of transformers is already 4.52.0.dev0 (from src/transformers/__init__.py).
ConditionalDetrImageProcessorFast also suffers the same issue.
@NielsRogge@arjunaskykok that's indeed an annoying BC issue.
The problem is that we still have very popular models which have max_size in configs on the Hub, see this and this comments in the related PR.
PR's are opened on the Hub to update them, but no reaction for most of them so far.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Contributions are welcome! However we have to verify there are no models on the hub with max_size parameter. You would have to use the huggingface_hub library to fetch the corresponding preprocessing configs filtered by conditional_detr model type. Let me know if you have any questions!
Hi @qubvel,
I've looked into this issue and attempted to filter models using the following code:
from huggingface_hub import list_models
from huggingface_hub import ModelFilter
models = list_models(filter="conditional_detr"))
for model in models:
print(model.modelId)
This displays a list of models. Do I need to go through them one by one to check whether they use the max_size parameter, or is there a more efficient way to do this?
I’ve written a small script to scan all models tagged with "conditional-detr" on the Hub and check whether any of them still use the deprecated max_size parameter in their preprocessor_config.json.
Here’s the script (feel free to cross-check it):
fromhuggingface_hubimportHfApi, hf_hub_downloadimportjson# Initialize the Hugging Face APIapi=HfApi()
# Search for models with 'conditional_detr' in their namemodels=api.list_models(filter=['conditional_detr'])
model_counter=0models_with_max_size_in_config= []
models_with_error= []
models_with_no_config= []
formodelinmodels:
model_counter+=1model_id=model.modelIdtry:
file=api.get_paths_info(repo_id=model_id, paths=["preprocessor_config.json"])
iffile:
file_data=hf_hub_download(repo_id=model_id, filename="preprocessor_config.json")
withopen(file_data, 'r') asf:
config=json.load(f)
ifconfig.get("max_size") isnotNone:
models_with_max_size_in_config.append(model_id)
print(f"Model {model_id} has max_size in preprocessor_config.json: {config['max_size']}")
else:
models_with_no_config.append(model_id)
print(f"Model {model_id} does not have preprocessor_config.json.")
exceptExceptionase:
print(f"Error retrieving files for model {model_id}: {e}")
models_with_error.append(model_id)
continueprint(f"Total models found: {model_counter}")
print(f"Models with max_size in preprocessor_config.json: {len(models_with_max_size_in_config)}")
print(f"Models with errors: {len(models_with_error)}")
print(f"Models without preprocessor_config.json: {len(models_with_no_config)}")
# dump results to a json fileresults= {
"total_models": model_counter,
"models_with_max_size_in_config": models_with_max_size_in_config,
"models_with_error": models_with_error,
"models_without_config": models_with_no_config
}
withopen('model_check_results.json', 'w') asf:
json.dump(results, f, indent=4)
With the following output:
Total models found: 201
Models with max_size in preprocessor_config.json: 1
Models with errors: 3
Models without preprocessor_config.json: 13
Thanks for iterating on it @druvdub, for the model "Omnifact/conditional-detr-resnet-101-dc5" - PR is already opened to replace max_size and the model seems not to be super popular, so we can safely remove max_size for the conditional detr model.
Hey @kartickkt I am currently working on it, I am currently doing it for conditional_detr but am happy for you to pick up one of the other models check for them as well.
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.from_dict with Detr->ConditionalDetrdeffrom_dict(cls, image_processor_dict: dict[str, Any], **kwargs):
""" Overrides the `from_dict` method from the base class to make sure parameters are updated if image processor is created using from_dict and kwargs e.g. `ConditionalDetrImageProcessor.from_pretrained(checkpoint, size=600, max_size=800)` """image_processor_dict=image_processor_dict.copy()
if"max_size"inkwargs:
image_processor_dict["max_size"] =kwargs.pop("max_size")
Should the max_size checks be removed from other functions like this as well? I did remove it and updated the docstring to instead use size? but would I need some additional code to handle that?
Since, I am only making changes from conditional_detr right now, I do get some errors when running make repo-consistency because of the # Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.from_dict with Detr->ConditionalDetr. How should I deal with this? I mean I can remove it but if and once the detr gets updated, these changes will be consistent again. Or can I just ignore these errors?
Update: Just made a Draft PR to clarify these things. Will check if any tests are needed and any updates required for the docs
Hi, I’m interested in contributing here. I’d be happy to take care of updating docs/tutorials/examples and ensuring consistency across all DETR-family processors.
Activity
NielsRogge commentedon May 5, 2025
Seems like it's also the case for models like Deformable DETR, Grounding DINO, RT-DETR YOLOS: https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+%22will+be+removed+in+v4.26%22&type=code. Would be great to remove it for all
qubvel commentedon May 5, 2025
@NielsRogge @arjunaskykok that's indeed an annoying BC issue.
The problem is that we still have very popular models which have
max_sizein configs on the Hub, see this and this comments in the related PR.PR's are opened on the Hub to update them, but no reaction for most of them so far.
demoncoder-crypto commentedon May 5, 2025
Hi is there any part which I can contribute too which is currently not under way. Would love tot work on it thanks.
github-actions commentedon Jun 3, 2025
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Rahul7-77 commentedon Jun 4, 2025
contributions are welcomed for this?
qubvel commentedon Jun 6, 2025
Contributions are welcome! However we have to verify there are no models on the hub with
max_sizeparameter. You would have to use thehuggingface_hublibrary to fetch the corresponding preprocessing configs filtered byconditional_detrmodel type. Let me know if you have any questions!marcndo commentedon Jun 7, 2025
Hi @Rahul7-77, do you still plan to work on this? If not, I’d be happy to pick it up.
sarashahin commentedon Jun 7, 2025
Hi @Rahul7-77 , I'd like to take this issue. I'll check hub configs and proceed with removal if safe.
marcndo commentedon Jun 11, 2025
Hi @qubvel,
I've looked into this issue and attempted to filter models using the following code:
from huggingface_hub import list_models
from huggingface_hub import ModelFilter
models = list_models(filter="conditional_detr"))
for model in models:
print(model.modelId)
This displays a list of models. Do I need to go through them one by one to check whether they use the max_size parameter, or is there a more efficient way to do this?
druvdub commentedon Jun 15, 2025
Hey @qubvel @marcndo @NielsRogge 👋
I’ve written a small script to scan all models tagged with
"conditional-detr"on the Hub and check whether any of them still use the deprecatedmax_sizeparameter in theirpreprocessor_config.json.Here’s the script (feel free to cross-check it):
With the following output:
{ "total_models": 201, "models_with_max_size_in_config": [ "Omnifact/conditional-detr-resnet-101-dc5" ], "models_with_error": [ ... gated models ... ], "models_without_config": [ ... 13 repos ... ] }So, just a couple of questions here to double check.
preprocessor_config.json) wheremax_sizecould still appear?Once confirmed, I think we’re good to proceed with updating ConditionalDetrImageProcessor.
Happy to repeat the process for other model types as well!
qubvel commentedon Jun 17, 2025
Thanks for iterating on it @druvdub, for the model "Omnifact/conditional-detr-resnet-101-dc5" - PR is already opened to replace
max_sizeand the model seems not to be super popular, so we can safely removemax_sizefor the conditional detr model.Feel free to open a PR if you have bandwidth
kartickkt commentedon Jun 18, 2025
Hi, I would love to take this up. I will open a PR soon unless anyone else is actively working on it.
druvdub commentedon Jun 18, 2025
Hey @kartickkt I am currently working on it, I am currently doing it for
conditional_detrbut am happy for you to pick up one of the other models check for them as well.@qubvel just had a two-part question.
max_sizechecks be removed from other functions like this as well? I did remove it and updated the docstring to instead use size? but would I need some additional code to handle that?conditional_detrright now, I do get some errors when runningmake repo-consistencybecause of the# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.from_dict with Detr->ConditionalDetr. How should I deal with this? I mean I can remove it but if and once the detr gets updated, these changes will be consistent again. Or can I just ignore these errors?Update: Just made a Draft PR to clarify these things. Will check if any tests are needed and any updates required for the docs
3 remaining items
Remove deprecated max_size parameter from ConditionalDetr image proce…
Remove deprecated max_size parameter from DETR and ConditionalDETR im…
Also remove deprecated max_size parameter from DetrImageProcessorFast
Fix DeformableDETR max_size parameter to maintain copy consistency
Fix all DETR-family processors to maintain copy consistency
Abhijais4896 commentedon Sep 18, 2025
Hi, I’m new and would like to work on this issue. Could you please assign it to me ?
ahmedvictor507 commentedon Sep 27, 2025
Hi, I’m interested in contributing here. I’d be happy to take care of updating docs/tutorials/examples and ensuring consistency across all DETR-family processors.
NielsRogge commentedon Sep 29, 2025
cc @yonigozlan is this issue still relevant to work on?
sonianuj287 commentedon Oct 2, 2025
Hi, I’d like to take this up as a first contribution. Can I work on it?
Use canonical get_size_with_aspect_ratio (with max_size) from transfo…
Use canonical get_size_with_aspect_ratio (with max_size) from transfo…
Raufnarejo505 commentedon Oct 6, 2025
Hi! I’d like to work on this issue. Could you please assign it to me?
Use canonical get_size_with_aspect_ratio (with max_size) from transfo…
Use canonical get_size_with_aspect_ratio (with max_size) from transfo…