So I have been working on a multi agent system with langgraph and so far everything has been doing great when working on single agent graphs. For RAG I use CLIP embedding model for retrieval, but the issue that i have been getting is related to model loading.
You see I am working on a supervisor system, where a main agent calls different sub agents. When one of these sub agents is called and is about to load the CLIP model (which has been loaded previously due to the main supervisor agent needing it and worked fine) from the sub agent tools, it gives me this error.
I do have the model downloaded I checked multiple times and works normally, I just can’t find how I can load it?
also yes i did try loading it elsewhere and importing it but my constants are fully reset.
I also tried using multiprocessing Manager but that returned the same error, and if i add the if __name__ == "__main__" condition it never goes into it.
I am completely lost on what to do at this point. I would appreciate python multiprocessing experts to help me here, especially since LangGraph is the one responsible for creating the sub processes, so I couldn’t “use fork” as the error suggests.
Exception has occurred: OSError
Can't load the model for 'openai/clip-vit-base-patch32'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-base-patch32' is the correct path to a directory containing a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
To fix this issue, refer to the "Safe importing of main module"
section in https://docs.python.org/3/library/multiprocessing.html
It seems that there are cases of simple bugs and cases of difficult specifications. The former can probably be fixed with a pip update for Transformers, but the latter seems to be a problem at the PyTorch level, and it seems that it is quite difficult to solve or that it will not go smoothly.