当前位置: 首页 > news >正文

缙云县城乡建设局网站战队logo设计在线生成

缙云县城乡建设局网站,战队logo设计在线生成,wordpress注册跳转,介绍自己的做的网站文章目录关于 Stable DiffusionLexica代码实现安装依赖库登陆 huggingface查看 huggingface token下载模型计算生成设置宽高测试迭代次数生成多列图片关于 Stable Diffusion A latent text-to-image diffusion model Stable Diffusion 是一个文本到图像的潜在扩散模型#xff… 文章目录关于 Stable DiffusionLexica代码实现安装依赖库登陆 huggingface查看 huggingface token下载模型计算生成设置宽高测试迭代次数生成多列图片关于 Stable Diffusion A latent text-to-image diffusion model Stable Diffusion 是一个文本到图像的潜在扩散模型由CompVis、Stability AI和LAION的研究人员和工程师创建。 它使用来自LAION-5B数据库子集的512x512图像进行训练。使用这个模型可以生成包括人脸在内的任何图像因为有开源的预训练模型所以我们也可以在自己的机器上运行它。 github : https://github.com/CompVis/stable-diffusionstability.ai 公司主页https://stability.ai官方创作平台http://dreamstudio.ai/ 付费/可试用 https://beta.dreamstudio.aihugginface : https://huggingface.co/CompVis/stable-diffusion 教程资源 数据派THU : Stable Diffusion的入门介绍和使用教程 https://mp.weixin.qq.com/s/Y3XsytE4_ewCc6yVp6G43A35张图直观理解Stable Diffusion https://mp.weixin.qq.com/s/9ngMKHLYKjMASUYeashDJw当下最强的 AI art 生成模型 Stable Diffusion 最全面介绍 https://mp.weixin.qq.com/s/Q4ZYjUxt22Jsx2W2179C8Q Lexica Lexica: The Stable Diffusion search engine https://lexica.art 代码实现 这里我使用 colab 运行colab 使用操作可参考 https://blog.csdn.net/lovechris00/article/details/123960622 Stable Diffusion 操作方法可详见 https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb#scrollToAAVZStIokTVv 安装依赖库 !pip install ipywidgets7,8 !pip install diffusers0.12.1 !pip install transformers scipy ftfy !pip install accelerate !pip install torch1.11.0cu113 torchvision0.12.0cu113 torchaudio0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113 如果 diffusers 版本较低如小于等于 0.4.0后面可能会报如下错误 getattr(): attribute name must be string 查看信息 import diffusers print(diffusers.__version__)!nvidia-smifrom google.colab import output output.enable_custom_widget_manager() 登陆 huggingface from huggingface_hub import notebook_login notebook_login()查看 huggingface token settings -- tokens https://huggingface.co/settings/tokens 你的huggingface 如果还没有激活邮箱需要激活后操作。 登陆成功后会返回下述结果 Token is valid. Your token has been saved in your configured git credential helpers (store). Your token has been saved to /root/.cache/huggingface/token Login successful下载模型 pipe StableDiffusionPipeline.from_pretrained(CompVis/stable-diffusion-v1-4, revisionfp16, torch_dtypetorch.float16, use_auth_tokenTrue) pip 内容如下 StableDiffusionPipeline {_class_name: StableDiffusionPipeline,_diffusers_version: 0.12.1,feature_extractor: [transformers,CLIPFeatureExtractor],requires_safety_checker: true,safety_checker: [stable_diffusion,StableDiffusionSafetyChecker],scheduler: [diffusers,PNDMScheduler],text_encoder: [transformers,CLIPTextModel],tokenizer: [transformers,CLIPTokenizer],unet: [diffusers,UNet2DConditionModel],vae: [diffusers,AutoencoderKL] }计算生成 from torch import autocast # 移动到 cuda pipe pipe.to(cuda)prompt a photo of an astronut riding a horse with autocast(cuda):ret pipe(prompt)ret 的内容是 StableDiffusionPipelineOutput(images[PIL.Image.Image image modeRGB size512x512 at 0x7F99A7332310], nsfw_content_detected[False])有的demo会使用 sample 键我这里没有所以如果调用 sample 会报错 查看图片文件 ret.images[0]设置宽高 宽高必须被 8 整除 # height and width have to be divisible by 8 but are 300 and 200. with autocast(cuda):ret pipe(prompt, width400, height640)ret.images[0]测试迭代次数 设置随机种子 # 先快速生成低质量图片看效果然后调高画质 generator torch.Generator(cuda).manual_seed(1024)with autocast(cuda):ret pipe(prompt, generatorgenerator)ret.images[0]# 调整迭代次数 with autocast(cuda):ret pipe(prompt, generatorgenerator, num_inference_steps15)ret.images[0]生成多列图片 from PIL import Imagedef image_grid(imgs, rows, cols):assert len(imgs) rows * colsw, h imgs[0].sizegrid Image.new(RGB, size(cols*w, rows*h) )grid_w, grid_h grid.sizefor i, img in enumerate(imgs):grid.paste(img, box(i%cols * w, i // cols * h) )return grid num_imgs 3 prompts [prompt] * num_imgswith autocast(cuda):ret pipe(prompts, generatorgenerator, num_inference_steps15) ret 内容如下包含三张图片 StableDiffusionPipelineOutput(images[PIL.Image.Image image modeRGB size512x512 at 0x7F99A7150820, PIL.Image.Image image modeRGB size512x512 at 0x7F99A7103280, PIL.Image.Image image modeRGB size512x512 at 0x7F99A7103520], nsfw_content_detected[False, False, False])显示图片 grid image_grid(ret.images, rows1, cols3)2023-02-15情人节快乐
http://www.tj-hxxt.cn/news/229951.html

相关文章:

  • 网站建设与网页设计美食网站建设类课题的研究方法
  • 网站设计个人北京vi设计公司哪
  • 网站如何不让百度抓取wordpress 回车
  • 蓟县做网站写一个网站
  • 做网站攻击wordpress 设置文件
  • 国外开源网站系统举例说明seo
  • 建设一个网站的一般过程分析北师大教育学原理网站建设
  • 深圳微商城网站设计制作wordpress4.5.3zhcn
  • 自己制作头像app软件成都网站优化服务
  • 丹阳做网站的山东省住房和城乡建设局网站
  • 芜湖市公司网站建设哪家好互联网行业使用收益法进行评估时
  • 成都维尼网络 网站建设广州软件开发人力外包价格
  • 学网站ui设计wordpress 网易相册
  • 网站加速cdn建一个大网站需要的时间
  • 网站建设广金手指六六十四制作图网 专业图片在线制作网站
  • 购物网站怎么做推广网站色彩运用
  • 企业官方网站是什么中国企业500强2023
  • 乌兰县wap网站建设公司免费的招标网有哪些
  • 深圳做男装什么网站容易找工网络营销第二板斧是什么
  • 商城型网站建设多少钱渭南网站建设推广
  • 网站平台做捐助功能有风险吗什么是php网站
  • 黑龙江省建设教育信息网站广西桂林天气预报15天查询
  • 做的视频传到哪个网站好静态网站模板源码下载
  • 上海行业网站建设在线制作头像框
  • dremrever做网站流程网页生成pdf不显示
  • 高端建站是什么公司网站建设建设
  • 新网站 seo网站seo分析报告
  • 新建网站站点的一级a做爰片图片免费观看网站
  • 重庆高考征集志愿网站拍摄企业宣传片哪家好
  • 网站建设初期怎么添加内容天津专业网站设计