Some more `import` fixes

Removing unused imports in a few modules as well as converting a few
more tuple imports to multi-line style.

We should prolly consider a linter as part of pre-merge machinery;
I noticed a few pretty low hanging pep8 violations just spelunking rando
modules ;)
pull/48/merge
Tyler Goodlet 2025-02-03 10:44:01 -05:00
parent 7cb9f09d95
commit fd3e0feffe
4 changed files with 15 additions and 9 deletions

View File

@ -3,8 +3,6 @@
import os
import toml
from pathlib import Path
from .constants import DEFAULT_CONFIG_PATH

View File

@ -1,22 +1,24 @@
#!/usr/bin/python
import msgspec
from typing import Literal
VERSION = '0.1a12'
DOCKER_RUNTIME_CUDA = 'skynet:runtime-cuda'
import msgspec
from typing import Literal
class Size(msgspec.Struct):
w: int
h: int
class ModelDesc(msgspec.Struct):
short: str
mem: float
size: Size
tags: list[Literal['txt2img', 'img2img', 'inpaint']]
MODELS: dict[str, ModelDesc] = {
'runwayml/stable-diffusion-v1-5': ModelDesc(
short='stable',

View File

@ -8,11 +8,18 @@ import asyncio
from decimal import Decimal
from hashlib import sha256
from datetime import datetime
from contextlib import ExitStack, AsyncExitStack
from contextlib import (
ExitStack,
AsyncExitStack,
)
from contextlib import asynccontextmanager as acm
from leap.cleos import CLEOS
from leap.sugar import Name, asset_from_str, collect_stdout
from leap.sugar import (
Name,
asset_from_str,
collect_stdout,
)
from leap.hyperion import HyperionAPI
# from telebot.types import InputMediaPhoto

View File

@ -9,9 +9,7 @@ import logging
import importlib
from typing import Optional
from pathlib import Path
import trio
import torch
import numpy as np
@ -112,6 +110,7 @@ def pipeline_for(
return custom_pipeline.pipeline_for(model, mode, mem_fraction=mem_fraction, cache_dir=cache_dir)
except ImportError:
# TODO, uhh why not warn/error log this?
...
@ -159,7 +158,7 @@ def pipeline_for(
if mode == 'txt2img':
pipe.vae.enable_tiling()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()
else: