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

Load local tokenizer #116

Closed
jordane95 opened this issue Mar 6, 2024 · 10 comments · Fixed by #122
Closed

Load local tokenizer #116

jordane95 opened this issue Mar 6, 2024 · 10 comments · Fixed by #122
Labels
enhancement New feature or request

Comments

@jordane95
Copy link
Contributor

Due to some network issues, I need to first download and load the tokenizer from local path. But the current tokenizer only supports identifier-based loading from hf. Is it possible to add a local load from path function like AutoTokenizer in transformers lib?

@guipenedo
Copy link
Collaborator

if you replace Tokenizer.from_pretrained with Tokenizer.from_file in the source does it work or is the tokenizer not in the right format? If it works I can add a check to see if the tokenizer name is a valid path and if so load using from_file in that case

@jordane95
Copy link
Contributor Author

Yeah, I'm currently using from_file and it works fine

@guipenedo
Copy link
Collaborator

I will add a check then. Are you passing the path to the folder or to the json file directly?

@jordane95
Copy link
Contributor Author

json file

@jordane95
Copy link
Contributor Author

Also maybe we should add option for BPE tokenizer in MinhashDedup?

@guipenedo
Copy link
Collaborator

Also maybe we should add option for BPE tokenizer in MinhashDedup?

you mean instead of word_tokenize?

@jordane95
Copy link
Contributor Author

Also maybe we should add option for BPE tokenizer in MinhashDedup?

you mean instead of word_tokenize?

Yeah, maybe we could support both by changing the function a bit?

@jordane95
Copy link
Contributor Author

Could we use AutoTokenizer from transformers for this? It would be much more flexible than using the raw tokenizers class.

@guipenedo
Copy link
Collaborator

I would really like to avoid the dependency on transformers just for this, which is a big lib. I'll make a PR with the Tokenizer.from_file change

@guipenedo guipenedo linked a pull request Mar 13, 2024 that will close this issue
@guipenedo
Copy link
Collaborator

Take a look at the linked PR

@guipenedo guipenedo added the enhancement New feature or request label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants