-
Notifications
You must be signed in to change notification settings - Fork 579
FEAT: Remove dependency on fastchat for model conversation templates #1049
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I've kicked off a couple jobs and will report back on how they turned out.
tokenizer = AutoTokenizer.from_pretrained( | ||
params.tokenizer_paths[i], token=params.token, trust_remote_code=False, **params.tokenizer_kwargs[i] | ||
) | ||
params.tokenizer_paths[i], token=params.token, trust_remote_code=False, use_fast = True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What motivated this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
char_to_token() is only supported by fast tokenizers in Hugging Face’s Transformers library, to resolve this switch to a fast tokenizer using use_fast=True
allow_non_ascii: bool = False, | ||
num_train_models: int = 1, | ||
devices: list = ["cuda:0"], | ||
devices: list = ["mps"] if torch.backends.mps.is_available() else ["cuda:0"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just something you used because cuda wasn't working or do you think this would be an improvement in some cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its just an additional device mapping to also support torch running on macos devices - https://docs.pytorch.org/docs/stable/notes/mps.html
I originally added it to do a local test run on my macbook device. It can be removed, if we'll always run gcg attacks only on CUDA gpus via cloud.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no problem with support more than cuda, but I worry that it may now us mps even when cuda is available (?)
Maybe I don't know enough about when mps is available vs cuda or whether both can be available at the same time. If you know please reply here 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already removed the condition (this is marked as outdated version of train.py) - with just cuda mapping. However its mostly mutually exclusive - to have cuda or mps, it can't be both at the same time, as mps is seen as a cuda equivalent in mac device with MPS backend i.e. the apple silicon devices.
Replace FastChat’s custom prompt logic with Hugging Face’s apply_chat_template() and tokenizer_config.json.
pyrit/auxiliary_attacks/gcg/attack/base/attack_manager.py
to call apply_chat_template(), generating model-specific prompts according to the conversation template.