Conversion of a .pth model #34
Replies: 3 comments
-
Load it in torch and do torch.onnx.export
Long version in form of a tutorial: For codeformers specifically, the codebase you want to start from is here: https://github.com/sczhou/CodeFormer which is quite torch heavy (so is diffusers at times inside the pipelines). The part where it runs the codeformer model is in the loop that comes after "# face restoration for each cropped face". The setup of the net can found after "# ------------------ set up CodeFormer restorer -------------------" All the torch bits in there will either require you to: |
Beta Was this translation helpful? Give feedback.
-
Thanks for your answer, yes I already looked at that pages before asking for help, the main issue is to create the class for the onnx model, as (i understand), the pth only have the weights inside, defining the layers and operations....Using netron Ionly see modules and some variables info, and no addition info about how they connect....and that's my problem, how to define those class...I see my question was not an easy one. Sorry,currently too newbie at AI & python (2 months...) to understand those boxes....Until now I learnt looking at created code and disassembling it, and then looking for areas to modify or add other functions, i think I will need first to understand the underlaying structure and then try to go back at converting this model, will go for it.... |
Beta Was this translation helpful? Give feedback.
-
Sometime later, i found the time to learn about the conversion between some formats and how to get it done, i will try to get back to this, as i found other options for face restoration in the meantime... |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to figure out how to conver the Codeformer model from pth to onnx, someone got any ideas how to achieve it?
Beta Was this translation helpful? Give feedback.
All reactions