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

code error: AssertionError: assert T > 0 #154

Open
hjc3613 opened this issue Nov 15, 2024 · 0 comments
Open

code error: AssertionError: assert T > 0 #154

hjc3613 opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@hjc3613
Copy link

hjc3613 commented Nov 15, 2024

Backend impacted

The PyTorch implementation

Operating system

Linux

Hardware

CPU

Description

when I debug the code bellow copied from the readme file(moshi/README.md):

wave, sample_rate = torch.randn(1, 1, 24000 * 10), mimi.sample_rate
with torch.no_grad():
    codes = mimi.encode(wav)  # [B, K = 8, T]
    decoded = mimi.decode(codes)
    # save_as_mp3(decoded.numpy().squeeze(), sample_rate, audio_path.replace('.mp3', '_decoded.wav'))
    # Supports streaming too.
    frame_size = int(mimi.sample_rate / mimi.frame_rate)
    all_codes = []
    with mimi.streaming(batch_size=1):
        for offset in range(0, wav.shape[-1], frame_size):
            frame = wav[:, :, offset: offset + frame_size]
            codes = mimi.encode(frame)
            assert codes.shape[-1] == 1, codes.shape
            all_codes.append(codes)

I got the error:
image

what is the reason? how to solve it ?
I guess it's because of the last frame's shape is not the same as which before it. the last frame shape is : [1,1,363], others is [1,1,1920]

image

Extra information

I only cloned the repo, download the moshi weights, and run the test code from readme.md, I do not modify anything

Environment

Fill in the following information on your system.

  • Operating system version:
    image

If the backend impacted is PyTorch:

  • Python version:3.12
  • PyTorch version:

image

  • Only runing in CPU
@hjc3613 hjc3613 added the bug Something isn't working label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant