All Projects → labmlai → python_autocomplete

labmlai / python_autocomplete

Licence: MIT license
Use Transformers and LSTMs to learn Python source code

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python autocomplete

Machine learning lectures
Collection of lectures and lab lectures on machine learning and deep learning. Lab practices in Python and TensorFlow.
Stars: ✭ 118 (-31.4%)
Mutual labels:  deep-learning-tutorial
Dive Into Dl Pytorch
本项目将《动手学深度学习》(Dive into Deep Learning)原书中的MXNet实现改为PyTorch实现。
Stars: ✭ 14,234 (+8175.58%)
Mutual labels:  deep-learning-tutorial
Machine Learning Notebooks
Machine Learning notebooks for refreshing concepts.
Stars: ✭ 222 (+29.07%)
Mutual labels:  deep-learning-tutorial
Adventures In Deep Learning
A curated list of Deep Learning resources sorted by reputation
Stars: ✭ 131 (-23.84%)
Mutual labels:  deep-learning-tutorial
A Journey Into Convolutional Neural Network Visualization
A journey into Convolutional Neural Network visualization
Stars: ✭ 165 (-4.07%)
Mutual labels:  deep-learning-tutorial
Ml Glossary
Machine learning glossary
Stars: ✭ 2,338 (+1259.3%)
Mutual labels:  deep-learning-tutorial
Deep learning notes
a collection of my notes on deep learning
Stars: ✭ 112 (-34.88%)
Mutual labels:  deep-learning-tutorial
Nn
🧑‍🏫 50! Implementations/tutorials of deep learning papers with side-by-side notes 📝; including transformers (original, xl, switch, feedback, vit, ...), optimizers (adam, adabelief, ...), gans(cyclegan, stylegan2, ...), 🎮 reinforcement learning (ppo, dqn), capsnet, distillation, ... 🧠
Stars: ✭ 5,720 (+3225.58%)
Mutual labels:  deep-learning-tutorial
Numpydl
Deep Learning Library. For education. Based on pure Numpy. Support CNN, RNN, LSTM, GRU etc.
Stars: ✭ 169 (-1.74%)
Mutual labels:  deep-learning-tutorial
Tensorflow And Deeplearning Tutorial
A TensorFlow & Deep Learning online course I taught in 2016
Stars: ✭ 2,337 (+1258.72%)
Mutual labels:  deep-learning-tutorial
Alexnet with tensorflow
an implement of AlexNet with tensorflow, which has a detailed explanation.
Stars: ✭ 139 (-19.19%)
Mutual labels:  deep-learning-tutorial
Fake Voice Detection
Using temporal convolution to detect Audio Deepfakes
Stars: ✭ 156 (-9.3%)
Mutual labels:  deep-learning-tutorial
Awesome Deep Learning And Machine Learning Questions
【不定期更新】收集整理的一些网站中(如知乎、Quora、Reddit、Stack Exchange等)与深度学习、机器学习、强化学习、数据科学相关的有价值的问题
Stars: ✭ 203 (+18.02%)
Mutual labels:  deep-learning-tutorial
Python autocomplete
Use Transformers and LSTMs to learn Python source code
Stars: ✭ 123 (-28.49%)
Mutual labels:  deep-learning-tutorial
Color Accessibility Neural Network Deeplearnjs
🍃 Using a Neural Network to improve web accessibility in JavaScript.
Stars: ✭ 230 (+33.72%)
Mutual labels:  deep-learning-tutorial
Hyperdl Tutorial
深度学习教程整理 | 干货
Stars: ✭ 1,574 (+815.12%)
Mutual labels:  deep-learning-tutorial
Vgg19 with tensorflow
An easy implement of VGG19 with tensorflow, which has a detailed explanation.
Stars: ✭ 173 (+0.58%)
Mutual labels:  deep-learning-tutorial
lectures-all
Central repository for all lectures on deep learning at UPC ETSETB TelecomBCN.
Stars: ✭ 46 (-73.26%)
Mutual labels:  deep-learning-tutorial
Wordgcn
ACL 2019: Incorporating Syntactic and Semantic Information in Word Embeddings using Graph Convolutional Networks
Stars: ✭ 230 (+33.72%)
Mutual labels:  deep-learning-tutorial
Gluon Api
A clear, concise, simple yet powerful and efficient API for deep learning.
Stars: ✭ 2,322 (+1250%)
Mutual labels:  deep-learning-tutorial

PyPI - Python Version PyPI Status Join Slack Twitter

Python Autocomplete

The full length Python autocompletion Video and a Twitter thread describing how it works

This is a learning/demo project to show how deep learning can be used to auto complete Python code. You can experiment with LSTM and Transformer models. We also have built a simple VSCode extension to try out the trained models.

Training model: Open In Colab

Evaluating trained model: Open In Colab

It gives quite decent results by saving above 30% key strokes in most files, and close to 50% in some. We calculated key strokes saved by making a single (best) prediction and selecting it with a single key.

The dataset we use is the python code found in repos linked in Awesome-pytorch-list. We download all the repositories as zip files, extract them, remove non python files and split them randomly to build training and validation datasets.

We train a character level model without any tokenization of the source code, since it's the simplest.

Try it yourself

  1. Clone this repo
  2. Install requirements from requirements.txt
  3. Run python_autocomplete/create_dataset.py.
    • It collects repos mentioned in PyTorch awesome list
    • Downloads the zip files of the repos
    • Extract the zips
    • Remove non python files
    • Collect all python code to data/train.py and, data/eval.py
  4. Run python_autocomplete/train.py to train the model. Try changing hyper-parameters like model dimensions and number of layers.
  5. Run evaluate.py to evaluate the model.

You can also run the training notebook on Google Colab.

Open In Colab

VSCode extension

  1. Clone this repo

  2. Install requirements from requirements.txt

  3. Install npm packages

You need to have Node.JS installed

cd vscode_extension
npm install # This will install the NPM packages
  1. Start the server python_autocomplete/serve.py

  2. Open the extension project (folder) in VSCode

cd vscode_extension
code . # This will open vscode_extension in VSCode

If you don't have VSCode command line launcher start VSCode and open the project with File > Open

  1. Run the extension from VSCode
Run > Start Debugging

This will open another VSCode editor window, with the extension

  1. Create or open a python file and start editing!

Sample

Here's a sample evaluation of a trained transformer model.

Colors:

  • yellow: the token predicted is wrong and the user needs to type that character.
  • blue: the token predicted is correct and the user selects it with a special key press, such as TAB or ENTER.
  • green: autocompleted characters based on the prediction

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].