Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to run on python3.10 #17

Merged
merged 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions unit_scaling/_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
class GELU(nn.GELU):
def __init__(
self,
approximate: str = "none",
constraint: Optional[BinaryConstraint] = gmean,
) -> None:
super().__init__(approximate)
super().__init__()
self.constraint = constraint

def forward(self, input: Tensor) -> Tensor:
Expand Down
2 changes: 1 addition & 1 deletion unit_scaling/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def trace(
"""Adds the `target_to_function` dict to the graph so the interpreter can use it
downstream."""
graph = super().trace(root, concrete_args)
if graph._tracer_extras is None:
if not hasattr(graph, "_tracer_extras") or graph._tracer_extras is None:
graph._tracer_extras = {}
graph._tracer_extras["target_to_function"] = self.target_to_function
return graph # type: ignore
Expand Down