Showing posts with label ai教程. Show all posts
Showing posts with label ai教程. Show all posts

Wednesday, 28 August 2024

Super Simple ComfyUI on Mac: Don’t Miss Out! - 超简单!在Mac上安装ComfyUI,赶紧学起来!

Get Comfy with ComfyUI – It’s Easier Than You Think! - ComfyUI,轻松上手 – 难道还不会?


comfyUI

Introduction: Why Mac Silicon Users Need ComfyUI - 简介:为什么Mac Silicon用户需要ComfyUI


Mac’s M1/M2 chips are like the overachieving kids in class—great at almost everything, except when it comes to art. With no discrete graphics card, drawing with AI seems like a pipe dream. Enter ComfyUI: the underdog hero that makes AI art on Mac not just possible, but smooth as butter. Don’t let your Mac’s integrated graphics hold you back; ComfyUI is here to turn your AI art dreams into reality. Why miss out on creating masterpieces just because you’ve got a Mac? Give ComfyUI a shot, and let your creativity flow.

Mac的M1/M2芯片就像班里的优等生,几乎样样精通,唯独在绘画上有些力不从心。没有独立显卡,用AI作画似乎只是天方夜谭。于是,ComfyUI登场了:这个不被看好的英雄不仅让Mac上用AI作画成为可能,还能让整个过程顺滑如丝。别让Mac的集成显卡限制了你的创造力;ComfyUI来帮你实现艺术梦想。难道就因为你用的是Mac就错过创作杰作的机会?试试ComfyUI,让你的创意飞扬起来吧!


Preparation - 基础准备


Before diving into the world of ComfyUI on your Mac, there’s some groundwork to cover. First up is Homebrew, your Mac’s best buddy for installing just about anything with ease. If you haven’t installed it yet, hop over to Homebrew and get that sorted—it’s like giving your Mac a Swiss Army knife. Next, Python 3.10 or higher is a must, as it’s the core of ComfyUI’s operations. You can grab it from the official Python website or let Homebrew handle it with brew install python3. Once installed, a quick python3 --version in Terminal will confirm if everything’s in place.

Now, let’s talk about conda or Miniconda. This isn’t just for show—it’s a handy tool for managing your Python environments, especially if your Mac is juggling multiple Python versions. You can download Miniconda from here. If you’re running a solo Python version, or your default is already 3.10 or higher, you can skip this step. Finally, to optimize ComfyUI on your Apple Silicon Mac, you’ll need to install cmake, protobuf, and rust using “brew install cmake protobuf rust”. These tools are more than just tech jargon; cmake speeds up workflows, protobuf handles the complex data serialization that’s key to AI-driven art, and rust ensures smooth concurrent processing—think of it as supercharging your Mac’s AI art capabilities. With these in place, you’re all set to make ComfyUI sing on your Mac!


在你的Mac上运行ComfyUI之前,需要做一些基础准备。首先是Homebrew,这个工具简直是你Mac的安装神器。如果还没安装,赶紧去Homebrew页面搞定它——这就像给你的Mac配备了一把瑞士军刀。接下来,你需要Python 3.10或更高版本,它是ComfyUI运行的核心。你可以从Python官网下载安装,或者用Homebrew通过brew install python3来搞定。安装后,在Terminal中输入python3 --version检查版本信息,确保一切就绪。

然后,我们来说说conda或Miniconda。这不是摆设,它是管理Python环境的好帮手,特别适合当你的Mac上有多个Python版本需要处理时。你可以从这里下载Miniconda。 如果你的Mac只运行一个Python版本,或者默认版本已经是3.10或更高,那这一步可以跳过。最后,为了优化ComfyUI在Apple Silicon Mac上的表现,你需要通过”brew install cmake protobuf rust”安装cmake、protobuf和rust。这些工具可不仅仅是技术名词;cmake加速了工作流程,protobuf处理复杂的数据序列化,AI驱动的艺术创作全靠它,rust则确保并发处理的顺畅——想象一下,它就像给你的Mac AI艺术功能装上了涡轮增压器。有了这些准备,你的ComfyUI就能在Mac上大展身手了!

The 5-Minute Magic: Step-by-Step Installation - 5分钟魔法:傻瓜式安装步骤:

