Skip to content

Commit

Permalink
tokenizing from the autoencoder should always no grad and eval mode, …
Browse files Browse the repository at this point in the history
…readying it for use in multimodal network in some final multimodal repo
  • Loading branch information
lucidrains committed Dec 5, 2023
1 parent 24a9873 commit 7c2c3ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions meshgpt_pytorch/meshgpt_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,10 @@ def decode_from_codes_to_faces(

return continuous_coors, pred_face_coords

@torch.no_grad()
def tokenize(self, *args, **kwargs):
assert 'return_codes' not in kwargs
self.eval()
return self.forward(*args, return_codes = True, **kwargs)

@beartype
Expand Down Expand Up @@ -545,13 +547,11 @@ def forward_from_raw_face_data(
face_edges: TensorType['b', 2, 'e', int],
**kwargs
):
with torch.no_grad():
self.autoencoder.eval()
codes = self.autoencoder.tokenize(
vertices = vertices,
faces = faces,
face_edges = face_edges
)
codes = self.autoencoder.tokenize(
vertices = vertices,
faces = faces,
face_edges = face_edges
)

return self.forward(codes, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'meshgpt-pytorch',
packages = find_packages(exclude=[]),
version = '0.0.10',
version = '0.0.11',
license='MIT',
description = 'MeshGPT Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 7c2c3ce

Please sign in to comment.