Open shadow2496 opened 1 year ago
From a brief comparison, the config and code seem to match the version I used for training the cats.
The only difference I can think of is the seed, or the set (there's a link to our full sets in the repo's readme, you can find them here: https://drive.google.com/drive/folders/1fmJMs25nxS_rSNqS5hTcRdLem_YQXbq5). I'll retrain to make sure there's no issue. In the meanwhile just to make sure: are you using the same batch size? There's an auto-scaling of learning rates according to the size of the batch, this might also be impacting the results.
Oh, didn't know I should use all 7 images in the 'cat_statue' folder. I'll retrain as well. And the batch size was 4 by default, which matches the paper.
Another question. For the inversion of the concepts other than 'cat_statue', did you also use all of the images in the corresponding google drive folder, not just the ones shown in the figure?
Indeed. We note in some places in the paper that the figures show only exemplars from the full sets, but I'll make a note to better highlight it when we upload a revision. Regardless, you have the full sets in that drive.
Some of the sets have associated copyrights so I didn't upload them, but if there's any particular set which is not up and you want the images for, let me know and I'll send it to you.
Here we go:
Checkpoint: cat_26_09.zip
a painting of a * riding a dragon
a * themed lunchbox
banksy art of *
a photo of *
painting of two * fishing on a boat
I'm using the default seed (23). That said, I didn't clone a fresh repo and I have some local code changes (this path doesn't enter them, but they might be changing seeding results). Let me know if you still can't get it to work with the full set and I'll re-run on a fresh clone and also give you a seed so you can verify yourself.
Well, I retrained with the full set and these are the results I get.
Still, my results need some improvements. Could you try the inversion on the fresh clone and see if the paper results are reproducible?
Sure. Is the main.py change above the only adjustment you made? I'll do the same locally to make sure I'm getting your results with the default seed.
Thank you. The adjustments are the main.py change above, and I deleted the code below in SetupCallback.on_pretrain_routine_start() due to some file-saving errors while running on multiple GPUs. Also, I added a seed argument in scripts/txt2img.py
.
else:
# ModelCheckpoint callback created log directory --- remove it
if not self.resume and os.path.exists(self.logdir):
dst, name = os.path.split(self.logdir)
dst = os.path.join(dst, "child_runs", name)
os.makedirs(os.path.split(dst)[0], exist_ok=True)
try:
os.rename(self.logdir, dst)
except FileNotFoundError:
pass
Just a heads up that I haven't forgotten you. I'm also seeing an issue with a fresh install of everything + your modifications + new environment from scratch.
I'm trying to track down the difference, but I'm doing a bunch of things in parallel so it might take a few days.
If you need this urgently and want me to send you the closest image of the code to when we ran this experiment, let me know. I ran that version on 2-3 seeds and it seems fine.
@rinongal
Thanks for sharing your checkpoint. Your example above made it crystal clear.
Just a note, using the latest from rinongal/textual_inversion.git
on the main
branch does not support the seed
CLI arg.
txt2img.py: error: unrecognized arguments: --seed 97
Without that arg, it works great.
Is there a different branch for using seed
via cli?
No different branch using seed via CLI but it's trivial to add. You just copy the seed code from the stable_txt2img.py (adding it to the parser + the import / call to seed_everything
). If you need help with that let me know and I'll update the repo.
@rinongal It would be great if I could use your code. If you don't mind, could you send it to dadadak4@gmail.com?
Sent. If anyone else needs the same code version before a fix is out, please let me know.
@rinongal Thank you very much.
So the current code is unable to get the same editability? why is that ? Will the code get an update to fix this ?
@1blackbar Still trying to find where the issue stems from. At the moment this seems like an LDM-only issue, which likely came about when I added the partial SD support. I'm adding back my changes one-by-one to see where things break, but it's a lengthy process.
@rinongal I tried to find the cause on my end, and aside from the training templates, the training seems sensitive to the PIL version. Which PIL version did you use for the training?
@shadow2496 Training templates do not appear to be the source. It was the first thing I verified when I pulled the old code.
I've got one environment running pillow 9.1.1, and one running 9.0.1. I'm not seeing meaningfully different results in one compared to the other.
Hmm, I couldn't find other differences that affect the training than the conda environment and the training templates from the code you sent. The problem is I can't reproduce the results even from your code. Maybe the issue comes from using different GPUs? (I'm using TITAN RTX)
Just to make sure the difference in conda environments is not an issue, could you send the yaml file from the conda env export > environments.yaml
command?
environments_freeze.txt Here you go. I changed the extension to .txt. since github won't let me upload a yaml. Just swap it back.
And here's the settings from the original run that produced the paper results. It's using 4 workers, but the checkpoint I sent here was made using 2 so that shouldn't be an issue.
cat2022-07-03T12-29-05-project.txt
I'm honestly still not sure what's causing the discrepancy here. I'll try setting things up in a colab so we can make sure we're getting synchronized results and work from there.
@shadow2496 do you succeed to reproduce the result.? I met the same problem with you ..
@rinongal one more question: in the enviroments_freeze.txt you provide above, transformers==4.3.1 but in https://github.com/rinongal/textual_inversion/blob/main/environment.yaml, transformers==4.18.0 which one is correct
@CrossLee1 The enviroments_freeze.txt above is the one I used locally to train the cat checkpoint in the beginning of this thread. The one in the repo is just updated to reflect Stable-Diffusion requirements. Unfortunately, we made quite a few changes to add support for SD and since training here is seed sensitive, these tend to impact the results as well.
I'm trying to find the time to look deeper into this or set up a colab where I can search for a seed that gives close results in a shared, consistent environment. Unfortunately I'm a bit bogged down with other things so until I get around to that, 'seed sensitivity' is the best answer I can give you.
@CrossLee1 The enviroments_freeze.txt above is the one I used locally to train the cat checkpoint in the beginning of this thread. The one in the repo is just updated to reflect Stable-Diffusion requirements. Unfortunately, we made quite a few changes to add support for SD and since training here is seed sensitive, these tend to impact the results as well.
I'm trying to find the time to look deeper into this or set up a colab where I can search for a seed that gives close results in a shared, consistent environment. Unfortunately I'm a bit bogged down with other things so until I get around to that, 'seed sensitivity' is the best answer I can give you.
@shadow2496 @CrossLee1 do you succeed to reproduce the result? I met the same problem with you .
Hi, I'm trying to reproduce the paper results, especially the 'cat_statue' concept below in Figure 1, but it seems like extra information is needed to do that.![image](https://user-images.githubusercontent.com/17617775/192135426-35cefa6b-22ec-4695-94fe-c40a629d459d.png)
Inversion and Generation Settings
I'll describe my settings first.
Change in 'main.py': 'torch.backends.cudnn.deterministic = True' was added for reproducibility.
Generation Results
With the inversion and generation settings, I could obtain the results below. (up: my results, down: results from the supplementary)
Questions
As you can see, my results are quite different from the ones in the paper. My questions are as follows.