Hi there,i'm trying to export VALL-E model into ONNX.
To achieve this goal,i have done these things:
First,i extract the promptlang2id() and textlang2id() functions like below:
import numpy as np
import torch
from typing import List,Union
language_ID = {
'en': 0,
'zh': 1,
'ja': 2,
}
def promptlang2id(prompt_lang:str):
return torch.LongTensor(
np.array([language_ID[prompt_lang]])).to(
torch.device('cuda')
)
def textlang2id(text_lang:Union[List,str]):
if isinstance(text_lang, str):
return torch.LongTensor(
np.array([language_ID[text_lang]])).to(
torch.device('cuda')
)
elif isinstance(text_lang,List):
return torch.LongTensor(
np.array([language_ID[tl] for tl in text_lang])).to(
torch.device('cuda')
)
Second,to let VALL-E model more focus on Tensor Processing,i modified the inference() function of VALL-E model like below to make it only accept numerical parameters:
So here is the all reproduce steps,it raise the error:
File "/home/elin/anaconda3/envs/valle/lib/python3.10/site-packages/torch/nn/functional.py", line 2237, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
TypeError: embedding(): argument 'indices' (position 2) must be Tensor, not tuple
Is there any wrong with my sample input Tensors or something?
Hi there,i'm trying to export VALL-E model into ONNX. To achieve this goal,i have done these things: First,i extract the
promptlang2id()
andtextlang2id()
functions like below:Second,to let VALL-E model more focus on Tensor Processing,i modified the
inference()
function of VALL-E model like below to make it only accept numerical parameters:Third,i have write an ONNX exportation script like:
So here is the all reproduce steps,it raise the error:
Is there any wrong with my sample input Tensors or something?