Instructions to use facebook/hf-seamless-m4t-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/hf-seamless-m4t-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="facebook/hf-seamless-m4t-large")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("facebook/hf-seamless-m4t-large") model = AutoModel.from_pretrained("facebook/hf-seamless-m4t-large", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Error in getting text
TypeError: argument 'ids': 'list' object cannot be interpreted as an integer
Same issue.
Hey @Longbo, same question, do you have a script to reproduce the issue?
it was an error from my side only
below is the correct code
translated_text_from_text = processor.decode(output_tokens[0].tolist()[0], skip_special_tokens=True)
No, this code is not work.
Can u share your complete code?
where to find the spkr_id for target lang
use any no. between 1-10 fro spkr id , i.e spkr_id =1
text_inputs = processor(text = prompt, src_lang=src_lang, return_tensors="pt")
output_tokens = model.generate(**text_inputs, tgt_lang=tgt_lang, generate_speech=False)
translated_text_from_text = processor.decode(output_tokens[0].tolist(), skip_special_tokens=True)
argument 'ids': 'list' object cannot be interpreted as an integer
Issue: Incorrect example in the model page. output_tokens[0].tolist() should be output_tokens[0].tolist()[0] in translated_text_from_text.
Solution: fix example!