VS Code摸鱼神器,让你快速开发AI模型

摘要:ModelArts VS Code插件一键接入云上开发环境介绍及操作指导

对于习惯于使用本地VS Code IDE的开发者,受限于本地资源,采用本地开发加云上调测的 远程开发方式不失为一种更好的选择。对比一下本地开发和远程开发的优劣可以看到,本地+远程结合的方式可以同时享受IDE工程化开发的优势和云上资源的即开即用,优势互补,最大程度地满足开发者需求。

通过本地IDE加ModelArts提供的远程开发插件,用户可以先在本地做一些基础的代码编写和CPU环境的运行,当需要使用GPU等资源时,可以便捷地接入云上环境进行代码调测,云上云下无缝协同。

当需要从本地环境接入云上环境时,接入的简单和易操作是非常重要的。ModelArts提供了适配VS Code IDE的插件,能做到从Console一键打开VS Code并自动接入开发环境,首次接入仅需1分钟左右,后续仅需10s以内即可进入远端开发环境,真正实现了无感切换。

下面我们就通过实际操作,体验一下ModelArts这款一键接入插件吧。

1)登录ModelArts管理控制台,创建开发环境实例

ModelArts Notebook是华为云一站式开发平台提供的云上开发环境。该开发环境是基于容器,其预置镜像中包含了即开即用的JupyterLab交互式开发界面,以及多种AI Kernel如PyTorch、TensorFlow等,CPU、GPU等计算资源可以按需选择和切换,支持自定义镜像,并且支持从本地SSH访问,是对开发者非常友好的一款云上AI开发调测环境。

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:faf88a81-7f61-4ea0-b2d5-e3c713a306a2

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:7d2c3956-2566-40d0-9637-87a7453cccf9

进入后,在左侧导航栏中选择”开发环境 > Notebook”,进入”Notebook”新版管理页面。

注意1:需要开启SSH开关

注意2:SSH的密钥文件需要下载至本地

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:a0c4aba1-a0ec-4e0c-9831-f07b44d0e50f

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:22e4f62a-7b3d-425b-8f8a-eb733478ecda

Windows:C:\Users{{user}}
Mac/Linux: Users/{{user}}

浏览器下载文件通常默认的下载地址在C:\Users{{user}}\Downloads目录下,是符合要求的。

2)实例状态为”运行中”,点击”VS Code接入”

单击”操作”列的”更多 > VS Code接入”。

图1 打开VS Code接入

3)如果本地已安装VS Code,请单击”打开”,进入”Visual Studio Code”页面

图2 打开Visual Studio Code

如果本地未安装VS Code,请根据页面的提示以及自己本地电脑操作系统,选择”win”或”其他”下载并安装VS Code。VS Code直接按照默认配置安装即可。

图3 下载并安装VS Code

4)如果用户之前未安装过ModelArts VS Code插件,单击”Install and Open”进行插件安装

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:07dc6d62-183a-481e-9744-161134ef1bd8

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:15988530-9f97-45da-b7a7-3d52473b72e6

图4 安装VS Code插件

安装过程预计1~2分钟,安装完成后右下角会弹出对话框,请单击”Reload Window and Open”。

说明:
本文以VS Code 1.57.1版本的操作为例,其它版本的VS Code可能不会弹出”Reload Window and Open”,请直接执行5。

图5 Reload Window and Open

在弹出的提示中,勾选”Don’t ask again for this extension”,然后单击”Open”。

5)远程连接Notebook实例

远程连接执行前,会自动在(Windows:C:\Users{{user}}.ssh或者downloads,Mac/Linux: Users/{{user}}/.ssh或者Downloads)目录下根据密钥名称查找密钥文件,如果找到则直接使用该密钥打开新窗口并尝试连接远程实例,此时无需选择密钥。

图6 远程连接Notebook实例

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:1f289ee8-62e2-48f8-98b8-a859054ff339

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:022e695d-2986-4760-a8b1-d76cdfdc39ad

图7 选择密钥文件

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:41c3990a-e040-4aad-a5e0-15db3326a9b2

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:26308100-2890-4c48-9cbb-3e14ed641039

图8 选择正确的密钥文件

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:8af16739-d8d3-4575-a125-ee7d2a735dc9

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:325cf59a-d7e1-4cab-9345-21a183454b97

图9 连接成功后的开发界面

6)连接失败如何查找原因

图10 实例连接失败

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:4a90c0be-3ada-408d-9be7-17951963863a

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:1626edb5-392d-43fe-88bf-c31c86f3d537

更多探索 Learn More

想了解更多ModelArts VS Code插件内容, 欢迎参与【华为云ModelArts关键AI能力宣讲会】第二期直播

直播主题:华为云+VS Code远程AI开发

直播介绍:介绍VS Code远程开发模式,以及如何通过华为云ModelArts的VS Code扩展快速接入云上开发环境进行AI开发。

直播讲师:华为云AI开发高级工程师,小雪老师

Original: https://www.cnblogs.com/huaweiyun/p/16719429.html
Author: 华为云开发者联盟
Title: VS Code摸鱼神器,让你快速开发AI模型

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/561833/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球