Is it possible to fine-tune a tensorflow model using pre-trained model from pyTorch?

Viewed 36

What I tried so far:

  1. pre-train a model using unsupervised method in PyTorch, and save off the checkpoint file (using torch.save(state, filename))
  2. convert the checkpoint file to onnx format (using torch.onnx.export)
  3. convert the onnx to tensorflow saved model (using onnx-tf)
  4. trying to load the variables in saved_model folder as checkpoint in my tensorflow training code (using tf.train.init_from_checkpoint) for fine-tuning

But now I am getting stuck at step 4 because I notice that variables.index and variables.data@1 files are basically empty (probably because of this: https://github.com/onnx/onnx-tensorflow/issues/994)

Also, specifically, if I try to use tf.train.NewCheckpointReader to load the files and call ckpt_reader.get_variable_to_shape_map(), _CHECKPOINTABLE_OBJECT_GRAPH is empty

Any suggestions/experience are appreciated :-)

0 Answers
Related