t41372 / Open-LLM-VTuber

Talk to any LLM with fast hands-free voice interaction, Live2D taking face, and long-term memory running locally across platforms
MIT License
242 stars 21 forks source link

Divided by zero error. #6

Closed Mayonezyck closed 1 month ago

Mayonezyck commented 1 month ago
>> 'scram lamb cramp ram toyota yoda buldak donut'

generate...
stream...
Error initializing: division by zero
Traceback (most recent call last):
  File "/home/scram-2004/Project/Open-LLM/launch.py", line 230, in <module>
    interaction_mode(llm, speech2text, tts)
  File "/home/scram-2004/Project/Open-LLM/launch.py", line 126, in interaction_mode
    callLLM(user_input, llm, tts)
  File "/home/scram-2004/Project/Open-LLM/launch.py", line 201, in callLLM
    result = llm.chat_stream_audio(
  File "/home/scram-2004/Project/Open-LLM/llm/memGPT.py", line 109, in chat_stream_audio
    last_stream_future.result()
  File "/home/scram-2004/anaconda3/envs/openllm/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/home/scram-2004/anaconda3/envs/openllm/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/home/scram-2004/anaconda3/envs/openllm/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/scram-2004/Project/Open-LLM/launch.py", line 180, in stream_audio_file
    stream_audio.StreamAudio(
  File "/home/scram-2004/Project/Open-LLM/tts/stream_audio.py", line 37, in __init__
    self.__getVolumeByChunks()
  File "/home/scram-2004/Project/Open-LLM/tts/stream_audio.py", line 48, in __getVolumeByChunks
    self.volumes = [volume/self.maxNum for volume in self.volumes]
  File "/home/scram-2004/Project/Open-LLM/tts/stream_audio.py", line 48, in <listcomp>
    self.volumes = [volume/self.maxNum for volume in self.volumes]
ZeroDivisionError: division by zero

Interestingly this appears when the tts is trying to say this line. I'm using Memgpt with Ollama, local embedding Not sure what makes self.max 0

t41372 commented 1 month ago

Is >> 'scram lamb cramp ram toyota yoda buldak donut' your input or the LLM's response?

My first reaction is that MemGPT is probably outputting nothing. Sometimes, MemGPT will output nothing with local models, presumably because of the limited function calling capability of smaller models like llama3. I encountered the issue a while back where MemGPT didn't give me a response when using the local model (check the MemGPT WebUI to see if this is your case), which makes all of the volume 0 (and therefore the max volume zero as well). I thought I added a check, but apparently, I didn't.

However, if 'scram lamb cramp ram toyota yoda buldak donut' is indeed the response from the LLM, there might be a problem with the TTS where the TTS is generating silent audio.

Well, there is also a possibility that I accidentally broke this thing without notice when I added Chinese support for this program a couple of days ago by changing some parts related to how the sentence was split...

Anyway. I just added some checks to ensure the empty response will be ignored and not generate audio. The issue should be resolved. Thanks a lot for letting me know though.

Mayonezyck commented 1 month ago

Awesome! Thank you for your work on this! 'scram lamb cramp ram toyota yoda buldak donut' is actually the response from LLM. I will keep you updated with any other issue.