Comments (3)
Resolved with this PR (huggingface/transformers#19980).
from plbart.
Thank you for pointing this out. It is a bug as we can see here, instead FAIRSEQ_LANGUAGE_CODES
should be defined as:
FAIRSEQ_LANGUAGE_CODES = {
"base": ["__java__", "__python__", "__en_XX__"],
"multi": ["__java__", "__python__", "__en_XX__", "__javascript__", "__php__", "__ruby__", "__go__"],
}
Otherwise, the regular token java
in the vocab will be treated as a special token. Now in the following:
print(tokenizer.decode(model_inputs['input_ids'][0], skip_special_tokens=True, clean_up_tokenization_spaces=False))
Since you do skip_special_tokens=True
, the java
token is removed.
To verify if tokenization works correct, we can do:
from transformers import PLBartTokenizer
code = "public void METHOD_1 ( TYPE_1 VAR_1 ) throws java.lang.Exception { super . METHOD_1 ( VAR_1 ) ; METHOD_2 ( VAR_1 ) ; }"
tokenizer = PLBartTokenizer.from_pretrained("uclanlp/plbart-base", language_codes="base")
print(tokenizer.tokenize(code))
which outputs:
['▁public', '▁void', '▁METHOD', '_1', '▁(', '▁TYPE', '_1', '▁VAR', '_1', '▁)', '▁throws', 'java', '▁.', 'lang', '.', 'Exception', '▁{', '▁super', '▁.', '▁METHOD', '_1', '▁(', '▁VAR', '_1', '▁)', '▁;', '▁METHOD', '_2', '▁(', '▁VAR', '_1', '▁)', '▁;', '▁}']
And I think the tokenization is fine.
from plbart.
@gchhablani Can you help resolving the bug? The FAIRSEQ_LANGUAGE_CODES should be defined as:
FAIRSEQ_LANGUAGE_CODES = {
"base": ["__java__", "__python__", "__en_XX__"],
"multi": ["__java__", "__python__", "__en_XX__", "__javascript__", "__php__", "__ruby__", "__go__"],
}
from plbart.
Related Issues (20)
- Fine-tuning Error : " AttributeError: module 'sacrebleu' has no attribute '__version__' " HOT 1
- How to make inference HOT 1
- How to calculate loss in PLBART? HOT 1
- How to use encoder and decoder respectively? HOT 1
- Fine tuning PLBART on Devign or a new dataset HOT 3
- Can other programming languages be used? HOT 1
- Processing only one language HOT 2
- OOM: Ran out of memory with exception || Every time I restart pre-training from last checkpoint HOT 1
- questions about some implementations of PLBART HOT 3
- unzip unsuccessful when running download.sh HOT 3
- Can we add structural information in PLBART? HOT 3
- questions about dict.txt and data samples specify methods HOT 6
- the parameter setting when increasing "tokens_per_sample" HOT 2
- Confused about the "max-sentences" in pretraining HOT 3
- plbart-large window size HOT 2
- HuggingFace Checkpoint Configurations HOT 2
- Question about the architecture in HuggingFace
- Support for FastTokenizer in huggingface HOT 1
- Missing all.tok file when running data/github/preprocessing/preprocess.py
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 plbart.