Skip to content

Fix docstring Args entries that name a parameter the function does not take - #8223

Open
darkdi wants to merge 1 commit into
deepspeedai:masterfrom
darkdi:fix/docstring-arg-names
Open

Fix docstring Args entries that name a parameter the function does not take#8223
darkdi wants to merge 1 commit into
deepspeedai:masterfrom
darkdi:fix/docstring-arg-names

Conversation

@darkdi

@darkdi darkdi commented Aug 6, 2026

Copy link
Copy Markdown

Forty-one Args: entries name a parameter the function does not take. Docstrings only — no signature, no behaviour, no test touched.

Twenty are renames where the docstring kept the old name. The ones that stand out:

Where Documented Actual
RaggedUnembed.forward raged_metadata ragged_metadata (typo)
FlopsProfiler object model
attn_out_in_features in_features out_features
RaggedTopKGating.__call__ expert_assignment, expert_offset assignments, offsets
MoEScatter.__call__ hidden_states activations
RaggedEmbeddingKernel.__init__ fp_dtype embed_dtype
InferenceEngineV2.query n_tokens max_request_tokens
InferenceEngineV2.serialize path save_path
BlockedKVCache.__init__ config, enable_offload configs, offload
MOELayer expert experts
DeepSpeedCPULion.__init__ full_precision_optimizer_states fp32_optimizer_states
BertSparseSelfAttention.forward attn_mask attention_mask
get_grad_norm_direct (stage 3 and stages 1/2) parameters params
apply_to_tensors_only functional function
_create_model_parallel model_parallel_size model_parallel_size_
prune_config configs config

Where the position in the Args: block lined up with the position in the signature, that is what I used to decide the mapping — for example in RaggedTopKGating.__call__ the third and fourth documented names sit against the third and fourth parameters.

Two needed a description rather than a rename, because the old text described something that is gone:

  • PipelineEngine.load_module_state_dict documented state_dict (str, None): unused. The argument is checkpoint, and it is used on the very next line.
  • ResourceManager.parse_results documented finished_experiments, which is self.finished_experiments. The argument is metric, the key read out of each experiment's metrics file.

The remaining entries document something that is not an argument at all: layer_id on DeepSpeedTransformerInference, DeepSpeedDiffusersAttention and DeepSpeedMoEInference (it is a class attribute); beta on CUDARMSPreNorm.__call__; q_ratio on BlockedRotaryEmbeddings.__init__; slack and blocks on BlockedKVCache.__init__; block_size on DSStateManager.__init__; key_padding_mask_mode and attn_mask_mode on SparseSelfAttention.forward (both are constructor arguments); seq_len on DenseSparsityConfig.__init__, whose description was a copy of the one above it; num_global_blocks on BSLongformerSparsityConfig.__init__; scale_factor on DynamicLossScaler; scale on the one-bit Adam.step and ZeroOneAdam.step; max_norm on both get_grad_norm_direct; and param and param_id on _process_selected_fp32_groups_grad.

One was a formatting slip rather than a wrong name: quantize_transformer_layer had a Note: line indented inside its Args: block, so Doxygen-style readers and tooling see a parameter called Note. Moved out.

Every entry was opened and read against its signature. yapf produces no diff and flake8 is clean on all thirty-one files, using the pinned yapf==0.40.0 and flake8==5.0.4 from .pre-commit-config.yaml.

…t take

Signed-off-by: darkdi <rantovov5@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b77c08eeda

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


Args:
finished_experiments (dcit): a dictionary of experiment id and experiment description.
metric (str): the key to read from each experiment's metrics file when

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required sign-off trailer

This is a non-merge commit, but its message contains no Signed-off-by trailer, so it does not satisfy the repository's commit policy. Recreate the commit with --signoff using the configured Git identity.

AGENTS.md reference: AGENTS.md:L8-L8

Useful? React with 👍 / 👎.

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.

1 participant