Skip to content

Commit

Permalink
Fixed import & style
Browse files Browse the repository at this point in the history
  • Loading branch information
HuFY-dev authored Mar 29, 2024
1 parent 659d60c commit 1e7e3fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sparse_autoencoder/optimizer/adam_with_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
from sparse_autoencoder.tensor_types import Axis

# params_t was renamed to ParamsT in PyTorch 2.2, which caused import errors
# Copied from PyTorch 2.1
from typing import Union, Iterable, Dict, Any
# Copied from PyTorch 2.1 with modifications for better style
from collections.abc import Iterable
from typing import Any
from typing_extensions import TypeAlias
params_t: TypeAlias = Union[Iterable[Tensor], Iterable[Dict[str, Any]]]
params_t: TypeAlias = Iterable[Tensor] | Iterable[dict[str, Any]]

Check failure on line 19 in sparse_autoencoder/optimizer/adam_with_reset.py

View workflow job for this annotation

GitHub Actions / Checks (3.11)

Ruff (I001)

sparse_autoencoder/optimizer/adam_with_reset.py:5:1: I001 Import block is un-sorted or un-formatted

Check failure on line 19 in sparse_autoencoder/optimizer/adam_with_reset.py

View workflow job for this annotation

GitHub Actions / Checks (3.11)

Ruff (PYI042)

sparse_autoencoder/optimizer/adam_with_reset.py:19:1: PYI042 Type alias `params_t` should be CamelCase

class AdamWithReset(Adam):
"""Adam Optimizer with a reset method.
Expand Down

0 comments on commit 1e7e3fc

Please sign in to comment.