Fastai Code Snippets for VSCode
This project aims to provide a faster workflow when using the fastai library in Visual Studio Code.
This extension provides code snippets for often used coding blocks as well as code example provided by the official fastai docs for common deep learning tasks.
Table of Contents
- Getting Started
- Get Involved
- Future Plans
If this extension is installed and activated you might notice by start typing
fastai in your python file a dropdown list appears. Entries starting with
fastai: 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.
Currently the snippets are working for the latest releases of the supported libraries:
Be aware that at the time the fastai library is changing rapidly and currently this project is work in progress.
I will try to keep the snippets in line with the latest fastai library developments, so it might not work for you in case you are using an outdated version.
There might be some functionality which doesn't work yet. I will try to fix it as soon as possible. Furthermore it would be appreciated to inform me about bugs or any other issues.
The installation process is very straightforward. The recommend, stable way is as follows:
- Launch Visual Studio Code
- 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
- Choose and install extension
- 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-fastai.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
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.
- Lots of bugfixes to update the snipper collection to the current fastai version (tabular and vision should be ready to go, text not yet)
- Added a couple more options to the already existing snippets
fastai:vision:transform does now select an individual transformation method
- Major change to colab filtering snippets
- Added closing bracket when calling path on many datablock snippets
- Removed dogs vs cats example
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.
I'm still trying to get all the new updates. Have been quit busy so I didn't paid much attention to the fastai library changes.
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.
- Fast.ai: Also a huge thanks to Jeremy Howard and the whole fast.ai team for creating this great deep learning library and also for offering wonderful, very practical orientated free lectures giving insight to deep learning to a wide range of people including ml/dl beginners as well as advanced practitioners.
- 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..