CodeLab:一款让你体验丝滑般的云化 JupyterLab

DTSE Tech Talk 是华为云开发者联盟推出的技术公开课栏目,解读云上前沿技术,畅聊开发应用实践。由专家团队授课,答疑解惑,助力开发者使用华为云开放能力进行应用构建、技术创新。
从 AI 开发特点着手,华为云 AI DTSE 技术布道师陈阳在 DTT 第五期带来主题为《云化 JupyterLab:华为云 CodeLab 介绍》技术分享,点击回看。
华为云为用户提供了云上的 AI 开发环境——ModelArts CodeLab,一款云化的 jupyterlab,采用的是 jupyter 社区的 jupyterlab 3.2.3 版本,能够实现案例内容秒级接入与分享,而且有免费算力,规格可按需切换。
什么是 jupyterlab

JupyterLab 是一个单机交互式富媒体 web 化的开发环境,可以使用它编写和运行代码、操作终端、编辑 MarkDown 文本、查看 csv 文件等。在 notebook 中运行代码后,系统会在对应的后台运行环境基于 ipython 的 kernel 中完成代码的执行,并把执行结果返回给前台页面呈现,让用户对代码的运行有着直观的感受,加上 python 强大的数据分析和展现能力,让 jupyterlab 在 AI 探索、分析、教学上更加得心应手。

CodeLab 与原生 jupyterlab 有那些不同
CodeLab 对 jupyterlab 做了安全加固,云上资源(存储、网络、算力等)的分配挂载,并以插件的方式提供了一系列功能,给用户提供了一个即开即用 AI 开发环境。
丰富的案例接入。

Codelab 对 jupyterlab 进行了前后端解耦处理,把 jupyterlab 前端单独部署出来用于快速打开保存在 obs 上的 ipynb 文件。目前已经对接 AI Gallery 和 mindspore 社区的文档。后续还会支持一键打开 github 等开源社区的 ipynb。
免费算力规格,按需切换。

Codelab 采用 kernel-gateway(https://github.com/jupyter-server/kernel_gateway)方案,按需为用户创建新的规格实例,并连接切换到新规格上去,目前在北京 4 分别为用户提供了 CPU:2 核 4GB 和 GPU:1*P100|CPU:8 核 64GB 两种限时免费规格,以及其他付费规格使用。
Serverless 化的实例管理。
Codelab 的实例采用 severless 化管理,会采用默认镜像、算力规格、存储等为用户创建实例,并与前端维持心跳,每小时提示设置剩余时长,如果用户不再使用则会停止实例,停止 72 小时后会回收资源。
开发实践小 Tips
CodeLab 目前只在华为云北京 4region 部署,有两种打开方式:
1) ModelArts Console 总览页面打开直接使用:
https://console.huaweicloud.com/modelarts/?region=cn-north-4#/dashboard

此时打开的是多 kernel 镜像:包含了 Conda-python3、MXNet 等多种 kernel

打开后使用的是免费的 cpu 规格,在使用过程中可以切换到免费或者付费算力规格使用:


在使用过程中可以通过右边栏的资源监控查看性能消耗:

2) 通过华为云 AI Gallery 案例进入:
https://developer.huaweicloud.com/develop/aigallery/notebook/list

这种情况下会根据案例要求打开对应的镜像和 kernel:

并提示用户使用案例推荐的算力规格:

除了使用 AI Gallery 案例,还可以引入 github 社区资源:


其他好用的功能:
1) run button:
可以在 cell 左侧点击运行按钮执行代码,执行完成后显示运行时长
可以通过 cell 右上悬浮按钮增删或者移动 cell

2) 上传文件:
5GB 以下文件,可以在界面上直接上传:


5GB 以上文件可参考手册通过 SDK 进行 obs 中转传输:
https://support.huaweicloud.com/devtool-modelarts/modelarts_30_0047.html
3) 参数化:
代码参数化插件可以降低 Notebook 案例的复杂度,用户无需感知复杂的源码,UI 化调整参数:


4) 发布 AI Gallery:
小伙伴们修改好的案例,还可以再发布到 AI Gallery 分享给其他人参考:



简单易用,还有免费算力规格,还是很香的,小伙伴们快来体验吧。
ModelArts CodeLab,点击了解更多。
版权声明: 本文为 InfoQ 作者【华为云开发者联盟】的原创文章。
原文链接:【http://xie.infoq.cn/article/1d57ef59f724f7de5684e427e】。文章转载请联系作者。
评论