Views
No views yet
1"go"
2"java"
3"javascript"
4"php"
5"python"
6"ruby"tokenizers.1PHP_CODE = """
2public static <mask> set(string $key, $value) {
3 if (!in_array($key, self::$allowedKeys)) {
4 throw new \InvalidArgumentException('Invalid key given');
5 }
6 self::$storedValues[$key] = $value;
7}
8""".lstrip()1from transformers import pipeline
2
3fill_mask = pipeline(
4 "fill-mask",
5 model="huggingface/CodeBERTa-small-v1",
6 tokenizer="huggingface/CodeBERTa-small-v1"
7)
8
9fill_mask(PHP_CODE)
10
11## Top 5 predictions:
12#
13' function' # prob 0.9999827146530151
14'function' #
15' void' #
16' def' #
17' final' # 1PYTHON_CODE = """
2def pipeline(
3 task: str,
4 model: Optional = None,
5 framework: Optional[<mask>] = None,
6 **kwargs
7) -> Pipeline:
8 pass
9""".lstrip()'framework', 'Framework', ' framework', 'None', 'str'This program can auto-complete itself! 😱
1fill_mask("My name is <mask>.")
2
3# {'sequence': '<s> My name is undefined.</s>', 'score': 0.2548016905784607, 'token': 3353}
4# {'sequence': '<s> My name is required.</s>', 'score': 0.07290805131196976, 'token': 2371}
5# {'sequence': '<s> My name is null.</s>', 'score': 0.06323737651109695, 'token': 469}
6# {'sequence': '<s> My name is name.</s>', 'score': 0.021919190883636475, 'token': 652}
7# {'sequence': '<s> My name is disabled.</s>', 'score': 0.019681859761476517, 'token': 7434}huggingface/CodeBERTa-language-id 🤯.1@article{husain_codesearchnet_2019,
2 title = {{CodeSearchNet} {Challenge}: {Evaluating} the {State} of {Semantic} {Code} {Search}},
3 shorttitle = {{CodeSearchNet} {Challenge}},
4 url = {http://arxiv.org/abs/1909.09436},
5 urldate = {2020-03-12},
6 journal = {arXiv:1909.09436 [cs, stat]},
7 author = {Husain, Hamel and Wu, Ho-Hsiang and Gazit, Tiferet and Allamanis, Miltiadis and Brockschmidt, Marc},
8 month = sep,
9 year = {2019},
10 note = {arXiv: 1909.09436},
11}