Comments (3)
Ah, I see. The cond_stage_model.colorize
is actually not that important - it is only used for visualization purposes (to make the colorization of logged segmentation maps persistent). The main issue is then that cond_stage_model.colorize
is present in the provided weights but not in the model you are instantiating. If you look at
colorize_nlabels
is set. So if you simply add colorize_nlabels: 182
to https://github.com/ink1/taming-transformers/blob/master/configs/sflckr.yaml#L44 it should work. (in the sflckr_cond_stage.yaml
this parameter is named n_labels
as you have seen --- but in that case the model class is the VQSegmentationModel
instead of the VQModel
because it uses a different loss. Awkward that we use two different names for the same config parameter 🙄 ).
Finally, this shouldn't matter if you use model.params.ckpt_path=logs/2020-11-09T13-31-51_sflckr/checkpoints/last.ckpt
(or, equivalently, add ckpt_path: logs/2020-11-09T13-31-51_sflckr/checkpoints/last.ckpt
to the model.params
section of the config you are using, e.g. in line 5 of sflckr.yaml
) instead of -r logs/2020-11-09T13-31-51_sflckr/checkpoints/last.ckpt
on the command line, because it will then load the checkpoint non-strictly and simply ignore unexpected keys. See
from taming-transformers.
Hi @ink1,
the vqgan weights of both the first stage (encoding images) and the cond stage (encoding segmentations/depth/...) are actually part of the transformer checkpoints. We added a small script scripts/extract_submodel.py
such that you can now extract the sflckr segmentation map vqgan weights with
python scripts/extract_submodel.py logs/2020-11-09T13-31-51_sflckr/checkpoints/last.ckpt sflckr_cond_stage_model.ckpt cond_stage_model
Also added an example config for training a segmentation map cond stage in configs/sflckr_cond_stage.yaml
. If you want to finetune the extracted weights you can adjust the data
section of that config and then run
python main.py --base configs/sflckr_cond_stage.yaml -t True --gpus 0, model.params.ckpt_path=sflckr_cond_stage_model.ckpt
Best
Patrick
from taming-transformers.
Much appreciated, Patrick! This is all great!
Due to a lack of compute budget I'm trying to leverage your models as much as I can. I do understand that both vqgan models (image and segmentation) are inside of the sflckr checkpoint.
My main problem is when I'm trying to resume from it, I hit
RuntimeError: Error(s) in loading state_dict for Net2NetTransformer:
Unexpected key(s) in state_dict: "cond_stage_model.colorize".
My understanding is that this is the top layer conditionally added to vqgan models.
The condition is the presence of a particular parameter, probably this one
https://github.com/CompVis/taming-transformers/blob/master/configs/sflckr_cond_stage.yaml#L8
But when I tried adding it to sflkr yaml after this line
https://github.com/ink1/taming-transformers/blob/master/configs/sflckr.yaml#L44
it gets rejected. This is why I thought if I load both vqgan models explicitly, I'll be in control.
The funny thing is, on restart after the error above, the sflkr model gets shrunk to under 2 GB (but I provide vqgan image model from its checkpoint) and a subsequent restart works fine. What's even more interesting is that the checkpoints are 4 GB again.
I strongly suspect, I just can't get my configuration straight.
I'm also curious if colorization of segmentation is persistent across runs.
Thanks again @pesser
from taming-transformers.
Related Issues (20)
- How to do image inpainting with vqgan?
- How to train the transformer after training the vqgan model? HOT 9
- If my condition is class label, how to set config file
- Cannot use gpu to fine-tune on custom-data HOT 2
- gpu training hangs HOT 2
- Where is the model trained on my custom data? HOT 1
- When I train, the code is getting slower and slower, is it normal? HOT 1
- README Error -- yaml path
- Dockerfile/environment.yaml for CUDA Version 12.3? HOT 5
- 'VQModel' object has no attribute 'transformer'
- How to train your own Transformer
- How to distinguish sos token(default = 0) and quantified image token zero ?
- How to use the sliding attention window mechanism? HOT 3
- Is there a plan to upgrade this repo to Pytorch 2.0
- ModuleNotFoundError: No module named 'cutlit'
- ncc HOT 1
- Confusion about the dimension of latent vectors
- generate white images during training HOT 1
- : Parameter indices which did not receive grad for rank 0: 338 339 340 341 342 343 344 345 346 347 348 349 350 HOT 3
- A question regarding the embed_dim parameter in the config file.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taming-transformers.