Let's start this 5-minute adventure. First up, we gotta get ComfyUI from github. It's like going on a treasure hunt. Type in "git clone https://github.com/comfyanonymous/ComfyUI". Ta-da! Now we're in business. If you're not used to the git clone command, you can also just download it as a zip file and unzip it, which will also give you the ComfyUI repository.

Next stop, the ComfyUI root folder. Open up that terminal and type "cd {path}/ComfyUI". The folder called ComfyUI is the root directory of ComfyUI.

Now comes the fun part – configuring that venv thingy. "python3 -m venv {name_you_like, eg: cfui}" and then "source cfui/bin/activate". It sounds all sci-fi and complicated, but don't worry. If you want to bail out later, just say "deactivate". Easy peasy. Configuring a virtual environment(venv) allows you to install dependencies that work only in this virtual environment, without affecting your entire laptop working environment.

Time to install those dependencies. "pip install torch torchvision torchaudio" and then "pip install -r requirements.txt". It's like building a superpowered machine. And if you're feeling extra fancy, go ahead and update pip with "pip install --upgrade pip".

But wait, there's more! We need to add the ComfyUI-Manager git repo. Head over to "{path}/ComfyUI/custom_nodes" and type "git clone https://github.com/ltdrdata/ComfyUI-Manager.git". Once you've done that, just leave it be and do "cd../", return to the previous level of the directory and enter the startup command on the side. If you are not used to the git clone command, you can download the ComfyUI-manager zip archive and extract it locally. Then, if you need to, activate that venv again(command: source cfui/bin/activate). Run "python main.py" and boom! You're on your way to tech glory. To see the GUI, go to http://127.0.0.1:8188. If you see "Manager" and "Share" buttons, you know you've hit the jackpot.

Now, if you want to get all multilingual and fancy, support Chinese with this next step. Clone that "AIGODLIKE-ComfyUI-Translation.git" by typing "git clone https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git". Of course you can also download the zip file. Then, manually move the whole folder into {path}/ComfyUI/custom_nodes. It's like giving your ComfyUI a language makeover.

Last but not least, get those custom check points from Civitai or Tusiart. Think of it as picking your favorite toy. In my case, I went with "Bonobo_XL". You can choose the one you like. Head to Civitai's official website, search for your dream check point, download it, and move it to {path}/ComfyUI/models/checkpoints.

咱们开始这五分钟的冒险吧。首先,我们得从 github 上获取 ComfyUI。这就像是去寻宝。输入 “git clone https://github.com/comfyanonymous/ComfyUI”。哇哦!现在我们开始上路了。如果你不习惯git clone 命令,也可以直接下载它的zip文件,然后解压缩,也会得到ComfyUI的repository。

下一站,ComfyUI 的根目录。打开终端,输入 “cd {path}/ComfyUI”。这个叫ComfyUI的文件夹就是ComfyUI的根目录。

现在好玩的部分来了 —— 配置那个虚拟环境。“python3 -m venv {你喜欢的环境名字,比如: cfui}”,然后 “source cfui/bin/activate”。听起来很科幻很复杂,但别担心。要是你以后想退出,就说 “deactivate”。很简单吧。配置虚拟环境可以使你安装的依赖只在这个虚拟环境中工作,而不会影响你整个laptop的工作环境。

该安装那些依赖项了。“pip install torch torchvision torchaudio”,然后 “pip install -r requirements.txt”。这就像是在打造一个超级强大的机器。要是你想更时髦点,那就用 “pip install --upgrade pip” 来更新一下 pip。

但是等等,还有呢!我们得添加 ComfyUI-Manager 的 git 仓库。去到 “{路径}/ComfyUI/custom_nodes”,然后输入 “git clone https://github.com/ltdrdata/ComfyUI-Manager.git”。一旦你完成了这个,就放那儿别管,然后输入 “cd../”,退回上一级目录,方面输入启动命令。如果不习惯git clone命令,也可以直接下载ComfyUI-manager的zip压缩包,然后在本地解压缩。要是需要的话,再激活那个虚拟环境(命令是: source cfui/bin/activate)。运行 “python main.py”,然后砰!你就踏上了科技荣耀之路。要看到图形界面,就去到 http://127.0.0.1:8188。要是你看到了 “Manager” 和 “Share” 按钮,你就知道你成功了。

