microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.8k stars 965 forks source link

Converting from tensorflow to pytorch #885

Open slala2121 opened 4 years ago

slala2121 commented 4 years ago

Platform (like ubuntu 16.04/win10): ubuntu 16.04

Python version: 3

Source framework with version (like Tensorflow 1.4.1 with GPU): Tensorflow 1.15.0

Destination framework with version (like CNTK 2.3 with GPU): Pytorch 1.6.0

Since the models under Tensorflow 1.11+ are saved as .meta, .index, .data, how can tf to IR step (https://github.com/Microsoft/MMdnn/issues/22) here be modified for this type of saved model format? Seems like .ckpt is used for TensorflowParser._load_weights but this is not available under this version.

zzb112233 commented 4 years ago

Platform (like ubuntu 16.04/win10): ubuntu 16.04

Python version: 3

Source framework with version (like Tensorflow 1.4.1 with GPU): Tensorflow 1.15.0

Destination framework with version (like CNTK 2.3 with GPU): Pytorch 1.6.0

Since the models under Tensorflow 1.11+ are saved as .meta, .index, .data, how can tf to IR step (#22) here be modified for this type of saved model format? Seems like .ckpt is used for TensorflowParser._load_weights but this is not available under this version.

Hello,have you solved this problem?

slala2121 commented 4 years ago

No but the issue can be closed since I found a workaround.

On Wed, Oct 21, 2020 at 1:22 AM zzb112233 notifications@github.com wrote:

Platform (like ubuntu 16.04/win10): ubuntu 16.04

Python version: 3

Source framework with version (like Tensorflow 1.4.1 with GPU): Tensorflow 1.15.0

Destination framework with version (like CNTK 2.3 with GPU): Pytorch 1.6.0

Since the models under Tensorflow 1.11+ are saved as .meta, .index, .data, how can tf to IR step (#22 https://github.com/microsoft/MMdnn/issues/22) here be modified for this type of saved model format? Seems like .ckpt is used for TensorflowParser._load_weights but this is not available under this version.

Hello,have you solved this problem?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/MMdnn/issues/885#issuecomment-713398340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3GCFRH6GYG3LVXZN6PG2LSL2K57ANCNFSM4P6YX3JA .

waleedrazakhan92 commented 4 years ago

No but the issue can be closed since I found a workaround. can you share the workaround?

slala2121 commented 4 years ago

I just loaded the weights using the tf graph. Then I wrote a script to map those weights to a corresponding pytorch graph. You can do this by inspecting the tf graph via tensorboard.

On Thu, Oct 22, 2020 at 3:59 AM waleedrazakhan92 notifications@github.com wrote:

No but the issue can be closed since I found a workaround. … <#m-8538388121266979976> can you share the workaround?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/MMdnn/issues/885#issuecomment-714413209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3GCFQB3N7Q6JYTEL2ENE3SMAGBRANCNFSM4P6YX3JA .