节前,我们组织了一场算法岗技术&面试讨论会,邀请了一些互联网大厂朋友、参加社招和校招面试的同学,针对算法岗技术趋势、大模型落地项目经验分享、新手如何入门算法岗、该如何准备、面试常考点分享等热门话题进行了深入的讨论。

基于大家的讨论和大模型实践,我们写了:

《大模型面试宝典》(2024版) 发布! 《大模型实战宝典》(2024版) 发布!

stable-diffusion-webui是一个很棒的开源项目,它是一款基于web的GUI应用,让用户能够方便地与 stable-diffusion模型进行交互,选择不同的模型,并实现从文本到图像(txt2img)的以及其他图像处理任务。也可进行图像生成图像以及图像高分辨、重绘(inpainting)、编辑等工作。

stable-diffusion-webui为创作者们提供了友好且直观的操作界面,无需直接编写代码就能够利用丰富的模型进行创作。用户也可以通过简单的参数配置,比如调整生成图片的尺寸、采样方式和步数、选择不同的预训练模型、调整seed等,来定制和优化生成图像的效果。同时,该Web UI也支持用户进行个性化训练,即在一定条件下训练自己的模型。

stable-diffusion-webui是一个便捷的工具,大大降低了复杂AI技术的使用门槛,让更多人能享受到AI驱动的图像生成技术带来的便利与创新可能。

技术交流&资料

技术要学会分享、交流,不建议闭门造车。一个人可以走的很快、一堆人可以走的更远。

成立了大模型面试和技术交流群,相关资料、技术交流&答疑,均可加我们的交流群获取,群友已超过2000人,添加时最好的备注方式为:来源+兴趣方向,方便找到志同道合的朋友。

方式①、微信搜索公众号:机器学习社区,后台回复:加群 方式②、添加微信号:mlc2040,备注:来自CSDN + 技术交流

最佳实践

环境配置和安装:

python 3.10及以上版本 pytorch推荐2.0及以上版本 建议使用CUDA 11.8及以上

GPU环境镜像(python3.10):

registry.cn-beijing.aliyuncs.com/modelscope-repo/modelscope:ubuntu22.04-cuda12.1.0-py310-torch2.1.2-tf2.14.0-1.13.1

registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu22.04-cuda12.1.0-py310-torch2.1.2-tf2.14.0-1.13.1

registry.us-west-1.aliyuncs.com/modelscope-repo/modelscope:ubuntu22.04-cuda12.1.0-py310-torch2.1.2-tf2.14.0-1.13.1

下载和部署stable-diffusion-webui

clone代码,并安装相关依赖:

%cd /mnt/workspace/

# 安装依赖和下载源码

!apt update

!apt install -y aria2

!pip install gradio==3.41.2

!pip install insightface

!pip install gdown

!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

下载一些经典的文生图模型(包含SD基础模型,Lora,Controlnet等),并存放到models目录的相关子目录下。小伙伴们可以选择自己希望使用的模型并下载,如下代码注释了模型类型,并映射到了对应的存储文件夹。

# 基础模型下载

!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M "https://modelscope.cn/api/v1/models/AI-ModelScope/stable-diffusion-2-1/repo?Revision=master&FilePath=v2-1_768-ema-pruned.ckpt" -d /mnt/workspace/stable-diffusion-webui/models/Stable-diffusion -o v2-1_768-ema-pruned.ckpt

!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M "https://modelscope.cn/api/v1/models/AI-ModelScope/stable-diffusion-2-base/repo?Revision=master&FilePath=512-base-ema.ckpt" -d /mnt/workspace/stable-diffusion-webui/models/Stable-diffusion -o 512-base-ema.ckpt

!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M "https://modelscope.cn/api/v1/models/AI-ModelScope/anything-v3.0/repo?Revision=master&FilePath=Anything-V3.0-pruned.ckpt" -d /mnt/workspace/stable-diffusion-webui/models/Stable-diffusion -o Anything-V3.0-pruned.ckpt

# VAE模型下载

!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M "https://modelscope.cn/api/v1/models/AI-ModelScope/sd-vae-ft-mse-original/repo?Revision=master&FilePath=vae-ft-mse-840000-ema-pruned.ckpt" -d /mnt/workspace/stable-diffusion-webui/models/Stable-diffusion -o Anything-V3.0-pruned.vae.pt

