Skip to content

Commit

Permalink
beartype around some __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Nov 13, 2024
1 parent 19b07bc commit 4737924
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pi_zero_pytorch/pi_zero.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from __future__ import annotations
from typing import Callable

from beartype.typing import Callable
from beartype import beartype

from functools import partial

import torch
Expand All @@ -20,6 +23,7 @@

from pi_zero_pytorch.tensor_typing import Float, Int, Bool


import tqdm

# ein notation
Expand Down Expand Up @@ -95,6 +99,7 @@ def direction_loss(pred, target, dim = -1):
# attention

class Attention(Module):
@beartype
def __init__(
self,
dim,
Expand Down Expand Up @@ -332,6 +337,7 @@ def forward(self, actions, cond):
# main class

class PiZero(Module):
@beartype
def __init__(
self,
dim,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ classifiers=[
]

dependencies = [
"beartype",
"einx>=0.3.0",
"einops>=0.8.0",
"jaxtyping",
Expand Down

0 comments on commit 4737924

Please sign in to comment.