harubaru / waifu-diffusion

stable diffusion finetuned on weeb stuff
GNU Affero General Public License v3.0
1.94k stars 177 forks source link

TypeError: int() argument must be a string, a bytes-like object or a number, not 'list' #57

Open zakinp opened 1 year ago

zakinp commented 1 year ago

i got this problem when using "diffusers_trainer.py":

Exception caught on rank 0 at step 10, saving checkpoint... int() argument must be a string, a bytes-like object or a number, not 'list' Traceback (most recent call last): File "/root/waifu-diffusion/trainer/diffusers_trainer.py", line 953, in main prompt = tokenizer.decode(batch['tokens'][random.randint(0, len(batch['tokens'])-1)]) File "/root/miniconda3/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 3367, in decode return self._decode( File "/root/miniconda3/lib/python3.8/site-packages/transformers/tokenization_utils.py", line 931, in _decode filtered_tokens = self.convert_ids_to_tokens(token_ids, skip_special_tokens=skip_special_tokens) File "/root/miniconda3/lib/python3.8/site-packages/transformers/tokenization_utils.py", line 906, in convert_ids_to_tokens index = int(index) TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

thojmr commented 1 year ago

I got this too when I tried a few days ago, for now you can replace that line with a static prompt until it gets fixed

prompt = "put your prompt here" #tokenizer.decode(batch['tokens'][random.randint(0, len(batch['tokens'])-1)])
zakinp commented 1 year ago

I got this too when I tried a few days ago, for now you can replace that line with a static prompt until it gets fixed

prompt = "put your prompt here" #tokenizer.decode(batch['tokens'][random.randint(0, len(batch['tokens'])-1)])

thanks, i found that set the '--extended_mode_chunks' parameter can also fix this error.

mcrisafu commented 1 year ago

@zakinp To what value did you set it? And what does it? I solved it with setting [0] at the end but this does not seem right...

Thank you and regards

SY573M404 commented 1 year ago

@mcrisafu It is a prompt for generating log images from

mcrisafu commented 1 year ago

@SY573M404 Thank you. I meant the --extended_mode_chunks parameter. The question was somewhat misleading. Sry.

SY573M404 commented 1 year ago

@mcrisafu It seems that anything greater that 1 would work. It is probably caused by a simple typo here: https://github.com/harubaru/waifu-diffusion/blob/1a83e470a4b2358f0353bc0df513c19f6c09d63a/trainer/diffusers_trainer.py#L533-L539

Like you mentioned before, there is [0] at the end of the second of mostly similar if branches, but not the first. I'll try it and open a PR if it works