# clip模型下载

!git clone https://www.modelscope.cn/AI-ModelScope/clip-vit-large-patch14.git /mnt/workspace/stable-diffusion-webui/openai/clip-vit-large-patch14

# controlnet模型下载

!aria2c --console-log-level=error -c -x 16 -k 1M -s 16 "https://modelscope.cn/api/v1/models/sd_lora/ControlNet/repo?Revision=master&FilePath=canny-sd21-safe.safetensors" -d /mnt/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o canny-sd21-safe.safetensors

!aria2c --console-log-level=error -c -x 16 -k 1M -s 16 "https://modelscope.cn/api/v1/models/sd_lora/ControlNet/repo?Revision=master&FilePath=depth-sd21-safe.safetensors" -d /mnt/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o depth-sd21-safe.safetensors

!aria2c --console-log-level=error -c -x 16 -k 1M -s 16 "https://modelscope.cn/api/v1/models/sd_lora/ControlNet/repo?Revision=master&FilePath=hed-sd21-safe.safetensors" -d /mnt/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o hed-sd21-safe.safetensors

!aria2c --console-log-level=error -c -x 16 -k 1M -s 16 "https://modelscope.cn/api/v1/models/sd_lora/ControlNet/repo?Revision=master&FilePath=openpose-sd21-safe.safetensors" -d /mnt/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o openpose-sd21-safe.safetensors

!aria2c --console-log-level=error -c -x 16 -k 1M -s 16 "https://modelscope.cn/api/v1/models/sd_lora/ControlNet/repo?Revision=master&FilePath=scribble-sd21-safe.safetensors" -d /mnt/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o scribble-sd21-safe.safetensors

# Embedding模型下载

!git clone https://www.modelscope.cn/AI-ModelScope/negative.git /mnt/workspace/stable-diffusion-webui/embeddings/negative

# lora模型下载

!git clone https://www.modelscope.cn/sd_lora/embed_lora.git /mnt/workspace/stable-diffusion-webui/models/Lora/positive

# 放大模型(upscaler)下载

!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M "https://modelscope.cn/api/v1/models/AI-ModelScope/upscale/repo?Revision=master&FilePath=4x-UltraSharp.pth" -d /mnt/workspace/stable-diffusion-webui/models/ESRGAN -o 4x-UltraSharp.pth

运行sd-webui的前端gradio组件,拉起服务:

%cd stable-diffusion-webui

!python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --lowvram

切换模型,可以看到不同的生成效果:

Anything-V3.0

sd2.1

通俗易懂讲解大模型系列

重磅消息!《大模型面试宝典》(2024版) 正式发布! 重磅消息!《大模型实战宝典》(2024版) 正式发布! 做大模型也有1年多了,聊聊这段时间的感悟! 用通俗易懂的方式讲解:大模型算法工程师最全面试题汇总 用通俗易懂的方式讲解:不要再苦苦寻觅了!AI 大模型面试指南(含答案)的最全总结来了! 用通俗易懂的方式讲解:我的大模型岗位面试总结:共24家,9个offer 用通俗易懂的方式讲解:大模型 RAG 在 LangChain 中的应用实战 用通俗易懂的方式讲解:ChatGPT 开放的多模态的DALL-E 3功能,好玩到停不下来! 用通俗易懂的方式讲解:基于扩散模型(Diffusion),文生图 AnyText 的效果太棒了 用通俗易懂的方式讲解:在 CPU 服务器上部署 ChatGLM3-6B 模型 用通俗易懂的方式讲解:ChatGLM3-6B 部署指南 用通俗易懂的方式讲解:使用 LangChain 封装自定义的 LLM,太棒了 用通俗易懂的方式讲解:基于 Langchain 和 ChatChat 部署本地知识库问答系统 用通俗易懂的方式讲解:Llama2 部署讲解及试用方式 用通俗易懂的方式讲解:一份保姆级的 Stable Diffusion 部署教程,开启你的炼丹之路 用通俗易懂的方式讲解:LlamaIndex 官方发布高清大图,纵览高级 RAG技术 用通俗易懂的方式讲解:为什么大模型 Advanced RAG 方法对于AI的未来至关重要? 用通俗易懂的方式讲解:基于 Langchain 框架,利用 MongoDB 矢量搜索实现大模型 RAG 高级检索方法

相关文章

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: