deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.12k stars 654 forks source link

Can I load a pytorch pretrained model, and use its block to replace one in my network? #3278

Open kobe2000 opened 4 months ago

kobe2000 commented 4 months ago

I want to embed the block inside my network

frankfliu commented 4 months ago

Yes, you can do that.

See: https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/training/transferlearning/TransferFreshFruit.java#L71-L89