Error with facebook/mms-tts-eng generation

username: sm226
cooked: <p>Traceback (most recent call last):<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/queueing.py”, line 495, in call_prediction<br>
output = await route_utils.call_process_api(<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py”, line 230, in call_process_api<br>
output = await app.get_blocks().process_api(<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/blocks.py”, line 1590, in process_api<br>
result = await self.call_function(<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/blocks.py”, line 1188, in call_function<br>
prediction = await utils.async_iteration(iterator)<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/utils.py”, line 502, in async_iteration<br>
return await iterator.<strong>anext</strong>()<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/utils.py”, line 495, in <strong>anext</strong><br>
return await anyio.to_thread.run_sync(<br>
File “/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py”, line 33, in run_sync<br>
return await get_asynclib().run_sync_in_worker_thread(<br>
File “/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py”, line 877, in run_sync_in_worker_thread<br>
return await future<br>
File “/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py”, line 807, in run<br>
result = context.run(func, *args)<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/utils.py”, line 478, in run_sync_iterator_async<br>
return next(iterator)<br>
File “/usr/local/lib/python3.10/dist-packages/gradio/utils.py”, line 661, in gen_wrapper<br>
response = next(iterator)<br>
File “”, line 249, in generate_voice<br>
sample_rate, audio = synthesise_speech(translated_temp, language)<br>
File “”, line 87, in synthesise_speech<br>
tts_output = tts_model(**inputs).waveform<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl<br>
return self._call_impl(*args, **kwargs)<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl<br>
return forward_call(*args, **kwargs)<br>
File “/usr/local/lib/python3.10/dist-packages/transformers/models/vits/modeling_vits.py”, line 1421, in forward<br>
text_encoder_output = self.text_encoder(<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl<br>
return self._call_impl(*args, **kwargs)<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl<br>
return forward_call(*args, **kwargs)<br>
File “/usr/local/lib/python3.10/dist-packages/transformers/models/vits/modeling_vits.py”, line 1218, in forward<br>
hidden_states = self.embed_tokens(input_ids) * math.sqrt(self.config.hidden_size)<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl<br>
return self._call_impl(*args, **kwargs)<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl<br>
return forward_call(*args, **kwargs)<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/sparse.py”, line 162, in forward<br>
return F.embedding(<br>
File “/usr/local/lib/python3.10/dist-packages/torch/nn/functional.py”, line 2233, in embedding<br>
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)<br>
RuntimeError: Expected tensor for argument <span class="hashtag-raw">#1</span> ‘indices’ to have one of the following scalar types: Long, Int; but got torch.FloatTensor instead (while checking arguments for embedding)</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="sm226" data-post="1" data-topic="196850">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/sm226/48/67570_2.png" class="avatar"> sm226:</div>
<blockquote>
<p>return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)<br>
RuntimeError: Expected tensor for argument <span class="hashtag-raw">#1</span> ‘indices’ to have one of the following scalar types: Long, Int; but got torch.FloatTensor instead (while checking arguments for embedding)</p>
</blockquote>
</aside>
<p>You are passing a floating point tensor to an <code>nn.Embedding</code> layer while an integer type is expected.</p>

username: sm226
cooked: <p>Thank you. Found the resolution.</p>

username: sanjit_pradhan
cooked: <p>I am also facing the same issue. What is the resolution ?</p>

username: ptrblck
cooked: <p>Pass the input to embedding layers as integer types, not floating point types.</p>