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

【diffusers 下载】access token 使用方法总结

对于特定模型下载需要采用 access token 进行验证,如下所述,但 huggingface 文档里并没有统一介绍 access token 的使用方式😂,特此记录下。

# When prompted for a password, use an access token with write permissions.
# Generate one from your settings: https://huggingface.co/settings/tokens
git clone https://huggingface.co/black-forest-labs/FLUX.1-dev

方法1

access token 作为验证时的密码

  • 转到 huggingface.co/settings/tokens,创建一个具有写访问权限的新访问令牌。
  • 当 git 要求您输入用户名和密码时,请使用您的用户名和访问令牌作为密码

参考文档:https://huggingface.co/learn/ml-for-3d-course/en/unit2/hands-on-1#access-tokens

方法2

from_pretrained 中直接使用,如下所示。

import torch
from diffusers import FluxPipelineaccess_token = "hf_xxx"pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16, token=access_token)
pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU powerprompt = "'hello world'"
image = pipe(prompt,height=1024,width=1024,guidance_scale=3.5,num_inference_steps=28,max_sequence_length=512,generator=torch.Generator("cpu").manual_seed(0)
).images[0]
image.save("hello_world.png")

http://www.mrgr.cn/news/8817.html

相关文章:

  • 大数据-94 Spark 集群 SQL DataFrame DataSet RDD 创建与相互转换 SparkSQL
  • 【前端面试】操作系统
  • easyexcel字典通用转化器
  • RM双轴云台控制
  • 计算机毕业设计 毕业季旅游一站式定制服务平台 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试
  • 普元EOS-微前端的base基座介绍
  • Spring笔记的最后补充 (Spring的基本内容接触完毕)
  • java注解(Annotation)编程
  • 学习文件IO,让你从操作系统内核的角度去理解输入和输出(Java实践篇)
  • Python观察者模式:构建松耦合的通信机制
  • 洛谷 P2254 [NOI2005] 瑰丽华尔兹
  • 软件测试面试题与经验分享【附文档】
  • 定制开发AI智能名片商城小程序:重塑品牌曝光的创新推手
  • Python Sqlite3以字典形式返回查询结果的实现方法
  • C语言——位运算
  • 运行并调试一个简单的微信小程序,用于查询历史数据
  • 使用Intent在活动之间穿梭
  • 可用于便携音箱的18V同步升压变换器TPS61288
  • windows C++- WRL 使用计时器
  • cron调度表达式