This model is initialized with Roberta-base and trained with a simple MLM (Masked Language Model) objective.
Usage
from transformers import RobertaTokenizer, RobertaForMaskedLM, pipeline
model = RobertaForMaskedLM.from_pretrained('microsoft/codebert-base-mlm')
tokenizer = RobertaTokenizer.from_pretrained('microsoft/codebert-base-mlm')
code_example = "if (x is not None) <mask> (x>1)"
fill_mask = pipeline('fill-mask', model=model, tokenizer=tokenizer)
outputs = fill_mask(code_example)
print(outputs)
Expected results:
{'sequence': '<s> if (x is not None) and (x>1)</s>', 'score': 0.6049249172210693, 'token': 8}
{'sequence': '<s> if (x is not None) or (x>1)</s>', 'score': 0.30680200457572937, 'token': 50}
{'sequence': '<s> if (x is not None) if (x>1)</s>', 'score': 0.02133703976869583, 'token': 114}
{'sequence': '<s> if (x is not None) then (x>1)</s>', 'score': 0.018607674166560173, 'token': 172}
{'sequence': '<s> if (x is not None) AND (x>1)</s>', 'score': 0.007619690150022507, 'token': 4248}
@misc{feng2020codebert,
title={CodeBERT: A Pre-Trained Model for Programming and Natural Languages},
author={Zhangyin Feng and Daya Guo and Duyu Tang and Nan Duan and Xiaocheng Feng and Ming Gong and Linjun Shou and Bing Qin and Ting Liu and Daxin Jiang and Ming Zhou},
year={2020},
eprint={2002.08155},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Runs of microsoft codebert-base-mlm on huggingface.co
57.4K
Total runs
47.9K
24-hour runs
49.4K
3-day runs
49.6K
7-day runs
54.2K
30-day runs
More Information About codebert-base-mlm huggingface.co Model
codebert-base-mlm huggingface.co
codebert-base-mlm huggingface.co is an AI model on huggingface.co that provides codebert-base-mlm's model effect (), which can be used instantly with this microsoft codebert-base-mlm model. huggingface.co supports a free trial of the codebert-base-mlm model, and also provides paid use of the codebert-base-mlm. Support call codebert-base-mlm model through api, including Node.js, Python, http.
codebert-base-mlm huggingface.co is an online trial and call api platform, which integrates codebert-base-mlm's modeling effects, including api services, and provides a free online trial of codebert-base-mlm, you can try codebert-base-mlm online for free by clicking the link below.
microsoft codebert-base-mlm online free url in huggingface.co:
codebert-base-mlm is an open source model from GitHub that offers a free installation service, and any user can find codebert-base-mlm on GitHub to install. At the same time, huggingface.co provides the effect of codebert-base-mlm install, users can directly use codebert-base-mlm installed effect in huggingface.co for debugging and trial. It also supports api for free installation.