现在,要是你想变得多语言又时髦,那就用下一步来支持中文。通过输入 “git clone https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git” 来克隆那个 “AIGODLIKE-ComfyUI-Translation.git”。当然也可以下载zip文件。然后,手动把整个文件夹移到 {path}/ComfyUI/custom_nodes。这就像是给你的ComfyUI做一个语言大改造。

最后一步,从 Civitai或者吐司AI上获取那些自定义的checkpoint。把这想象成挑选你最喜欢的玩具。就我来说,我选了 “Bonobo_XL”。你可以选你喜欢的。去到 Civitai 的官方网站,搜索你梦想中的checkpoint,下载下来,然后把它移到 {path}/ComfyUI/models/checkpoints。

Beyond Installation: First Steps in the ComfyUI Playground - 安装之后:ComfyUI游乐场初体验:

Alright, folks! You've survived the installation gauntlet, and now it's time to dive into the wacky world of ComfyUI. 

First things first, let's fire up this bad boy. Type "python main.py" into your terminal like you're casting a spell. If your Mac starts smoking, you've done it wrong (just kidding, maybe). For you CPU lovers out there, add "--cpu" to the end. It's like telling your computer to run on hamster power - slower, but adorable.

Now, point your browser to http://127.0.0.1:8188. If you see a bunch of boxes and lines, congratulations! You've officially entered the twilight zone of AI art generation. Don't panic, those Unfamiliar workflow settings are supposed to be there.

Can't read English? Click that gear icon and find "AGLTranslation-language". Pick your language. Now you can be confused in your mother tongue!

Time to make some "art"! Pick a model like "Bonobo_XL" - because nothing says "I'm a serious artist" like naming your AI after a chimp. Click "Queue Prompt" and watch as your computer has an existential crisis trying to interpret your artistic vision. Check the "Save Image" panel for results. 

When you're done playing God (or more likely, a drunk toddler with crayons), head back to the terminal. Hit Ctrl+C like you're killing a bug. Boom! ComfyUI is sleeping. Want to tuck it in properly? Type "deactivate". It's like putting your AI baby to bed. “deactivate” will stop the virtual environment (venv - cfui), so as not to waste your Mac's resources.

Need to wake the beast later? Just whisper "source cfui/bin/activate" into your terminal. It's like the "Open Sesame" of the digital age, but nerdier. Then enter the command “python main.py”, and you can use ComfyUI again.

好了,各位!你已经闯过了安装的九九八十一难,现在是时候潜入ComfyUI的奇妙世界了。

首先,让我们把这个小家伙点着。在你的终端里输入"python main.py",就像你在施展魔法一样。如果你的Mac开始疯狂工作了,那你就做错了(开个玩笑,也许)。对于你们这些CPU爱好者,在后面加上"--cpu"。这就像告诉你的电脑用仓鼠发电 - 慢一点,但是超可爱。

现在,把你的浏览器指向http://127.0.0.1:8188。如果你看到一堆方块和连接线,恭喜你!你已经正式进入了AI艺术生成的暮光之城。别慌,那些陌生的工作流设置就应该在那里。

看不懂英文?点击那个齿轮图标,找到"AGLTranslation-language"。挑选你的语言。难道你不知道你的母语!

是时候创作一些"艺术"了!选一个模型,比如"Bonobo_XL" - 因为没有什么比用黑猩猩命名你的AI更能说明"我是个严肃的艺术家"了。点击"添加提示词队列",然后看着你的电脑试图解读你的艺术视野时陷入存在主义危机。在"保存图像"面板查看结果。

当你玩够了上帝(或者更可能是,一个醉醺醺的拿着蜡笔的小屁孩),回到终端。像拍死一只虫子一样按Ctrl+C。砰!ComfyUI睡着了。想要好好地把它塞进被窝?输入"deactivate"。这就像把你的AI宝宝哄睡觉。"deactivate"会停止虚拟环境(venv – cfui), 这样不会浪费你的Mac的资源。

之后需要唤醒这头野兽?只需要在你的终端里轻声细语"source cfui/bin/activate"。这就像数字时代的"芝麻开门",只不过更宅一点。然后输入命令”python main.py”, 就又能用ComfyUI了。

first-run