开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

Samle/diffusers

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
main
分支 (633)
标签 (92)
main
modular-load-components
move-testing-utils
fa3-from-kernels
modular-standard-repo
schedulers/unipc-custom-sigmas
attn-dispatcher-cp-and-training
fa3-fake-ops-added
modular-qwen
qwen-image-compilation-followup
nunchaku
torch-main-dep
export-tests
attn-refactor-blocks
allow-non-list-component
qwenimage-lru-cache-bypass
add-attentionmixin-qwen-image
requirements-custom-blocks
refactor-lora-save-weights
v0.35.1-patch
v0.35.1
v0.35.0
v0.34.0
v0.33.1
v0.33.0
v0.32.2
v0.32.1
v0.32.0
v0.31.0
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.2
v0.29.1
v0.29.0
v0.28.2
v0.28.1
v0.28.0
v0.27.2
main
分支 (633)
标签 (92)
main
modular-load-components
move-testing-utils
fa3-from-kernels
modular-standard-repo
schedulers/unipc-custom-sigmas
attn-dispatcher-cp-and-training
fa3-fake-ops-added
modular-qwen
qwen-image-compilation-followup
nunchaku
torch-main-dep
export-tests
attn-refactor-blocks
allow-non-list-component
qwenimage-lru-cache-bypass
add-attentionmixin-qwen-image
requirements-custom-blocks
refactor-lora-save-weights
v0.35.1-patch
v0.35.1
v0.35.0
v0.34.0
v0.33.1
v0.33.0
v0.32.2
v0.32.1
v0.32.0
v0.31.0
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.2
v0.29.1
v0.29.0
v0.28.2
v0.28.1
v0.28.0
v0.27.2
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
main
分支 (633)
标签 (92)
main
modular-load-components
move-testing-utils
fa3-from-kernels
modular-standard-repo
schedulers/unipc-custom-sigmas
attn-dispatcher-cp-and-training
fa3-fake-ops-added
modular-qwen
qwen-image-compilation-followup
nunchaku
torch-main-dep
export-tests
attn-refactor-blocks
allow-non-list-component
qwenimage-lru-cache-bypass
add-attentionmixin-qwen-image
requirements-custom-blocks
refactor-lora-save-weights
v0.35.1-patch
v0.35.1
v0.35.0
v0.34.0
v0.33.1
v0.33.0
v0.32.2
v0.32.1
v0.32.0
v0.31.0
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.2
v0.29.1
v0.29.0
v0.28.2
v0.28.1
v0.28.0
v0.27.2
diffusers
/
utils
/
check_doc_toc.py
diffusers
/
utils
/
check_doc_toc.py
check_doc_toc.py 6.74 KB
一键复制 编辑 原始数据 按行查看 历史
Ishan Modi 提交于 2025年04月17日 00:04 +08:00 . [BUG] fixed _toctree.yml alphabetical ordering (#11277)
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
from collections import defaultdict
import yaml
PATH_TO_TOC = "docs/source/en/_toctree.yml"
def clean_doc_toc(doc_list):
"""
Cleans the table of content of the model documentation by removing duplicates and sorting models alphabetically.
"""
counts = defaultdict(int)
overview_doc = []
new_doc_list = []
for doc in doc_list:
if "local" in doc:
counts[doc["local"]] += 1
if doc["title"].lower() == "overview":
overview_doc.append({"local": doc["local"], "title": doc["title"]})
else:
new_doc_list.append(doc)
doc_list = new_doc_list
duplicates = [key for key, value in counts.items() if value > 1]
new_doc = []
for duplicate_key in duplicates:
titles = list({doc["title"] for doc in doc_list if doc["local"] == duplicate_key})
if len(titles) > 1:
raise ValueError(
f"{duplicate_key} is present several times in the documentation table of content at "
"`docs/source/en/_toctree.yml` with different *Title* values. Choose one of those and remove the "
"others."
)
# Only add this once
new_doc.append({"local": duplicate_key, "title": titles[0]})
# Add none duplicate-keys
new_doc.extend([doc for doc in doc_list if "local" not in counts or counts[doc["local"]] == 1])
new_doc = sorted(new_doc, key=lambda s: s["title"].lower())
# "overview" gets special treatment and is always first
if len(overview_doc) > 1:
raise ValueError("{doc_list} has two 'overview' docs which is not allowed.")
overview_doc.extend(new_doc)
# Sort
return overview_doc
def check_scheduler_doc(overwrite=False):
with open(PATH_TO_TOC, encoding="utf-8") as f:
content = yaml.safe_load(f.read())
# Get to the API doc
api_idx = 0
while content[api_idx]["title"] != "API":
api_idx += 1
api_doc = content[api_idx]["sections"]
# Then to the model doc
scheduler_idx = 0
while api_doc[scheduler_idx]["title"] != "Schedulers":
scheduler_idx += 1
scheduler_doc = api_doc[scheduler_idx]["sections"]
new_scheduler_doc = clean_doc_toc(scheduler_doc)
diff = False
if new_scheduler_doc != scheduler_doc:
diff = True
if overwrite:
api_doc[scheduler_idx]["sections"] = new_scheduler_doc
if diff:
if overwrite:
content[api_idx]["sections"] = api_doc
with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
f.write(yaml.dump(content, allow_unicode=True))
else:
raise ValueError(
"The model doc part of the table of content is not properly sorted, run `make style` to fix this."
)
def check_pipeline_doc(overwrite=False):
with open(PATH_TO_TOC, encoding="utf-8") as f:
content = yaml.safe_load(f.read())
# Get to the API doc
api_idx = 0
while content[api_idx]["title"] != "API":
api_idx += 1
api_doc = content[api_idx]["sections"]
# Then to the model doc
pipeline_idx = 0
while api_doc[pipeline_idx]["title"] != "Pipelines":
pipeline_idx += 1
diff = False
pipeline_docs = api_doc[pipeline_idx]["sections"]
new_pipeline_docs = []
# sort sub pipeline docs
for pipeline_doc in pipeline_docs:
if "sections" in pipeline_doc:
sub_pipeline_doc = pipeline_doc["sections"]
new_sub_pipeline_doc = clean_doc_toc(sub_pipeline_doc)
if new_sub_pipeline_doc != sub_pipeline_doc:
diff = True
if overwrite:
pipeline_doc["sections"] = new_sub_pipeline_doc
new_pipeline_docs.append(pipeline_doc)
# sort overall pipeline doc
new_pipeline_docs = clean_doc_toc(new_pipeline_docs)
if new_pipeline_docs != pipeline_docs:
diff = True
if overwrite:
api_doc[pipeline_idx]["sections"] = new_pipeline_docs
if diff:
if overwrite:
content[api_idx]["sections"] = api_doc
with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
f.write(yaml.dump(content, allow_unicode=True))
else:
raise ValueError(
"The model doc part of the table of content is not properly sorted, run `make style` to fix this."
)
def check_model_doc(overwrite=False):
with open(PATH_TO_TOC, encoding="utf-8") as f:
content = yaml.safe_load(f.read())
# Get to the API doc
api_idx = 0
while content[api_idx]["title"] != "API":
api_idx += 1
api_doc = content[api_idx]["sections"]
# Then to the model doc
model_idx = 0
while api_doc[model_idx]["title"] != "Models":
model_idx += 1
diff = False
model_docs = api_doc[model_idx]["sections"]
new_model_docs = []
# sort sub model docs
for model_doc in model_docs:
if "sections" in model_doc:
sub_model_doc = model_doc["sections"]
new_sub_model_doc = clean_doc_toc(sub_model_doc)
if new_sub_model_doc != sub_model_doc:
diff = True
if overwrite:
model_doc["sections"] = new_sub_model_doc
new_model_docs.append(model_doc)
# sort overall model doc
new_model_docs = clean_doc_toc(new_model_docs)
if new_model_docs != model_docs:
diff = True
if overwrite:
api_doc[model_idx]["sections"] = new_model_docs
if diff:
if overwrite:
content[api_idx]["sections"] = api_doc
with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
f.write(yaml.dump(content, allow_unicode=True))
else:
raise ValueError(
"The model doc part of the table of content is not properly sorted, run `make style` to fix this."
)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--fix_and_overwrite", action="store_true", help="Whether to fix inconsistencies.")
args = parser.parse_args()
check_scheduler_doc(args.fix_and_overwrite)
check_pipeline_doc(args.fix_and_overwrite)
check_model_doc(args.fix_and_overwrite)
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

暂无描述
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/CZJpython/diffusers.git
git@gitee.com:CZJpython/diffusers.git
CZJpython
diffusers
diffusers
main
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /