-
Notifications
You must be signed in to change notification settings - Fork 279
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
[BIT-525] Tokenizer improvements (whitespace-preserving) #856
Conversation
Prepends strings with a space, in the case of non whitespace-preserving tokenizers like BERT, which should mimic whitespace-preserving token strings more often than not. Adds error catching on per-UID basis in shapley_base for synapse validation to be more robust.
Pull Request Test Coverage Report for Build 2e371905-94af-4e6c-b746-2528dc9f4f3b
💛 - Coveralls |
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.
LGTM!
@@ -18,7 +18,9 @@ | |||
# DEALINGS IN THE SOFTWARE. | |||
|
|||
from transformers import AutoTokenizer | |||
import bittensor | |||
import bittensor | |||
from bittensor.utils.tokenizer_utils import prep_tokenizer |
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.
Would we expect users to use the prep_tokenizer function a lot? If so, it might be good to have it as a class function as well
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.
Not really, it's just to prepare the server tokenizer (and the bittensor.tokenizer gets prepared automatically). So clients wouldn't need to run it, for instance.
BIT-525 Tokenizer improvements (whitespace-preserving)
Add support for non whitespace-preserving tokenizers.
Prepends strings with a space, in the case of non whitespace-preserving tokenizers like BERT, which should mimic whitespace-preserving token strings more often than not.
Adds error catching on per-UID basis in shapley_base for synapse validation to be more robust.