Comments (7)
Yes I agree that this should at least be clearer in the README as other people have reported this
from tokenizers.
Meanwhile these links can be used to download the vocab files for Bert models
'bert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt",
'bert-large-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-vocab.txt",
'bert-base-cased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-vocab.txt",
'bert-large-cased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-vocab.txt",
'bert-base-multilingual-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-multilingual-uncased-vocab.txt",
'bert-base-multilingual-cased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-multilingual-cased-vocab.txt",
'bert-base-chinese': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-vocab.txt",
'bert-base-german-cased': "https://int-deepset-models-bert.s3.eu-central-1.amazonaws.com/pytorch/bert-base-german-cased-vocab.txt",
'bert-large-uncased-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-vocab.txt",
'bert-large-cased-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-vocab.txt",
'bert-large-uncased-whole-word-masking-finetuned-squad': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-finetuned-squad-vocab.txt",
'bert-large-cased-whole-word-masking-finetuned-squad': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-finetuned-squad-vocab.txt",
'bert-base-cased-finetuned-mrpc': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-finetuned-mrpc-vocab.txt"
'''
from tokenizers.
Not sure if this is the best way, but as a workaround you can load the tokenizer from the transformer library and access the pretrained_vocab_files_map
property which contains all download links (those should always be up to date).
Posting my method here, in case it's useful to anyone:
from tokenizers import BertWordPieceTokenizer
import urllib
from transformers import AutoTokenizer
def download_vocab_files_for_tokenizer(tokenizer, model_type, output_path):
vocab_files_map = tokenizer.pretrained_vocab_files_map
vocab_files = {}
for resource in vocab_files_map.keys():
download_location = vocab_files_map[resource][model_type]
f_path = os.path.join(output_path, os.path.basename(download_location))
urllib.request.urlretrieve(download_location, f_path)
vocab_files[resource] = f_path
return vocab_files
model_type = 'bert-base-uncased'
output_path = './my_local_vocab_files/'
tokenizer = AutoTokenizer.from_pretrained(model_type)
vocab_files = download_vocab_files_for_tokenizer(tokenizer, model_type, output_path)
fast_tokenizer = BertWordPieceTokenizer(vocab_files.get('vocab_file'), vocab_files.get('merges_file'))
from tokenizers.
Thanks! I think it's a good idea to put these links somewhere in tutorial.
from tokenizers.
Any updates about it?
from tokenizers.
The links to the vocab files should be in the readme, took me a while to figure it out, mar-muel function works great.
from tokenizers.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
from tokenizers.
Related Issues (20)
- documentation of the `pattern` parameter in `pre_tokenizers.Split` is incorrect HOT 1
- Custom fast PreTokenizer, ported via PyO3 to Python HOT 2
- Tokenizer.from_bytes() not available in python bindings HOT 4
- BPE Split pretokenization rule is not reflected in the vocabulary HOT 2
- Truncation performs slowly. Tokenizer firstly encodes long sequence and then truncates it. HOT 2
- apply_chat_template api usage consult
- Issue with `SentencePieceUnigramTokenizer` Handling Unknown Tokens HOT 1
- `train_from_iterator` out of memory on WMT14 `de` dataset HOT 2
- return pytorch tensors like in transformers? HOT 5
- Risk of global variable memory leaks when calling train_from_iterator HOT 1
- [building on windows] onig_sys/oniguruma two or more data types in declaration specifiers HOT 2
- ValueError: The following `model_kwargs` are not used by the model: ['num_beans'] (note: typos in the generate arguments will also show up in this list)[06/Aug/2024 14:34:35] HOT 1
- Support for Golang now or support a cli for other languages? HOT 2
- Token ID Out of Range & Indexing Assertion Errors During Training HOT 4
- [test-infra] Enable Codecov for tokenizers
- `RefMutContainer` is unsound HOT 3
- Space after unnormalized token is added when `use_fast=True` for Llama tokenizer HOT 6
- Can I use SentencePieceBPETokenizer to replace google/sentencepiece? HOT 6
- .NET bindings
- BPE trainer ignoring special tokens. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tokenizers.