envd

envd

简化AI/ML开发环境的容器化工具

envd是一款简化AI/ML开发环境配置的命令行工具。它支持快速创建基于容器的开发环境,提供简洁的CLI和配置语言。envd实现了环境隔离,兼容OCI镜像,可在本地和云端部署。通过远程构建和软件缓存提高效率,支持从Git仓库导入配置以便团队共享。这些特性使envd成为提升AI/ML开发效率的有力工具。

envdAI/ML开发环境容器技术PythonGithub开源项目
<div align="center"> <img src="https://user-images.githubusercontent.com/12974685/200007223-cd94fe9a-266d-4bbd-ac23-e71043d0c3dc.svg#gh-light-mode-only" alt="envd cat wink"/> <img src="https://user-images.githubusercontent.com/12974685/200007265-4e47ff2c-c2a0-4e77-baaa-760ee8728388.svg#gh-dark-mode-only" alt="envd cat wink"/> <p>Development environment for AI/ML</p> </div> <p align=center> <a href="https://discord.gg/KqswhpVgdU"><img alt="discord invitation link" src="https://dcbadge.vercel.app/api/server/KqswhpVgdU?style=flat"></a> <a href="https://twitter.com/TensorChord"><img src="https://img.shields.io/twitter/follow/tensorchord?style=social" alt="trackgit-views" /></a> <a href="https://pypi.org/project/envd"><img src="https://img.shields.io/pypi/pyversions/envd" alt="Python Version" /></a> <a href="https://github.com/tensorchord/envd#contributors-"><img alt="all-contributors" src="https://img.shields.io/github/all-contributors/tensorchord/envd/main"></a> <a href="https://pypi.org/project/envd/"><img alt="envd package downloads" src="https://static.pepy.tech/personalized-badge/envd?period=month&units=international_system&left_color=grey&right_color=brightgreen&left_text=downloads/month"</a> <a href="https://github.com/tensorchord/envd/actions/workflows/CI.yml"><img alt="continuous integration" src="https://github.com/tensorchord/envd/actions/workflows/CI.yml/badge.svg"></a> <a href='https://coveralls.io/github/tensorchord/envd?branch=main'><img src='https://coveralls.io/repos/github/tensorchord/envd/badge.svg?branch=main' alt='Coverage Status' /></a> </p>

What is envd?

envd (ɪnˈvdɪ) is a command-line tool that helps you create the container-based development environment for AI/ML.

Creating development environments is not easy, especially with today's complex systems and dependencies. With everything from Python to CUDA, BASH scripts, and Dockerfiles constantly breaking, it can feel like a nightmare - until now!

Instantly get your environment running exactly as you need with a simple declaration of the packages you seek in build.envd and just one command: envd up!

<p align="center"> <img src="https://user-images.githubusercontent.com/5100735/207217321-34c30dde-4b55-4871-b6fe-f9fc6ec19986.svg" width="75%"/> </p>

Why use envd?

Environments built with envd provide the following features out-of-the-box:

Simple CLI and language

envd enables you to quickly and seamlessly integrate powerful CLI tools into your existing Python workflow to provision your programming environment without learning a new language or DSL.

def build(): install.python_packages(name = [ "numpy", ]) shell("zsh") config.jupyter()

Isolation, compatible with OCI image

With envd, users can create an isolated space to train, fine-tune, or serve. By utilizing sophisticated virtualization technology as well as other features like buildkit, it's an ideal solution for environment setup.

envd environment image is compatible with OCI image specification. By leveraging the power of an OCI image, you can make your environment available to anyone and everyone! Make it happen with a container registry like Harbor or Docker Hub.

Local, and cloud

envd can now be used on a hybrid platform, ranging from local machines to clusters hosted by Kubernetes. Any of these options offers an efficient and versatile way for developers to create their projects!

$ envd context use local # Run envd environments locally $ envd up ... $ envd context use cluster # Run envd environments in the cluster with the same experience $ envd up

Check out the doc for more details.

Build anywhere, faster

envd offers a wealth of advantages, such as remote build and software caching capabilities like pip index caches or apt cache, with the help of buildkit - all designed to make your life easier without ever having to step foot in the code itself!

Reusing previously downloaded packages from the PyPI/APT cache saves time and energy, making builds more efficient. No need to redownload what was already acquired before – a single download is enough for repeat usage!

