Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
使用 Diffuser 运行 Fluxn Mac_创想鸟

使用 Diffuser 运行 Fluxn Mac

什么是扩散器?

使用 Diffuser 运行 Fluxn Mac 拥抱脸 / 扩散器

? diffusers:最先进的扩散模型,用于 pytorch 和 flax 中的图像和音频生成。

使用 Diffuser 运行 Fluxn Mac

使用 Diffuser 运行 Fluxn Mac使用 Diffuser 运行 Fluxn Mac使用 Diffuser 运行 Fluxn Mac使用 Diffuser 运行 Fluxn Mac使用 Diffuser 运行 Fluxn Mac

? diffusers 是最先进的预训练扩散模型的首选库,用于生成图像、音频甚至分子的 3d 结构。无论您是在寻找简单的推理解决方案还是训练自己的扩散模型,? diffusers 都是一个支持两者的模块化工具箱。我们的库的设计重点是可用性而不是性能,简单而不是简单,可定制性而不是抽象。

? diffusers 提供三个核心组件:

最先进的扩散管道,只需几行代码即可在推理中运行。可互换的噪声调度器,用于不同的扩散速度和输出质量。预训练模型可用作构建块,并与调度程序相结合,用于创建您自己的端到端扩散系统。

安装

我们建议在 pypi 或 conda 的虚拟环境中安装 ? diffusers。有关安装 pytorch 和 flax 的更多详细信息,请参阅他们的官方文档。

pytorch

与点(官方…

在 github 上查看

什么是助焊剂

https://blackforestlabs.ai/announcing-black-forest-labs/

1. 创建虚拟环境

python3 -m venv fluxtestsource fluxtest/bin/activate

2. 通过 cli 登录 hugging face

https://huggingface.co/docs/huggingface_hub/main/en/guides/cli

pip install -u "huggingface_hub[cli]"huggingface-cli login

3.安装包

pip install torch==2.3.1pip install git+https://github.com/huggingface/diffusers.gitpip install transformers==4.43.3 sentencepiece==0.2.0 accelerate==0.33.0 protobuf==5

4. 运行python脚本

图像.py

import torchfrom diffusers import  fluxpipelineimport diffusers_flux_rope = diffusers.models.transformers.transformer_flux.ropedef new_flux_rope(pos: torch.tensor, dim: int, theta: int) -> torch.tensor:    assert dim % 2 == 0, "the dimension must be even."    if pos.device.type == "mps":        return _flux_rope(pos.to("cpu"), dim, theta).to(device=pos.device)    else:        return _flux_rope(pos, dim, theta)diffusers.models.transformers.transformer_flux.rope = new_flux_ropepipe = fluxpipeline.from_pretrained("black-forest-labs/flux.1-schnell", revision='refs/pr/1',  torch_dtype=torch.bfloat16).to("mps")prompt = "japanese girl, photo-realistic"out = pipe(     prompt=prompt,     guidance_scale=0.,     height=1024,     width=1024,     num_inference_steps=4,     max_sequence_length=256,).images[0]out.save("image.png")

最后,运行python脚本生成图像。

python image.py

输出

使用 Diffuser 运行 Fluxn Mac

以上就是使用 Diffuser 运行 Fluxn Mac的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1348944.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
使用 Asyncio 创建和管理任务
上一篇 2025年12月13日 12:27:38
释放 Python 脚本的力量:日复一日的 DevOps 工具系列
下一篇 2025年12月13日 12:27:51

相关推荐

发表回复

登录后才能评论
关注微信