I am trying to invoke a separate thread, running in parallel to the actual script, but each time, the script is about to execute its main method, it fails with this error :
_init_model took 13.0407 sec or 13040.70 ms
Traceback (most recent call last):
  File "c:\Users\User\Anaconda3\Lib\site-packages\QRTC\QRTC_testbed.py", line 49, in <module>
    start()
  File "c:\Users\User\Anaconda3\Lib\site-packages\QRTC\QRTC_testbed.py", line 27, in start
    QRTC = FaceVerification(**cfg['Kara']['ARGS'], threshold=65)
  File "C:\Users\User\Anaconda3\lib\site-packages\QRTC\Core.py", line 150, in __init__
    self.dispatcher_executer.start()
  File "C:\Users\User\Anaconda3\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "C:\Users\User\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\User\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\User\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Users\User\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
  File "C:\Users\User\Anaconda3\lib\site-packages\torch\jit\__init__.py", line 1755, in __getstate__
    "Mixed serialization of script and non-script modules is not supported. " +
_pickle.PickleError: ScriptModules cannot be deepcopied using copy.deepcopy or saved using torch.save. Mixed serialization of script and non-script modules is not supported. For purely script modules use my_script_module.save(<filename>) instead.
Destructor called!
PS C:\Users\User\Anaconda3\Lib\site-packages\QRTC> C:\Users\User\Anaconda3\lib\site-packages\QRTC\Core.py:367: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  def _save_jit_optimized_model(self, dummy_input=torch.tensor(torch.rand(size=(1,3,112,112)))):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\User\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\User\Anaconda3\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input

All I did was simply to instatiate a new multiprocessing.porcess in the constructor, after the _init_model  is done . sth like this :
class QRTC():
    def __init__(self, arg1, arg2, etc):
        .....
        self._init_model()
        # after all is done, instantiate this
        self.dispatcher_executer = torch_multiprocessing.multiprocessing.Process(target=self.execute_dispatcher_callbacks) 
        self.dispatcher_executer.start()

Why am I seeing this, in self.execute_dispacther_callbacks I’m dealing with pure python and nothing torch related, so its very wierd to me why this is happenning.
The intresting part here is that using Threading.thread doesnt produce any errors at all!
By the way, if do the initialization after I instantiate and start my process, everything seem to be fine!
Any help is greatly appreciated