-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Model] rename use_pad_token to use_sep_token #31784
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6fec8e5
init
noooop e231859
MTEB_EMBED_TOL = 5e-4
noooop 0a86330
fix
noooop 09c8eaf
Merge branch 'main' into use_sep_token
noooop d66afa0
Merge branch 'main' into use_sep_token
noooop 4986dee
Merge branch 'main' into use_sep_token
noooop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,7 @@ def no_post_processing(causal_lm, seq_cls_model, tokenizer, tokens, device): | |
|
|
||
|
|
||
| def converting( | ||
| model_name, classifier_from_tokens, path, method, use_pad_token=False, device="cpu" | ||
| model_name, classifier_from_tokens, path, method, use_sep_token=False, device="cpu" | ||
| ): | ||
| """ | ||
| Main conversion function to transform a CausalLM model to SequenceClassification. | ||
|
|
@@ -118,7 +118,7 @@ def converting( | |
| classifier_from_tokens: List of tokens used for classification | ||
| path: Output path to save the converted model | ||
| method: Conversion method ('from_2_way_softmax' or 'no_post_processing') | ||
| use_pad_token: Whether to use padding token in the sequence classification model | ||
| use_sep_token: Whether to use separating token in the sequence classification model | ||
| device: Device to load the model on ('cpu' or 'cuda') | ||
| """ | ||
| assert method in method_map, f"Unknown method: {method}" | ||
|
|
@@ -149,10 +149,10 @@ def converting( | |
| causal_lm, seq_cls_model, tokenizer, classifier_from_tokens, device | ||
| ) | ||
|
|
||
| # Configure padding token settings | ||
| # Note: Reranker models typically don't use padding tokens by default | ||
| seq_cls_model.config.use_pad_token = use_pad_token | ||
| seq_cls_model.config.pad_token_id = tokenizer.pad_token_id | ||
| # Configure separating token settings | ||
| # Note: `llm as reranker` defaults to not using separating token. | ||
| seq_cls_model.config.use_sep_token = use_sep_token | ||
| seq_cls_model.config.sep_token_id = tokenizer.sep_token_id | ||
|
|
||
| # Save the converted model and tokenizer | ||
| seq_cls_model.save_pretrained(path) | ||
|
|
@@ -203,6 +203,6 @@ def parse_args(): | |
| model_name=args.model_name, | ||
| classifier_from_tokens=json.loads(args.classifier_from_tokens), | ||
| method=args.method, | ||
| use_pad_token=args.use_pad_token, | ||
| use_sep_token=args.use_sep_token, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the name in add_argument is still use-pad-token |
||
| path=args.path, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.