LLaVA-VL / LLaVA-Interactive-Demo

LLaVA-Interactive-Demo
https://llava-vl.github.io/llava-interactive/
Apache License 2.0
334 stars 25 forks source link

Where can I find module: 'GuardlistPython'? #12

Closed Sirius-Cheng closed 5 months ago

Sirius-Cheng commented 8 months ago

LLaVA-Interactive-Demo/./LLaVA/llava/guardlistWrapper.py:3 in │ │ │ │ │ │ 1 # this import, even if not directly used, will take care of correctly setting the p │ │ 2 # see init.py in package │ │ ❱ 3 import GuardlistPython │ │ 4 │ │ 5 from Microsoft.Office.Guardlist.Client import (EnvironmentType, │ │ 6 │ │ │ │ │ │ │ │ │ │ │ GuardlistInput, │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ModuleNotFoundError: No module named 'GuardlistPython'


When I run llava_interactive.py as README.md, python llava_interactive.py \ --moderate \ input_text_guardlist \ input_text_aics \ input_image_aics \ output_text_guardlist \ output_text_aics \ gligen_input_text_guardlist \ gligen_input_text_aics \ gligen_output_image_aics

I can't find Module 'GuardlistPython' and 'Microsoft.Office.Guardlist.Client' in the project file, and I try pip install also can't find the match moudle

palchenli commented 7 months ago

I also encountered this problem. Have you solved it?

Siriuscheng4 commented 7 months ago

I delete this part in the code, and find another vision in ohter branch to solve this problem. But it can't use text sensitive detection.

fake-name commented 7 months ago

Digging around, this all seems to be machinery to do content safety crap so they can have a public demo.

There doesn't seem to be a nice flag that just turns that crap off, but I managed to just remove it all by doing a bunch of hackery in LLaVA/llava/utils.py, which seems to be the only file that uses anything in LLaVA/llava/guardlistWrapper.py. I basically just short-circuited all the safety functions, and deleted a bunch of the internal functions that depended on environment variables (which aren't set) as part of their definition.

This doesn't get things to actually run (it depends on models being in certain places that I haven't nailed down yet), but it does solve this issue.

Sirius-Cheng commented 7 months ago

Digging around, this all seems to be machinery to do content safety crap so they can have a public demo.

There doesn't seem to be a nice flag that just turns that crap off, but I managed to just remove it all by doing a bunch of hackery in LLaVA/llava/utils.py, which seems to be the only file that uses anything in LLaVA/llava/guardlistWrapper.py. I basically just short-circuited all the safety functions, and deleted a bunch of the internal functions that depended on environment variables (which aren't set) as part of their definition.

This doesn't get things to actually run (it depends on models being in certain places that I haven't nailed down yet), but it does solve this issue.

yep, I also do the samething in this part. And about the text sensitive, I think it can use other modules(like llama or gpt) to do this thing.

Yannael commented 6 months ago

Having the same issue. Anyone has managed to run this code?

mattmazzola commented 5 months ago

Hi, sorry for the delay. For some reason, I only had notifications for mentions and didn't notice this until recently.

this all seems to be machinery to do content safety crap so they can have a public demo

Yes, Guardlist and Azure Content Safety were added as to help prevent misuse of the demo reflecting poorly on Microsoft. Given the demo had launched briefly without these protections and we didn't want to take it down there was urgency to add them and oversight because it pushed that requirement on to all consumers when it should have only been for the demo. My mistake.

I can't find Module 'GuardlistPython' and 'Microsoft.Office.Guardlist.Client' in the project file, and I try pip install also can't find the match moudle

This is an internal package so you wouldn't be able to find it.

If you attempted to run the demo with guardlist moderation but didn't have the package installed I think you would get a stack trace like this:

...
2024-02-07 20:43:42 | ERROR | stderr |   File "/workspaces/LLaVA-Interactive-Demo/LLaVA/llava/serve/gradio_web_server.py", line 284, in http_bot
2024-02-07 20:43:42 | ERROR | stderr |     does_text_violate_policy |= violates_guardlist_moderation(model_output_text)
2024-02-07 20:43:42 | ERROR | stderr |   File "/workspaces/LLaVA-Interactive-Demo/./LLaVA/llava/utils.py", line 140, in violates_guardlist_moderation
2024-02-07 20:43:42 | ERROR | stderr |     from .guardlistWrapper import GuardlistWrapper
2024-02-07 20:43:42 | ERROR | stderr |   File "/workspaces/LLaVA-Interactive-Demo/./LLaVA/llava/guardlistWrapper.py", line 5, in <module>
2024-02-07 20:43:42 | ERROR | stderr |     from Microsoft.Office.Guardlist.Client import (EnvironmentType,
2024-02-07 20:43:42 | ERROR | stderr | ModuleNotFoundError: No module named 'Microsoft'

As you can see in the PR changes:

The fix was to remove the --moderate flags (Although you can specifically remove the those for guardlist: input_text_guardlist, output_text_guardlist, gligen_input_text_guardlist)

The change is awkward because this LLaVA-Interactive repo has dependency on LLaVA repo.

The violates_guardlist_moderation is called in

I moved the imports from module level into the violates_guardlist_moderation, the intention is that it will only attempt to use the GuardlistPython module if you have that moderation option included.

https://github.com/mattmazzola/LLaVA/commit/682c49e4e37fc355fa3c810c2d65d71220981b4e

I don't have as much time to spend on this anymore, but please let me know if you still have issues with Guardlist and reopen.