I’m trying to have my Python node load some pretrained PyTorch weights hosted on a KNIME Hub server. As you know, KNIME currently has poor PyTorch support. I’m aware of people using the following workarounds, but I ran into problems with each one:
- Convert the PyTorch weights into ONNX format and then back again - First of all, PyTorch has poor support for converting ONNX files back into PyTorch models. Secondly, my models have many features from other deep learning libraries, that would be lost during the conversion.
- Use the URL to File Path (Variable) Node as suggested in this thread - this approach only applies to locally hosted files identified by a URL
-
Fetch the weight files from the Python Node directly using a URL, i.e. using
torch.hub.load_state_dict_from_url("/http/url/to/hosted/weight/files/")
- I get a HTTP 403 Access Denied Error when using the https:// url, and the function doesn’t recognize a knime:// url. -
I successfully managed to convert a directory of PyTorch weights on the server into a table of binary objects, using the following setup. However, I’m stuck on how to convert the binary objects into PyTorch weights or models.