TheFoundryVisionmongers / nuke-ML-server

A Nuke client plug-in which connects to a Python server to allow Machine Learning inference in Nuke.
Apache License 2.0
135 stars 34 forks source link

Support multiple instances of a model in the same Nuke script #21

Open ldmoser opened 3 years ago

ldmoser commented 3 years ago

I just realized that if I instantiate more than one MLClient node for my custom class it seems that both Nuke nodes will talk to the a single instance of my BaseModel-derived class on the server side. I was hoping that each instance of my BaseModel class would somehow be associated with one nuke node, so I could do things like, keep a reference to a pre-trained model and re-use it for each new input. But now, it seems like I would have to keep in my BaseModel-derived class some notion of cache that keeps alive any model that the user is using in that same Nuke script.. For example, let's say the user is comparing the outputs of two pre-trained models. Would it be possible to send messages to the server when nodes are removed/added so that cache can purge some items? Or better yet, would it be possible for the Server to instantiate one BaseModel object per nuke node?