Giter VIP home page Giter VIP logo

vscode-pytorch's Introduction

PyTorch Code Snippets for VSCode

VSMarketplace Installs Rating The MIT License GitHub

This project aims to provide a faster workflow when using the PyTorch or torchvision library in Visual Studio Code. This extension provides code snippets for often used coding blocks as well as code example provided by the libraries for common deep learning tasks.

Table of Contents

  1. Getting Started
  2. Dependencies
  3. Installation
  4. Changelog
  5. Get Involved
    1. Contributing
    2. Future Plans
    3. Contact
  6. Credits

Getting Started

If this extension is installed and activated you might notice by start typing pytorch in your python file a dropdown list appears. Entries starting with pytorch: represent code snippets refering to those libraries offered by this extension. Snippets appear in the same way as code completion by using Ctrl+Space. There are placeholders, variables and choices defined inside the code snippets so you can jump from one to another just by pressing Tab. Examples on how to use this extension are shown below. For a full overview please take a look at the Snippet Collection.

PyTorch Preview

Dependencies

Currently the snippets are working for the latest releases of the supported libraries:

  • pytorch >= 1.1.0
  • torchvision >= 0.3.0

Note: Be aware that the pytorch or torchvisionlibarary might change and the presented snippets might become outdated in some areas. But overall for the most functions it should still be fine. I don't expect major changes regarding naming conventions etc..

Installation

The installation process is very straightforward. The recommend, stable way is as follows:

  1. Launch Visual Studio Code
  2. From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (MacOS) select Install Extension or just simply go to the Extensions tab (most likely the fifth entry on the left sidebar). You can also use the hotkey Ctrl-Shift-X respectifely Cmd-Shift-X
  3. Type PyTorch Snippets
  4. Choose and install extension
  5. Restart/Reload Visual Studio Code

This will give you the most recent version you can find on the VS Marketplace. Alternatively you can also clone this repository and move it manually into your VS Code extension folder which will give you the most recent version on GitHub.

git clone https://github.com/SvenBecker/vscode-pytorch.git
mv vscode-pytorch /path/to/your/VSCodeExtensionFolder/

On Windows for example you can normally find the extension folder at C:\Users\YourName\.vscode\extensions. On MacOS and Linux it should be located at ~/.vscode/extensions.

Note: The second method will give you the overall most recent version because I won't update the VS Marketplace version as often as the GitHub version but the VS Marketplace version will probably be the more stable one.

Changelog

[1.0.0] - 2019-07-25

Added
  • Added pytorch:scheduler snippets for learning rate scheduling
  • Added torchvision dataset and model snippets pytorch:torchvision:...
  • Added model loading from checkpoint or github repo pytorch:checkpoint, pytorch:github
  • Added sampler snippets pytorch:sampler
Changed
  • Snippets for Ignite and Fastai have been moved to seperate projects. Soo you can find them at github.com/svenbecker/vscode_fastai and github.com/svenbecker/vscode_ignite. This war primarily done to reduce the snippet overload
  • pytorch:sequential has been moved to pytorch:container
  • Updated official pytorch:examples

Version 0.2.3:

Added
  • Added two new snippets pytorch:dataset and ignite_metrics

Version 0.2.2:

Added
  • Added DataBlock API support for tabular data fastai:tabular:datablock
Changed
  • Changed train snippets for PyTorch and fastai
Fixed
  • Fixed bugs in optimizer selection

Version 0.2.1:

Added
  • Added PyTorch Functional Snippets pytorch:F:

Version 0.2.0:

Added
  • Added code snippets for fast metrics or loss selection (PyTorch and fastai)
  • Added easy selection of neural network layers in PyTorch based on their type pytorch:layer: (conv, recurrent, etc.)
  • Added some more PyTorch snippets like for example optimizer selection, weight initialization etc.
  • Added DataBlock API snippets for fastai
Changes
  • Changed some code examples for common problems to be inline with the official examples provided by PyTorch

All of the past as well as the upcoming changes can further be viewed at Changelog.

Get Involved

Contributing

If you want to contribute, what I would highly appreciate since this project is currently in a very early stage and there is still so much to do, please take a look at Contributing.

Future Plans

Furthermore I would like to offer VS Code snippets for visualization in Python, like for example Matplotlib or Seaborn. Eventually even considering the inclusion of interactive visualization libraries like Bokeh or Plotly. If anyone is interested in this kind of project and/or want to offer some help please contact me.

Contact

Suggestions for improvements will be highly appreciated. You can write me an email (address is provided on my profile) or you can contact me via Twitter @SBX9209.

Credits

  • PyTorch: A huge thanks to the PyTorch team for building such an awesome, easy to use deep learning framework and for offering a numerous amount of code examples.
  • VSCode: My personal favorite text editor and I'm grateful for all the options they are offering, like a huge amount of language support, extensions, integrated terminal, debugger etc..

vscode-pytorch's People

Contributors

ashtonx avatar davissorenson avatar svenbecker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-pytorch's Issues

dataloader not working

hi just wanna let you know that the "pytorch:dataloader" is not working with the newest update of PyTorch, after that PyTorch has relocated the "dataloader" from "torch.utils.DataLoader" to "torch.utils.data.DataLoader". I just love the snippets that you have made so far

Migrate snippets to coc-python

Dear Contributors,
I really appreciate your contributions to this fantastic PyTorch snippets.
I am wondering that could I migrate your snippets to the coc-python repo in order to benefit vim/nvim users?
Thanks for your consideration.

Jupyter support

Does this extnesion support ipynb?
It would be super-useful

Import issues

I am trying to import torch into my python program and no matter what I do it says that 'Import "torch" could not be resolved'. I've installed the PyTorch Snippets extension, as well as restarted my VS Code. Am I just doing something wrong or am I using the wrong import? Any help would be appreciated, thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.