# How to export a Flux model to Python?

**URL:** <https://discourse.julialang.org/t/how-to-export-a-flux-model-to-python/101750>\
**Category:** Machine Learning\
**Tags:** flux\
**Created:** [July 18, 2023, 7:51pm UTC](https://discourse.julialang.org/t/how-to-export-a-flux-model-to-python/101750 "2023-07-18T19:51:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcsgil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcsgil/32/33908_2.png) [@marcsgil](https://discourse.julialang.org/u/marcsgil)\
**Post date:** [July 18, 2023, 7:51pm UTC](https://discourse.julialang.org/t/how-to-export-a-flux-model-to-python/101750/1 "2023-07-18T19:51:52Z")

</div>

Hello!

I have a trained models from Flux.jl which I would like to be able to use in Python. Is there a way to save these models in a format that would be easily readable by Pytorch or Tensorflow?

Thanks!

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 18, 2023, 8:18pm UTC](https://discourse.julialang.org/t/how-to-export-a-flux-model-to-python/101750/2 "2023-07-18T20:18:58Z")

</div>

nope. Your best bet is ONNX but IIRC there’s no support for writing from Julia side at the moment

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [July 19, 2023, 5:17am UTC](https://discourse.julialang.org/t/how-to-export-a-flux-model-to-python/101750/3 "2023-07-19T05:17:23Z")

</div>

There is, the problem is that the Python libraries can’t read it back in.

Back to the original question, the answer varies greatly depending on whether you’re using TF or PyTorch (i.e. almost no overlap) and whether you want just the weights or a full model specification.