With Dockerfile v1, users are unable to take advantage of PyPI caching for faster installation speeds - but envd offers this support and more!

<p align=center> <img src="https://user-images.githubusercontent.com/5100735/189928628-543f4851-87b7-462b-b811-372cbf46ff25.svg#gh-light-mode-only" width="65%"/> </p> <p align=center> <img src="https://user-images.githubusercontent.com/16186646/197944452-4a5dcd5f-68d0-4505-b419-e95c298978d7.svg#gh-dark-mode-only" width="65%"/> </p>

Besides, envd also supports remote build, which means you can build your environment on a remote machine, such as a cloud server, and then push it to the registry. This is especially useful when you are working on a machine with limited resources, or when you expect a build machine with higher performance.

Knowledge reuse in your team

Forget copy-pasting Dockerfile instructions - use envd to easily build functions and reuse them by importing any Git repositories with the include function! Craft powerful custom solutions quickly.

envdlib = include("https://github.com/tensorchord/envdlib") def build(): base(os="ubuntu20.04", language="python") envdlib.tensorboard(host_port=8888)
<details> <summary><code>envdlib.tensorboard</code> is defined in <a href="https://github.com/tensorchord/envdlib/blob/main/src/monitoring.envd">github.com/tensorchord/envdlib</a></summary>
def tensorboard( envd_port=6006, envd_dir="/home/envd/logs", host_port=0, host_dir="/tmp", ): """Configure TensorBoard. Make sure you have permission for `host_dir` Args: envd_port (Optional[int]): port used by envd container envd_dir (Optional[str]): log storage mount path in the envd container host_port (Optional[int]): port used by the host, if not specified or equals to 0, envd will randomly choose a free port host_dir (Optional[str]): log storage mount path in the host """ install.python_packages(["tensorboard"]) runtime.mount(host_path=host_dir, envd_path=envd_dir) runtime.daemon( commands=[ [ "tensorboard", "--logdir", envd_dir, "--port", str(envd_port), "--host", "0.0.0.0", ], ] ) runtime.expose(envd_port=envd_port, host_port=host_port, service="tensorboard")
</details>

Getting Started 🚀

Requirements

  • Docker (20.10.0 or above)

Install and bootstrap envd

envd can be installed with pip, or you can download the binary release directly. After the installation, please run envd bootstrap to bootstrap.

pip install --upgrade envd

After the installation, please run envd bootstrap to bootstrap:

envd bootstrap

Read the documentation for more alternative installation methods.

You can add --dockerhub-mirror or -m flag when running envd bootstrap, to configure the mirror for docker.io registry:

envd bootstrap --dockerhub-mirror https://docker.mirrors.sjtug.sjtu.edu.cn

Create an envd environment

Please clone the envd-quick-start:

git clone https://github.com/tensorchord/envd-quick-start.git

The build manifest build.envd looks like:

def build(): base(os="ubuntu20.04", language="python3") # Configure the pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ "numpy", ]) shell("zsh")

Note that we use Python here as an example but please check out examples for other languages such as R and Julia here.

Then please run the command below to set up a new environment:

cd envd-quick-start && envd up
$ cd envd-quick-start && envd up [+] ⌚ parse build.envd and download/cache dependencies 2.8s ✅ (finished) => download oh-my-zsh 2.8s [+] 🐋 build envd environment 18.3s (25/25)(finished) => create apt source dir 0.0s => local://cache-dir 0.1s => => transferring cache-dir: 5.12MB 0.1s ... => pip install numpy 13.0s => copy /oh-my-zsh /home/envd/.oh-my-zsh 0.1s => mkfile /home/envd/install.sh 0.0s => install oh-my-zsh 0.1s => mkfile /home/envd/.zshrc 0.0s => install shell 0.0s => install PyPI packages 0.0s => merging all components into one 0.3s => => merging 0.3s => mkfile /home/envd/.gitconfig 0.0s => exporting to oci image format 2.4s => => exporting layers 2.0s => => exporting manifest sha256:7dbe9494d2a7a39af16d514b997a5a8f08b637f 0.0s => => exporting config sha256:1da06b907d53cf8a7312c138c3221e590dedc2717 0.0s => => sending tarball 0.4s envd-quick-start via Py v3.9.13 via 🅒 envd [envd]# You are in the container-based environment!

