Skip to content

Docs: 88 docstrings document parameters their functions don't have (proposal for a cleanup PR) #51025

Open

Description

@ishtiaq-ahmed-dev

Feature request

A docs-only cleanup: 88 docstrings in 72 files under src/transformers document parameters that their functions don't have. Usually it's a name left over from before a rename. The contributing guide asks for an issue before a mechanical cleanup like this, so here's the proposal.

What's affected. Most of these are internal, but a few are public:

  • create_position_ids_from_input_ids (24 copies: RoBERTa, XLM-R, CamemBERT, ESM, Longformer, LUKE, M2M-100, …) documents x: torch.Tensor x:; the parameters are input_ids, padding_idx and cache_length.
  • The resize() methods of the DPT and CHMv2 image processors document interpolation; the parameter is resample.
  • integrations.deepspeed.deepspeed_init documents resume_from_checkpoint and auto_find_batch_size, which it doesn't take.
  • The SAM-family prompt encoders (forward, 8 copies) document points, boxes and masks; the parameters are input_points, input_labels, input_boxes and input_masks. In addition, the EdgeTAM/SAM two-way attention __init__ documents attention_downsample_rate.
All 88 (file:line function: documented name(s) missing from the signature)
integrations/deepspeed.py:613 deepspeed_init: resume_from_checkpoint, auto_find_batch_size
loss/loss_rf_detr.py:143 sample_points_using_uncertainty: uncertainty_function
models/altclip/modeling_altclip.py:159 create_position_ids_from_input_ids: x
models/bridgetower/modeling_bridgetower.py:859 create_position_ids_from_input_ids: x
models/camembert/modeling_camembert.py:141 create_position_ids_from_input_ids: x
models/chmv2/image_processing_chmv2.py:317 resize: interpolation
models/clap/modeling_clap.py:1008 create_position_ids_from_input_ids: x
models/cosmos3_edge/modeling_cosmos3_edge.py:407 forward: spatial_shapes
models/data2vec/modeling_data2vec_text.py:140 create_position_ids_from_input_ids: x
models/deberta/modeling_deberta.py:72 build_relative_position: query_size, key_size
models/deberta_v2/modeling_deberta_v2.py:71 build_relative_position: query_size, key_size, device
models/dpt/image_processing_dpt.py:327 resize: interpolation
models/dpt/modular_dpt.py:122 resize: interpolation
models/edgetam/modeling_edgetam.py:191 __init__: attention_downsample_rate
models/edgetam/modeling_edgetam.py:635 forward: points, boxes, masks
models/edgetam_video/modeling_edgetam_video.py:551 __init__: attention_downsample_rate
models/edgetam_video/modeling_edgetam_video.py:1739 forward: points, boxes, masks
models/emu3/image_processing_emu3.py:161 _preprocess: vision_info
models/esm/modeling_esm.py:1021 create_position_ids_from_input_ids: x
models/esm/modeling_esmfold.py:825 forward: x
models/esm/openfold_utils/rigid_utils.py:814 __getitem__: or
models/esm/openfold_utils/rigid_utils.py:907 compose_q_update_vec: q_vec
models/evolla/modeling_evolla.py:52 create_position_ids_from_input_ids: x
models/evolla/modeling_evolla.py:628 forward: latent
models/evolla/modular_evolla.py:240 forward: latent
models/fastspeech2_conformer/modeling_fastspeech2_conformer.py:161 forward: hidden_states, padding_masks
models/fastspeech2_conformer/modeling_fastspeech2_conformer.py:276 __init__: input_dim
models/fastspeech2_conformer/modeling_fastspeech2_conformer.py:803 forward: input_ids
models/florence2/convert_florence2_original_pytorch_to_hf.py:77 vision_spatial_block: idx, cnt
models/florence2/convert_florence2_original_pytorch_to_hf.py:185 vision_channel_block: idx, cnt
models/groupvit/modeling_groupvit.py:512 forward: attention_mask
models/ibert/quant_modules.py:704 batch_frexp: scaling_factor
models/kosmos2/modeling_kosmos2.py:625 create_position_ids_from_input_ids: x
models/kosmos2_5/modeling_kosmos2_5.py:684 create_position_ids_from_input_ids: x
models/llama4/image_processing_llama4.py:51 get_max_res_without_distortion: target_resolution
models/llama4/modeling_llama4.py:66 forward: selected_experts, routing_weights
models/llama4/modeling_llama4.py:886 forward: inputs_embeds
models/llama4/processing_llama4.py:89 _prompt_split_image: num_patches
models/longformer/modeling_longformer.py:368 create_position_ids_from_input_ids: x
models/luke/modeling_luke.py:973 create_position_ids_from_input_ids: x
models/m2m_100/modeling_m2m_100.py:168 create_position_ids_from_input_ids: x
models/markuplm/modeling_markuplm.py:141 create_position_ids_from_input_ids: x
models/mllama/modeling_mllama.py:348 forward: inputs_embeds
models/moshi/modeling_moshi.py:1638 get_unconditional_inputs: max_new_tokens
models/musicgen/modeling_musicgen.py:2127 get_unconditional_inputs: max_new_tokens
models/nemotron_asr_streaming/modeling_nemotron_asr_streaming.py:419 forward: attention_mask
models/nllb_moe/modeling_nllb_moe.py:151 create_position_ids_from_input_ids: x
models/oneformer/modeling_oneformer.py:357 __init__: num_labels
models/ovis2/convert_ovis2_weights_to_hf.py:277 convert_model: save_dir
models/phi4_multimodal/modeling_phi4_multimodal.py:880 adaptive_enc_mask: xs_len
models/phi4_multimodal/modular_phi4_multimodal.py:1082 adaptive_enc_mask: xs_len
models/qwen2_5_omni/modeling_qwen2_5_omni.py:180 get_chunked_index: t_ntoken_per_chunk
models/qwen2_5_omni/modular_qwen2_5_omni.py:758 get_chunked_index: t_ntoken_per_chunk
models/qwen2_5_omni/processing_qwen2_5_omni.py:306 get_chunked_index: t_ntoken_per_chunk
models/qwen3_omni_moe/modeling_qwen3_omni_moe.py:183 get_chunked_index: t_ntoken_per_chunk
models/qwen3_omni_moe/processing_qwen3_omni_moe.py:330 get_chunked_index: t_ntoken_per_chunk
models/reformer/modeling_reformer.py:88 update: key_states, value_states
models/rf_detr/convert_rf_detr_weights_to_hf.py:163 convert_rf_detr_checkpoint: checkpoint_path
models/roberta/modeling_roberta.py:141 create_position_ids_from_input_ids: x
models/roberta/modular_roberta.py:122 create_position_ids_from_input_ids: x
models/roberta_prelayernorm/modeling_roberta_prelayernorm.py:137 create_position_ids_from_input_ids: x
models/sam/modeling_sam.py:461 forward: image_positional_embedding
models/sam/modeling_sam.py:658 forward: points, boxes, masks
models/sam2/modeling_sam2.py:830 forward: points, boxes, masks
models/sam2/modeling_sam2.py:945 __init__: attention_downsample_rate
models/sam2_video/modeling_sam2_video.py:546 __init__: attention_downsample_rate
models/sam2_video/modeling_sam2_video.py:1320 forward: points, boxes, masks
models/sam3/processing_sam3.py:210 _normalize_coordinates: target_size
models/sam3_tracker/modeling_sam3_tracker.py:248 forward: points, boxes, masks
models/sam3_tracker/modeling_sam3_tracker.py:385 __init__: attention_downsample_rate
models/sam3_tracker_video/modeling_sam3_tracker_video.py:546 __init__: attention_downsample_rate
models/sam3_tracker_video/modeling_sam3_tracker_video.py:1324 forward: points, boxes, masks
models/sam3_video/modeling_sam3_video.py:1028 _suppress_overlapping_based_on_recent_occlusion: tracker_metadata_prev
models/sam_hq/modeling_sam_hq.py:915 forward: image_positional_embedding
models/sam_hq/modeling_sam_hq.py:1185 forward: points, boxes, masks
models/sam_hq/modular_sam_hq.py:227 forward: image_positional_embedding
models/seamless_m4t/modeling_seamless_m4t.py:977 create_position_ids_from_input_ids: x
models/seamless_m4t/modeling_seamless_m4t.py:2084 forward: spectrogram
models/seamless_m4t_v2/modeling_seamless_m4t_v2.py:861 create_position_ids_from_input_ids: x
models/seamless_m4t_v2/modeling_seamless_m4t_v2.py:2297 forward: spectrogram
models/speech_to_text/modeling_speech_to_text.py:156 create_position_ids_from_input_ids: x
models/speecht5/modeling_speecht5.py:338 create_position_ids_from_input_ids: x
models/umt5/modeling_umt5.py:233 _relative_position_bucket: bidirectional, num_buckets, max_distance
models/univnet/feature_extraction_univnet.py:231 generate_noise: spectrogram_length, model_in_channels
models/xlm_roberta/modeling_xlm_roberta.py:141 create_position_ids_from_input_ids: x
models/xlm_roberta_xl/modeling_xlm_roberta_xl.py:143 create_position_ids_from_input_ids: x
models/xmod/modeling_xmod.py:136 create_position_ids_from_input_ids: x
utils/auto_docstring.py:2978 parse_docstring: arg1, arg2

How I'd make it. Rename each stale entry to the real parameter or delete it, editing only docstrings. 22 of the 72 files are generated from modular_*.py, so those edits go into the modular sources (or the "Copied from" origin) and get regenerated with make fix-repo. That leaves about 50 hand-edited files plus their regenerated copies. The 4 findings in convert_* scripts can be left out if you'd rather not touch them. I found these by parsing every function with ast and comparing the names under Args: with the signature. Functions with *args/**kwargs are skipped, so there are no false positives from forwarded arguments.

If a single PR is too large to review, I can split it by area: text models, vision/SAM family, audio, and integrations.

Motivation

These names show up in IDE tooltips and, for public classes, in the rendered API docs. Anyone who copies a documented name, for example image_processor.resize(..., interpolation=...), gets a TypeError.

Your contribution

I'd like to open the PR(s) if this is open for contributions.

Activity

  1. Rocketknight1 commented on Nov 23, 2026

    @Rocketknight1
    Member

    cc @stevhliu for docs

  2. stevhliu commented on Nov 24, 2026

    @stevhliu
    Member

    ah thanks! feel free to open a single PR with the fixes 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions