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

Fixed CoW RuntimeError in DecodingTask.run() #240

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

CorentinJ
Copy link
Contributor

@CorentinJ CorentinJ commented Oct 4, 2022

To reproduce:

import whisper
import torch

model = whisper.load_model("tiny", device="cuda")
options = whisper.DecodingOptions(without_timestamps=True, fp16=True)
mels = torch.randn(10, 80, 3000, device="cuda")
with torch.no_grad():
    outputs = model.decode(mels, options)

Gives

tokens[:, self.sot_index + 1] = lang_tokens  # write language tokens
RuntimeError: unsupported operation: more than one element of the written-to tensor refers to a single memory location. Please clone() the tensor before performing the operation.

Replacing the expand by a repeat (or calling clone() after expand) solves the issue

@jongwook jongwook merged commit 9e653bd into openai:main Oct 4, 2022
@jongwook
Copy link
Collaborator

jongwook commented Oct 4, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants