Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Can you enable a two pipe solution for those with Unified Memory Architecture ?

オープン
#5 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/Lens のほかの issue

microsoft/Lens の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。