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

TypeError: object of type 'NoneType' has no len() #14

Open
awarenessaspie opened this issue Sep 22, 2024 · 3 comments
Open

TypeError: object of type 'NoneType' has no len() #14

awarenessaspie opened this issue Sep 22, 2024 · 3 comments

Comments

@awarenessaspie
Copy link

Traceback (most recent call last):
File "C:\Users\hawke\JailbreakingLLMs\main.py", line 188, in
main(args)
File "C:\Users\hawke\JailbreakingLLMs\main.py", line 38, in main
extracted_attack_list = attackLM.get_attack(convs_list, processed_response_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hawke\JailbreakingLLMs\conversers.py", line 86, in get_attack
full_prompts.append(conv.get_prompt()[:-len(conv.sep2)])
^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()

I encounter this error. What should I do?

@dirtycomputer
Copy link

same question

@dirtycomputer
Copy link

extracted_attack_list = [attack for attack in extracted_attack_list if attack is not None]

@Good-Way-ZJU
Copy link

Good-Way-ZJU commented Jan 2, 2025

Very toxic repo to the community, I believe. I spent 2 days to fix many bugs in their repos.

Can't agree more, I think the system prompt can't make sure that the attack LLM output the desired json format, which causes this issue. sep2 can be set manually, but I still encounter this
/PAIR/main.py", line 46, in
adv_prompt_list = [attack["prompt"] for attack in extracted_attack_list]
TypeError: 'NoneType' object is not subscriptable

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