I'm trying to create a Sanic server for Nemo ASR. It seems Nemo uses some fork method, while Sanic requires spawn.
I've tried various ways to fix it but haven't been able to resolve the issue. I request experts to help me.
Code:
import nemo.collections.asr as nemo_asr
from sanic import Sanic
app = Sanic(__name__)
if __name__ == '__main__':
app.run(debug=True)
Error Message:
RuntimeError: Start method 'spawn' was requested, but 'fork' was already set.
Things I already tried, but nothing works:
import multiprocessing as mp
mp.set_start_method('spawn', force=True)
torch.multiprocessing.set_start_method('spawn', force=True)
try:
mp.set_start_method('spawn', force=True)
print("spawned")
except RuntimeError:
pass