Skip to content

Shape mismatch in parameter_transform between TorchScript and MHR.from_files #50

Description

@slnfox

Hello, thanks for sharing this amazing project. I’ve noticed a difference in the tensor shapes of parameter_transform when comparing a model loaded via MHR.from_files against the provided TorchScript model mhr_mode.pt. When initializing the model normally with lod=1, the shape is [889, 321]. However, the TorchScript model shows a shape of [889, 249]. Is this mismatch intended? Could you share the script or the specific steps used to export the mhr_model.pt?

from pathlib import Path
import torch
from mhr.mhr import MHR

# Load the TorchScript model
ts_model = torch.jit.load('assets/mhr_model.pt')
ts_shape = ts_model.character_torch.parameter_transform.parameter_transform.shape
print(f"TorchScript shape: {ts_shape}") 
# Output: torch.Size([889, 249])

# Load via MHR method
mhr_model = MHR.from_files(Path("assets"), device=torch.device("cpu"), lod=1)
mhr_shape = mhr_model.character_torch.parameter_transform.parameter_transform.shape
print(f"MHR.from_files shape: {mhr_shape}")
# Output: torch.Size([889, 321])

pymomentum installed with pixi add pymomentum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions