title: DialoGPT output using pyttsx3?
body: <p>I want to use DialoGPT to have a conversation with me using a microphone and speaker.</p>
  <p>However, before I get there, I want to begin by somehow connecting this chat bot to a speaker using pyttsx3. I am able to properly use pyttsx3 to produce sound out of my computer speakers using pre inserted text (i.e. &quot;hello world&quot;).</p>
  <p>I am also able to use DialoGPT to have a conversation using the terminal.</p>
  <p>Therein lies the first issue of connecting the two. I have pasted my current code and was wondering if someone could offer me some assistance.</p>
  <pre><code>from transformers import AutoModelForCausalLM, AutoTokenizer
  import torch
  import pyttsx3
  engine = pyttsx3.init()
  
  # Set properties before adding
  # Things to say
  
  # Sets speed percent
  # Can be more than 100
  engine.setProperty('rate',190)
  # Set volume 0-1
  engine.setProperty('volume', 0.7)
  # Set ID of voice
  voice_id = &quot;com.apple.speech.synthesis.voice.karen&quot;
  
  # Use female voice
  engine.setProperty('voice', voice_id)
  
  
  tokenizer = AutoTokenizer.from_pretrained(&quot;microsoft/DialoGPT-large&quot;)
  model = AutoModelForCausalLM.from_pretrained(&quot;microsoft/DialoGPT-large&quot;)
  
  # Let's chat for 5 lines
  for step in range(5):
      # encode the new user input, add the eos_token and return a tensor in Pytorch
      new_user_input_ids = tokenizer.encode(input(&quot;&gt;&gt; User:&quot;) + tokenizer.eos_token, return_tensors='pt')
  
      # append the new user input tokens to the chat history
      bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step &gt; 0 else new_user_input_ids
  
      # generated a response while limiting the total chat history to 1000 tokens,
      chat_history_ids = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
  
      # pretty print last ouput tokens from bot
      engine.say(&quot;DialoGPT: {}&quot;).format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True))
  </code></pre>