w-okada / voice-changer

リアルタイムボイスチェンジャー Realtime Voice Changer
Other
16.1k stars 1.75k forks source link

[ISSUE]: (Linux, AMD, Anaconda) Server only goes online when just installed and never again #1231

Open orangesandblast opened 3 months ago

orangesandblast commented 3 months ago

Voice Changer Version

v.1.5.3.18a ? (cloned from current repository as of this post)

Operational System

Gentoo Linux

GPU

Radeon RX 6700 XT

Read carefully and check the options

Model Type

MMVC

Issue Description

I assume that MMVC is the model type because that's in the filename of MMVCServerSIO.py.

Summary: The server starts properly the first time I install and run it. I can visit localhost with my browser and see the GUI, although I have a separate problem there that I will investigate further once I can resolve this issue. (sample models fail to load.) After I interrupt the server with Ctrl+C (and kill the python process if necessary), from then on if I restart the server then it seems to work normally according to the console, but the browser doesn't recognize the address, as if I weren't running the server. (ERR_CONNECTION_REFUSED.) This will also happen if I reboot my computer and immediately run the server: it still can't connect.

Details: As you can see in the log, there is an error message regarding to "fairseq," but that error is also in the log the first time I run the server after installation and the GUI works fine, so I'm not sure if that's directly related to this particular issue. Does the codepath that runs when it downloads files for the first time ignore the error, but not ignore it if the files already exist? If that's not related, then the console doesn't seem to give any clues to me as to why this is happening.

I followed the directions here: https://github.com/w-okada/voice-changer/blob/master/tutorials/tutorial_anaconda_amd_rocm.md When I create a new environment for the voice changer, activate it, install the dependencies, and start the server for the first time, it downloads some files and then works properly to some extent (I can at least see the GUI when I visit localhost, and hear my own voice with passthrough.) It doesn't load sample models properly, but I'm not sure if that's related.

After this first run after installation, further runs of the server seem to run without terminating, but visiting localhost in my browser does nothing. I tried reinstalling the conda environment and encountered the same issue: it works "properly" again one time and then never again, even after rebooting.

Application Screenshot

No response

Logs on console

    Booting PHASE :__main__
    PYTHON:3.10.9 (main, Mar  8 2023, 10:47:38) [GCC 11.2.0]
    Activating the Voice Changer.
[Voice Changer] download sample catalog. samples_0004_t.json
[Voice Changer] download sample catalog. samples_0004_o.json
[Voice Changer] download sample catalog. samples_0004_d.json
[Voice Changer] model_dir is already exists. skip download samples.
    Internal_Port:18888
    protocol: HTTP
    -- ---- -- 
    Please open the following URL in your browser.
    http://<IP>:<PORT>/
    In many cases, it will launch when you access any of the following URLs.
    http://localhost:18888/
    Booting PHASE :__mp_main__
    The server process is starting up.
    Booting PHASE :MMVCServerSIO
[Voice Changer] VoiceChangerManager initializing...
[Voice Changer] model slot is changed -1 -> 4
................RVC
Process SpawnProcess-1:1:
Traceback (most recent call last):
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/uvicorn/server.py", line 59, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/uvicorn/server.py", line 66, in serve
    config.load()
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/uvicorn/config.py", line 471, in load
    self.loaded_app = import_from_string(self.app)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/uvicorn/importer.py", line 24, in import_from_string
    raise exc from None
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/home/x/anaconda3/envs/voicechanger/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/hdde/voice/voice-changer/server/MMVCServerSIO.py", line 142, in <module>
    voiceChangerManager = VoiceChangerManager.get_instance(voiceChangerParams)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 131, in get_instance
    cls._instance = cls(params)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 94, in __init__
    self.update_settings("modelSlotIndex", self.stored_setting["modelSlotIndex"])
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 348, in update_settings
    self.generateVoiceChanger(newVal)
  File "/hdde/voice/voice-changer/server/voice_changer/VoiceChangerManager.py", line 256, in generateVoiceChanger
    from voice_changer.RVC.RVCr2 import RVCr2
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/RVCr2.py", line 12, in <module>
    from voice_changer.RVC.embedder.EmbedderManager import EmbedderManager
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/embedder/EmbedderManager.py", line 5, in <module>
    from voice_changer.RVC.embedder.FairseqContentvec import FairseqContentvec
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/embedder/FairseqContentvec.py", line 3, in <module>
    from voice_changer.RVC.embedder.FairseqHubert import FairseqHubert
  File "/hdde/voice/voice-changer/server/voice_changer/RVC/embedder/FairseqHubert.py", line 4, in <module>
    from fairseq import checkpoint_utils
ModuleNotFoundError: No module named 'fairseq'
orangesandblast commented 3 months ago

So I looked through a few older github issues for clues, and the most relevant one to the original question seems to be deleting stored_setting.json so that it's remade when I restart the server. This does indeed allow me to restart the server without having to reinstall the entire conda environment. I'm not sure if this is intended, but the contents of stored_setting.json list a very large value for modelSlotIndex. It seems like having attempted to load a sample model (and as a result encountering an error) is saved in stored_setting.json and prevents the server from starting ever again until this file is deleted. (Clicking on "Clear setting" after reloading the page doesn't help.)

So it seems like my issue is not entirely separate from the one that causes loading the sample models to crash, so I will make a new issue for that soon. But, it still seems undesirable for a crash like this to brick the program until the settings file is deleted, so I don't think this issue should be closed either.