7

Using Hugging Face Code Autocomplete in VSCode to help with PowerShell and Power...

 1 year ago
source link: http://www.virtu-al.net/2023/08/29/using-hugging-face-code-autocomplete-in-vscode-to-help-with-powershell-and-powercli-scripts/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Using Hugging Face Code Autocomplete in VSCode to help with PowerShell and PowerCLI Scripts

Whilst at VMware Explore this year I was introduced to Hugging Face Code Autocomplete plugin for Visual Studio Code as part of the SafeCoder announcement.

In the keynote demo Chris Wolf showed how SafeCoder could be used to safely complete some python code using a machine learning model which had been trained on the internal VMware code base, it gave great results and showed how using code completion can be safely used by providing an on-premises solution, SafeCoder made sure your company’s core IP or code was not sent to a public service and shared with the world whilst giving you the benefit of code assisted development.

I was intrigued by the demo and wondered how easy it would be and what kind of job the Hugging Face Code Autocomplete plugin for Visual Studio Code would do with PowerShell and specifically PowerCLI Code. Imagine having a LucD sat over your shoulder as you type, suggesting what your code should look like… well its not quite as amazing as Luc, I mean we all strive for that!

I was however impressed, below you can see a quick gif of me using it to create some comments about what I want to do it and it filling out the code as I do so, this is an awesome head start to creating your own scripts and learning.

Note: The current implementation uses the Hugging Face API and model which was trained on the internet so the data wont be 100% accurate, it will do a great job of giving you the fundamentals but rounding the edges and ensuring the script does what you need it to do will be your responsibility!

HF-Autocomplete-PowerShell-2.gif
Hugging Face Code Autocomplete plugin for Visual Studio Code

Installing Hugging Face Code Autocomplete in VSCode

  1. Install VS Code if you don’t have it already.
  2. Install the VS Code plugin from here.
  3. Sign up for a Hugging Face account (free), you will need this for the plugin to access their API.
  4. Setup an API token which you can use for VS Code to access the Hugging Face API.
  5. In VS Code press Cmd/Ctrl+Shift+P to open VSCode command palette.
  6. Type: Hugging Face Code: Set API token.
  7. Paste your API token into the plugin.
  8. You are done! I normally type #PowerShell Code as my first comment to help it know that’s what i expect and not some other language.

This entry was posted in PowerShell on August 29, 2023.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK