Views
No views yet
python by Manuel Romerotokenizers.python corpus for 4 epochs.1PYTHON_CODE = """
2fruits = ['apples', 'bananas', 'oranges']
3for idx, <mask> in enumerate(fruits):
4 print("index is %d and value is %s" % (idx, val))
5""".lstrip()1from transformers import pipeline
2
3fill_mask = pipeline(
4 "fill-mask",
5 model="mrm8488/CodeBERTaPy",
6 tokenizer="mrm8488/CodeBERTaPy"
7)
8
9fill_mask(PYTHON_CODE)
10
11## Top 5 predictions:
12
13'val' # prob 0.980728805065155
14'value'
15'idx'
16',val'
17'_'1PYTHON_CODE2 = """
2@app.route('/<name>')
3def hello_name(name):
4 return "Hello {}!".format(<mask>)
5
6if __name__ == '__main__':
7 app.run()
8""".lstrip()
9
10
11fill_mask(PYTHON_CODE2)
12
13## Top 5 predictions:
14
15'name' # prob 0.9961813688278198
16' name'
17'url'
18'description'
19'self'1PYTHON_CODE3="""
2model = keras.Sequential([
3 keras.layers.Flatten(input_shape=(28, 28)),
4 keras.layers.<mask>(128, activation='relu'),
5 keras.layers.Dense(10, activation='softmax')
6])
7""".lstrip()
8
9
10fill_mask(PYTHON_CODE3)
11
12## Top 5 predictions:
13
14'Dense' # prob 0.4482928514480591
15'relu'
16'Flatten'
17'Activation'
18'Conv'Great! 🎉
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}Created by Manuel Romero/@mrm8488
Made with ♥ in Spain