lllyasviel / lllyasviel/stable-diffusion-webui-forge

Generation completes prematurely but still returns an image

Open
#2,767 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I'm building a Telegram bot for webui_forge_cu121_torch231 that uses the API for all requests. The issue I'm encountering is that the generation process doesn't fully complete, yet it still outputs an image.

Here's my current implementation:
`

async def generate_image(update: Update, context: ContextTypes.DEFAULT_TYPE):
prompt = " ".join(context.args) if context.args else "random cute animal"

payload = {
"prompt": prompt,
"steps": 8,
"width": 512,
"height": 512,
"sampler_name": "DPM++ 2M Karras"
}

await update.message.reply_text(f"🔄 Генерирую: '{prompt}'...")

try:
response = requests.post(SD_API_URL, json=payload)
response.raise_for_status()
result = response.json()

image_data = result["images"][0]
with open("generated_image.png", "wb") as f:
f.write(base64.b64decode(image_data))

with open("generated_image.png", "rb") as photo:
await update.message.reply_photo(photo=photo, caption=f"🎨 Результат: '{prompt}'")

except Exception as e:
await update.message.reply_text(f"❌ Ошибка: {str(e)}")
`

[pic](https://drive.google.com/file/d/1xum1dnmnOwqeope37CuoFE9WSpOYpaU3/view?usp=sharing)

Contributor guide

No contributing guide indexed for this repository

Research direction

The report provides only an external Python Telegram bot and a POST payload; it names no Forge file, entry point, or test. Start by reproducing the request against the API with the shown settings and determine whether the returned image is produced before generation completes. Done means identifying a Forge-side reproduction and a specific project change or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.