Can you enable a two pipe solution for those with Unified Memory Architecture ?
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
Start by reading LensPipeline.__init__ and the prompt-handling paths used by encode_prompt and pipeline invocation. Trace how configuration and optional models are loaded, then identify where None prompt inputs are converted to lists. The work is complete when text encoding can run separately, the text encoder can be removed, and prompt embeddings, masks, and negative prompts are accepted without errors.
由索引模型根据 Issue 内容生成。
描述
With Diffusers style Pipelines its a common pattern to split the Pipeline into 2, one to do the text encoding and one to do run the transformer integration. This is done so we can throw the Text encoder out of memory once its been finished with.
e.g.
with torch.no_grad():
te_pipe = LensPipeline.from_pretrained(
"microsoft/Lens", torch_dtype=torch.bfloat16,
transformer=None, vae=None
).to("mps")
prompt_embeds, prompt_mask, negative_prompt_embeds, negative_prompt_mask = te_pipe.encode_prompt(
prompt=prompt,
negative_prompt=""
)
del te_pipe
import gc
gc.collect()
torch.mps.empty_cache()
gc.collect()
torch.mps.empty_cache()
pipe = LensPipeline.from_pretrained(
"microsoft/Lens", torch_dtype=torch.bfloat16,
text_encoder=None,
).to("mps")
image = pipe(
prompt_embeds=prompt_embeds,
prompt_mask=prompt_mask,
negative_prompt_embeds=negative_prompt_embeds,
negative_prompt_mask=negative_prompt_mask,
base_resolution=1440, aspect_ratio="1:1",
num_inference_steps=20, guidance_scale=5.0,
generator=torch.Generator("mps").manual_seed(0),
).images[0]
Unfortunately Lens has a few coding barriers, the init for the pipeline assumes all the models are there, using config values.
Using the prompt embeds is broken, the code that copies the prompts into list form does not have a guard for the prompt being None, and the same for the negative prompt
- 主要语言
- Python
- 星标
- 2
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/Lens 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 12/100
-
难度 4/5 3-5 天 新手友好度 30/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 42/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
GoogleCloudPlatform/gce-rescue#195 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
intake mcp-intake needs-ac needs-human-review priority:medium
难度 2/5 1-3 小时 新手友好度 67/100
Ikalus1988/MisakaNet#3848 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
521xueweihan/HelloGitHub#4105 ·
-
bug size:XS
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复