Skip to content

docs: fix docstring args that don't match their signatures - #2061

Open
ishtiaq-ahmed-dev wants to merge 1 commit into
TransformerLensOrg:devfrom
ishtiaq-ahmed-dev:docs-stale-docstring-args
Open

ishtiaq-ahmed-dev wants to merge 1 commit into
TransformerLensOrg:devfrom
ishtiaq-ahmed-dev:docs-stale-docstring-args

Conversation

@ishtiaq-ahmed-dev

Copy link
Copy Markdown

Description

A few docstrings on dev describe arguments their functions don't have:

  • TrainConfig (transformer_lens/tools/training.py) documents a wandb_project field, but the field is wandb_project_name, so following the docstring fails:
    >>> TrainConfig(num_epochs=1, batch_size=8, wandb=True, wandb_project="demo")
    TypeError: TrainConfig.__init__() got an unexpected keyword argument 'wandb_project'
    The same docstring also had a truncated max_grad_norm description ("Maximum gradient norm to use for") and a stray comma in save_dir,. Fixed all three.
  • BloomArchitectureAdapter.split_qkv_matrix documented attention_component; the parameter is original_attention_component (the NeoX and JointQKV versions already use the right name).
  • ParamProcessingConversion.revert documented state_dict / current_key and said it returns a modified state dict; it takes a tensor and returns the reverted tensor. convert also said it "stores result at current_key" and returns a modified state dict, while it returns the converted tensor and doesn't write to the dict.

Docstrings only, no behaviour change. This follows the same pattern as #2030 for the remaining hits.

Type of change

  • This change requires a documentation update (docstrings only)

Checklist:

  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (docstring-only change)
  • New and existing unit tests pass locally with my changes (no code paths changed; see below)
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

What I ran (Python 3.12, Windows 11):

  • Reproduced the TypeError above and checked TrainConfig(..., wandb_project_name="demo") works; imported the three touched modules.
  • black --check (23.12.1, the version in uv.lock) and isort --check-only (5.8.0) on the changed files: clean.
  • An ast scan comparing documented Args: names with each function's signature over transformer_lens/: no mismatches left apart from *args/**kwargs entries.

TrainConfig documented a wandb_project field; the field is
wandb_project_name, so TrainConfig(wandb_project=...) raises TypeError.
Also complete the truncated max_grad_norm description, drop a stray comma
after save_dir, use the real parameter name in BloomArchitectureAdapter.
split_qkv_matrix, and describe what ParamProcessingConversion.convert and
revert actually take and return (a tensor, not a modified state dict).
@ishtiaq-ahmed-dev

Copy link
Copy Markdown
Author

The "Full Code Coverage Test" failure looks unrelated to this change: the job ended after ~66 min with "The hosted runner lost communication with the server" before the test step reported a result, and this PR only touches docstrings. All other checks pass. Could someone with access re-run that job when convenient? Thanks!

This branch has not been deployed

No deployments
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