MMdnn icon indicating copy to clipboard operation
MMdnn copied to clipboard

Converting from tensorflow to pytorch

Open slala2121 opened this issue 4 years ago • 4 comments

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.

slala2121 avatar Aug 13 '20 19:08 slala2121

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?

zzb112233 avatar Oct 21 '20 08:10 zzb112233

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

On Wed, Oct 21, 2020 at 1:22 AM zzb112233 [email protected] 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 .

slala2121 avatar Oct 21 '20 16:10 slala2121

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

waleedrazakhan92 avatar Oct 22 '20 10:10 waleedrazakhan92

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 [email protected] 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 .

slala2121 avatar Oct 23 '20 07:10 slala2121