Set up Jupyter notebook

Please edit the build.envd to enable jupyter notebook:

def build(): base(os="ubuntu20.04", language="python3") # Configure the pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ "numpy", ]) shell("zsh") config.jupyter()

You can get the endpoint of the running Jupyter notebook via envd envs ls.

$ envd up --detach $ envd envs ls NAME JUPYTER SSH TARGET CONTEXT IMAGE GPU CUDA CUDNN STATUS CONTAINER ID envd-quick-start http://localhost:42779 envd-quick-start.envd /home/gaocegege/code/envd-quick-start envd-quick-start:dev false <none> <none> Up 54 seconds bd3f6a729e94

Difference between v0 and v1

Note To use the v1 config file, add # syntax=v1 to the first line of your build.envd file.

Featuresv0v1
is default for envd<v1.0
support dev
support CUDA
support serving⚠️
support custom base image⚠️
support installing multiple languages⚠️
support moby builder<sup>(a)</sup>

Note <a name="v1-moby">(a)</a> To use the moby builder, you will need to create a new context with envd context create --name moby-test --builder moby-worker --use. For more information about the moby builder, check the issue-1693.

Important For more details, check the upgrade to v1 doc.

More on documentation 📝

See envd documentation.

Roadmap 🗂️

Please checkout ROADMAP.

Contribute 😊

We welcome all kinds of contributions from the open-source community, individuals, and partners.

Open in Gitpod

Contributors ✨

Thanks goes to these wonderful people (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="http://blog.duanfei.org"><img src="https://avatars.githubusercontent.com/u/16186646?v=4?s=70" width="70px;" alt=" Friends A."/><br /><sub><b> Friends A.</b></sub></a><br /><a href="https://github.com/tensorchord/envd/commits?author=shaonianche" title="Documentation">📖</a> <a href="#design-shaonianche" title="Design">🎨</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/aaronzs"><img src="https://avatars.githubusercontent.com/u/1827365?v=4?s=70" width="70px;" alt="Aaron Sun"/><br /><sub><b>Aaron Sun</b></sub></a><br /><a href="#userTesting-aaronzs" title="User Testing">📓</a> <a href="https://github.com/tensorchord/envd/commits?author=aaronzs" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/popfido"><img src="https://avatars.githubusercontent.com/u/3928409?v=4?s=70" width="70px;" alt="Aka.Fido"/><br /><sub><b>Aka.Fido</b></sub></a><br /><a href="#platform-popfido" title="Packaging/porting to new platform">📦</a> <a href="https://github.com/tensorchord/envd/commits?author=popfido" title="Documentation">📖</a> <a href="https://github.com/tensorchord/envd/commits?author=popfido" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://alexhxi.com"><img src="https://avatars.githubusercontent.com/u/68758451?v=4?s=70" width="70px;" alt="Alex Xi"/><br /><sub><b>Alex Xi</b></sub></a><br /><a href="https://github.com/tensorchord/envd/commits?author=AlexXi19" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/LuBingtan"><img src="https://avatars.githubusercontent.com/u/30698342?v=4?s=70" width="70px;" alt="Bingtan Lu"/><br /><sub><b>Bingtan Lu</b></sub></a><br /><a href="https://github.com/tensorchord/envd/commits?author=LuBingtan" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a

编辑推荐精选

Keevx

Keevx

AI数字人视频创作平台

Keevx 一款开箱即用的AI数字人视频创作平台,广泛适用于电商广告、企业培训与社媒宣传,让全球企业与个人创作者无需拍摄剪辑,就能快速生成多语言、高质量的专业视频。

即梦AI

即梦AI

一站式AI创作平台

提供 AI 驱动的图片、视频生成及数字人等功能,助力创意创作

扣子-AI办公

扣子-AI办公

AI办公助手,复杂任务高效处理

AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!

TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
蛙蛙写作

蛙蛙写作

AI小说写作助手,一站式润色、改写、扩写

蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。

AI助手AI工具AI写作工具AI辅助写作蛙蛙写作学术助手办公助手营销助手
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

聊天机器人AI助手热门AI工具AI对话
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

热门AI工具AI办公办公工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

模型训练热门AI工具内容创作智能问答AI开发讯飞星火大模型多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

下拉加载更多