Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "type object argument after ** must be a mapping" error in image generation #77

Open
pragnakalpdev7 opened this issue Mar 10, 2021 · 6 comments

Comments

@pragnakalpdev7
Copy link

Hi, @lucidrains,

We have trained the model using OpenAIs pretrained VAE. We have use the train_dalle.py file for training.
python train_dalle.py --image_text_folder=./dataset_images

After training, we have tried to generate the result using the saved model by following command.
python generate.py --dalle_path=/content/DALLE-pytorch/dalle-final.pt --text='bird has wings that are brown and has a red crown' --num_images=20

On running the above command we are facing the error:
Traceback (most recent call last): File "generate.py", line 55, in <module> vae = DiscreteVAE(**vae_params) TypeError: type object argument after ** must be a mapping, not NoneType

@lucidrains
Copy link
Owner

@pragnakalpdev7 oops! has been fixed! e1a847c

@pragnakalpdev7
Copy link
Author

Thank you for the quick response @lucidrains ,

We have already tried the changes suggested by you, in which facing below error :
Traceback (most recent call last): File "generate.py", line 65, in <module> dalle = DALLE(vae = vae, **dalle_params).cuda() TypeError: type object got multiple values for keyword argument 'vae'

@afiaka87
Copy link
Contributor

afiaka87 commented Mar 11, 2021

@pragnakalpdev7 removing this line should do the trick. The vae will get passed in properly later on.

vae = vae,

edit: Oh i'm sorry i confused your issue with one I was having in train_dalle.py. I'm not seeing the same bug in generate but can't run it myself currently.

@afiaka87
Copy link
Contributor

afiaka87 commented Mar 11, 2021

Again, can't verify myself but if you're using a pretrained VAE (OpenAIDiscreteVAE, for instance), then I believe that the value for 'vae' will actually be none. The dictionary **dalle_params may contain the vae definition. As such, you can just remove that argument from your call to DALLE:

dalle = DALLE(**dalle_params).cuda()

Does that work?

@pragnakalpdev7
Copy link
Author

Hello @afiaka87,

We have already tried this trick, but not getting good results. We think maybe we are missing something.

@lucidrains
Copy link
Owner

@pragnakalpdev7 one more patch! f2b02ba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants