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 os
import toml import toml
from pathlib import Path
from .constants import DEFAULT_CONFIG_PATH from .constants import DEFAULT_CONFIG_PATH

View File

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

View File

@ -8,11 +8,18 @@ import asyncio
from decimal import Decimal from decimal import Decimal
from hashlib import sha256 from hashlib import sha256
from datetime import datetime from datetime import datetime
from contextlib import ExitStack, AsyncExitStack from contextlib import (
ExitStack,
AsyncExitStack,
)
from contextlib import asynccontextmanager as acm from contextlib import asynccontextmanager as acm
from leap.cleos import CLEOS 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 leap.hyperion import HyperionAPI
# from telebot.types import InputMediaPhoto # from telebot.types import InputMediaPhoto

View File

@ -9,9 +9,7 @@ import logging
import importlib import importlib
from typing import Optional from typing import Optional
from pathlib import Path
import trio
import torch import torch
import numpy as np 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) return custom_pipeline.pipeline_for(model, mode, mem_fraction=mem_fraction, cache_dir=cache_dir)
except ImportError: except ImportError:
# TODO, uhh why not warn/error log this?
... ...