huggingface / huggingface/diffusers

[Community] Only half of my cpu cores are being used?

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

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

bug Good second issue
主要言語
Python
スター
34.5k
フォーク
7.3k
平均マージ
3日 3時間
マージ済み PR(30日)
91

説明

Describe the bug

Only about half of my cpus are used.
I have 8 cores, but only 4 are used. Is there way to fix this?
image
image
^ The spikes are when diffussers is generating something

Reproduction

My code:

print("Hello, World")

import secrets
import gradio as gr
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
from PIL import Image

print("Deps loaded!")

model_id = "CompVis/stable-diffusion-v1-4"
device = "cpu"

pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
pipe = pipe.to(device)

print("Loaded!")

def predict(name):
    print(f"Prompt: {name}")
    prompt = name
    with autocast("cuda"):
        image = pipe(prompt, guidance_scale=7.5, width=512, height=512, num_inference_steps=20).images[0]

    id = secrets.token_urlsafe(16)
    image.save(f"./out/{id}.png")

    return image

print("Starting...")
demo = gr.Interface(
    predict,
    inputs=[
        gr.inputs.Textbox(label='Prompt', default='a chalk pastel drawing of a llama wearing a wizard hat')
    ],
    outputs=gr.Image(shape=[512,512], type="pil", elem_id="output_image"),
    css="#output_image{width: 512px; height: 512px}",
    title="Retslav -  Text To Image - Stable Diffusion",
    description="Retslav Stable Diffussion",
)

demo.launch(server_port=3000)
Logs
-
System Info
  • diffusers version: 0.6.0
  • Platform: Linux-5.4.0-125-generic-x86_64-with-glibc2.29
  • Python version: 3.8.10
  • PyTorch version (GPU?): 1.13.0+cpu (False)
  • Huggingface_hub version: 0.10.1
  • Transformers version: 4.23.1
  • Using GPU in script?: NO
  • Using distributed or parallel set-up in script?: NO

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

提供された再現スクリプト、特に StableDiffusionPipeline と .to("cpu") のパスから始め、指定された Python、PyTorch、diffusers、Linux のバージョンで報告された使用率を再現します。CPU 生成とスレッド使用がどのように設定されているかを調査し、確認済みの原因と再現可能な修正または制限事項を文書化します。完了の条件は、生成が期待される利用可能なコアを使用すること、またはその挙動が明確に説明されていることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, pytorch
領域
machine-learning, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

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

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