[docs] 14 code examples fail to parse (missing commas, words split mid-line in zh translations)

未关闭
#15,440 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@daluan217 已经在做这个了。

开始于 2026年11月30日。

  • #15441 来自 @daluan217 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
10/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python, pytorch
领域
documentation

调研方向

The issue lists affected Markdown files under api/models, api/pipelines, using-diffusers, optimization, tutorials, and modular_diffusers. Start by checking the linked pull request #15441 and compare each reported Python example with its English counterpart. Done means the reported code blocks parse successfully, with remaining failures limited to printed representations as described.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

These Python examples raise SyntaxError when copied:

  • en: api/models/hunyuan_video15_transformer_3d.md (missing comma before subfolder=), api/pipelines/ltx_video.md (missing comma after the GGUF URL), using-diffusers/text-img2vid.md (from diffusers importAutoModel)
  • ko: using-diffusers/loading_adapters.md (indentation made of non-breaking spaces, U+00A0)
  • zh: identifiers split across lines, e.g. unet.to(memory / _format=...), residual_diff_thre / shold, ty / pe_hint, "h / ttps://...", ["contr / olnet_denoise", ...]. Also pipe line= ..., import compile regions, a missing comma after adapter_name="cinematic", a missing ), and two indentation slips. Files: optimization/{cache,fp16,memory,para_attn}.md, tutorials/using_peft_for_inference.md, modular_diffusers/{modular_pipeline,components_manager,sequential_pipeline_blocks,quickstart,pipeline_block}.md
Reproduction

From docs/source/en/api/models/hunyuan_video15_transformer_3d.md:

transformer = HunyuanVideo15Transformer3DModel.from_pretrained("hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-480p_t2v" subfolder="transformer", dtype=torch.bfloat16)
# SyntaxError: invalid syntax. Perhaps you forgot a comma?

Running ast.parse on every Python block in these 14 files finds 17 failures on main (08d5de3).

Context

Each fix is the smallest edit that matches the English page. With them, 3 failures remain, and those are printed reprs (ComponentSpec(... type_hint=<class ...>)), not code. I have the branch ready and would open one PR after a maintainer confirms the scope, with the self-review notes included.

I found these with an AI coding assistant and checked each edit by hand.

Logs

No response

System Info

Documentation only; checked with Python 3.12 ast.parse.

Who can help?

@stevhliu @sayakpaul

主要语言
Python
星标
35k
派生
7.5k
平均合并
2 天 22 小时
30 天内合并 PR
58

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

huggingface/diffusers 的其他 Issue

查看 huggingface/diffusers 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。