Add new args in auto-docstring - #47737
Conversation
|
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. |
| @accepts_precomputed_kwargs(modality="image") | ||
| @can_return_tuple | ||
| @auto_docstring | ||
| def get_image_features( |
There was a problem hiding this comment.
can be copied from parent, and I am seeing it overriden many times. IMO copying makes maintaining easier, maybe we can have an mlinter rule, i dunno
| # Can inherit as they share common set of kwargs | ||
| class VideoProcessorArgs(ImageProcessorArgs): | ||
| videos = { | ||
| "description": """ | ||
| Video to preprocess. Expects a single or batch of videos with pixel values ranging from 0 to 255. If | ||
| passing in videos with pixel values between 0 and 1, set `do_rescale=False`. | ||
| """, |
There was a problem hiding this comment.
found an interesting thing. When we print docstring of a random ImageProcessor class with no special kwargs, we get smth like below where kwargs are not unpacked:
images: inputs images
kwargs: any other keyword args you can pass, check ImagesKwargs for more
But if we take processor with custom kwargs (e.g. qwen), then the whole list is unpacked:
images: inputs images
do_resize: if to resize or not
size: a dict of sizes
patch_size: the patch size to use etc
Seems like this was intended looking at the first auto-doc PR, to me it looked weird tho
There was a problem hiding this comment.
ahh interesting, agree that its a bit weird 馃憖
so two processors can have the same args - but kwargs are documented differently - but which rendering we get depends on how it was implemented. i prefer the unpacked version so users don't have to click through to ImagesKwargs to find out what it takes while Qwen users get everything on the page
There was a problem hiding this comment.
i agree, I can update it here tmrw, it should be only a few lines
|
[For maintainers] Suggested jobs to run (before merge) run-slow: colqwen2, cosmos3_edge, cosmos3_omni, ernie4_5_vl_moe, exaone4_5, gemma4, gemma4_unified, glm46v, glm4v, glm4v_moe, glm_image, glm_ocr, glmga, hunyuan_vl, kimi_k25, minicpmv4_6 |
CI recapDashboard: View test results in Grafana |
|
@stevhliu done, comparison with what is was (https://huggingface.co/docs/transformers/main/en/model_doc/llava#transformers.LlavaImageProcessor) and what we have now (https://moon-ci-docs.huggingface.co/docs/transformers/pr_47737/en/model_doc/llava#transformers.LlavaImageProcessor) |
stevhliu
left a comment
There was a problem hiding this comment.
very nice, thanks for improving!
What does this PR do?
As per title, add
image/video grid thwin auto docs and deletes it from modeling code. Also noticed thatlabelscan be deleted as it is inModelArgsalready. And, allows video processors be auto-doc'cedIMPORTANT:
From this PR on we will be explicitly unpacking all kwargs in the docstring if we can. For example, trying to inspect
LlavaImageProccessor.preprocess.__doc__will print the following