waifu-diffusion icon indicating copy to clipboard operation
waifu-diffusion copied to clipboard

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

Open zakinp opened this issue 2 years ago • 6 comments

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'

zakinp avatar Dec 02 '22 21:12 zakinp

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)])

thojmr avatar Dec 04 '22 00:12 thojmr

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.

zakinp avatar Dec 04 '22 05:12 zakinp

@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

mcrisafu avatar Feb 08 '23 15:02 mcrisafu

@mcrisafu It is a prompt for generating log images from

SY573M404 avatar Feb 11 '23 12:02 SY573M404

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

mcrisafu avatar Feb 12 '23 13:02 mcrisafu

@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

SY573M404 avatar Feb 21 '23 17:02 SY573M404