GuizzyQC / sd_api_pictures_tag_injection

Based on @Brawlence's extension
24 stars 6 forks source link

NameError: name 'subject' is not defined #6

Open caninereason opened 10 months ago

caninereason commented 10 months ago

keep getting this error, Ive tried multiple solutions but no dice, Any suggestions.

File "F:\DL\text-generation-webui-main\extensions\sd_api_pictures_tag_injection\script.py", line 400, in get_SD_pictures final_positive_prompt = clean_spaces(tag_calculator(clean_spaces(params['prompt_prefix'])) + ", " + build_body(description,subject,initial_string) + tag_calculator(clean_spaces(positive_suffix))) ^^^^^^^ NameError: name 'subject' is not defined

GuizzyQC commented 10 months ago

I'm not sure how an undefined subject ended up happening, can you give me some information as to what was the string you input (if that's not indiscreet), what mode (Chat, Chat-Instruct?), whether you were in immersive or picturebook mode for the extention, whether you pushed the button to force image generation?

In the meantime I made a bugfix that should make sure subject cannot hit that line uninitialized. You can try replacing your script.py file with this one https://raw.githubusercontent.com/GuizzyQC/sd_api_pictures_tag_injection/Subject-bugfix/script.py and let me know if it works so I can merge the fix.

caninereason commented 10 months ago

Thanks for the quick reply, I was just sending (send me a picture)chat mode, manual button , trying to get this to initially work altogether for the past day, I fear it may have something to do with my model ( yarn-mistral-7b-64k.Q4_K_M.gguf)llama.cpp , have just done a fresh install, gonna try your new script now, thanks again.

caninereason commented 10 months ago

yeah same thing File "F:\DL\text-generation-webui-main\extensions\sd_api_pictures_tag_injection\script.py", line 400, in get_SD_pictures if description is None:

NameError: name 'subject' is not defined I think my install might be messed up maybe, tried a bunch of things to no avail, Ill let you know if I find out, any suggestions are very welcome, thanks again

GuizzyQC commented 10 months ago

I made another fix, where the variables for the body of the a1111 prompt are initialized in the global scope.

https://raw.githubusercontent.com/GuizzyQC/sd_api_pictures_tag_injection/Subject-bugfix/script.py

caninereason commented 10 months ago

Sweet finnally got it working, had to remove description from line 376 though: SyntaxError: name 'description' is parameter and global. But yeah nice one, cheers mate!

outNEXT commented 9 months ago

I'm also having this issue

GuizzyQC commented 9 months ago

I cannot replicate it, but can you test with the latest commit?

GuizzyQC commented 9 months ago

I managed to have it happen to me too. I think it's due to streaming. The extension is supposed to force streaming off when it runs, but somehow it still streams now; I guess changes in text-generation-webui have broken compatibility with the way streaming gets disabled. I would recommend adding "stream: false" in your settings.yaml until I can figure out what changed.

dustyatticgames commented 7 months ago

I fixed this in a pull request #9.