You could try to use
torch._C._jit_set_profiling_executor(False)
torch._C._jit_set_profiling_mode(False)

at the beginning of your script to disable the optimization.
However, how if your Flask application is running longer than a couple of seconds, the startup time could probably be ignored.