Comments (6)
Is that an only test-case problem or it needs more effort?
from sentencepiece.
BOS/EOS/UNK ids are hard coded. Not sure what happens when rewriting these variables.
By the way, If you want to reserve some ids, you can train sentencepiece with --contol_symbols flag
https://github.com/google/sentencepiece/blob/master/doc/special_symbols.md
--control_symbols="<my_tag1>,<my_tag2>"
then, "<my_tag1>" and "<my_tag2>" are reserved. These vocab must be inserted outside of sentencepiece. The id of these symbols can be found in vocab file.
from sentencepiece.
Thanks for the advice. However, I'd like to reserve symbol IDs, but not names....
from sentencepiece.
Here's my fork with (bos=0, eos=1, unk=2) for who is interested in this; https://github.com/deasuke/sentencepiece
A lot of sequence processing system use pad=0 and eos=1 and has no bos; e.g. tf.reduce_sum(some_position_slice)==0 means every word in the position is PAD and tf.less(some_position_slice, 2) means "choose finished sequences"
BTW, I have a question: I have to rewrite the test case of "我輩は猫である" (see unigram_trainer_test.cc of the change deasuke@4a9f041 )
Is the algorithm dependent on (the order of) word ID ?
from sentencepiece.
This feature may be hard to implement because some IDs are hard-coded but it will be helpful when using SentencPiece with Tensor2Tensor because it uses some ids (0 and 1) for special purposes. I imagine there are other cases when downstream programs reserves some ids whose meanings are different from SentencePiece.
from sentencepiece.
Updated the code such that ids for are redefined.
% spm_train --bos_id=0 --eos_id=1 --unk_id=2 ....
Also id for padding is added, though it is disabled by default. Will update the document soon.
from sentencepiece.
Related Issues (20)
- How to safely extend vocabulary? HOT 3
- Extract & modify the merge rules from the .model file of a SentencePiece BPE model HOT 1
- Same oov count while using different vocab size HOT 2
- Evaluate Profile-Guided Optimization (PGO)
- Official support for Android compilation in Release/Assets HOT 1
- Merging tokenizers issue HOT 4
- RuntimeError HOT 1
- coredump when build with CXXFLAG `-Wp,-D_GLIBCXX_ASSERTIONS` HOT 4
- High frequency token segmented into letter sequence when input is a tsv file HOT 3
- Error while installing the library "sentence-transformers" which has dependency on "sentencepiece" HOT 11
- Getting requirements to build wheel did not run successfully. HOT 5
- Not found google.protobuf packages HOT 1
- error while installing sentencepiece python 3.12.2 HOT 2
- Many tests fail HOT 2
- entry points return non-zero exit code (at least for `--help`) HOT 2
- HELP NEEDED Mask Token in SentencePiece tokenizer HELP NEEDED HOT 1
- Sequence of byte '<0x09>' as token HOT 1
- TSV for NFC normalization HOT 1
- Allow whitespace-only pieces
- coredump when build with CXXFLAGS `-Wp,-D_GLIBCXX_ASSERTIONS`
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 sentencepiece.