mirror of https://github.com/vladmandic/automatic
parent
9013ba7bf1
commit
7a409a9e83
11
installer.py
11
installer.py
|
|
@ -206,7 +206,7 @@ def run(cmd: str, *nargs: str, **kwargs):
|
|||
"env": os.environ,
|
||||
}
|
||||
options |= kwargs # Override defaults with passed kwargs
|
||||
result = subprocess.run(f'"{cmd}" {" ".join(nargs)}', **options, shell=True, capture_output=True, text=True, check=False)
|
||||
result = subprocess.run(f'"{cmd}" {" ".join(nargs)}', **options, shell=True, capture_output=True, text=True)
|
||||
result.stdout = result.stdout.strip()
|
||||
result.stderr = result.stderr.strip()
|
||||
txt = result.stdout
|
||||
|
|
@ -496,7 +496,7 @@ def check_transformers():
|
|||
pkg_transformers = package_spec('transformers')
|
||||
pkg_tokenizers = package_spec('tokenizers')
|
||||
# target_commit = '753d61104116eefc8ffc977327b441ee0c8d599f' # transformers commit hash == 4.57.6
|
||||
target_commit = 'a28c974c7ac74c83dbf379e93ceecc2661730f63' # transformers commit hash == 4.57.6
|
||||
target_commit = "aad13b87ed59f2afcfaebc985f403301887a35fc" # transformers commit hash == 5.3.0
|
||||
if args.use_directml:
|
||||
target_transformers = '4.52.4'
|
||||
target_tokenizers = '0.21.4'
|
||||
|
|
@ -1067,6 +1067,12 @@ def install_gradio():
|
|||
install(pkg, quiet=True)
|
||||
|
||||
|
||||
def install_compel():
|
||||
if installed('compel', quiet=True):
|
||||
return
|
||||
install("compel==2.3.1", no_deps=True)
|
||||
|
||||
|
||||
def install_pydantic():
|
||||
"""
|
||||
if args.new or (sys.version_info >= (3, 14)):
|
||||
|
|
@ -1165,6 +1171,7 @@ def install_requirements():
|
|||
if args.reinstall:
|
||||
log.trace(f'Install: package="{line}" reinstall')
|
||||
_res = install(line, reinstall=args.reinstall)
|
||||
install_compel()
|
||||
install_pydantic()
|
||||
install_opencv()
|
||||
install_scipy()
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ def setup_middleware(app: FastAPI, cmd_opts):
|
|||
app.add_middleware(CORSMiddleware, allow_origin_regex=cmd_opts.cors_regex, allow_methods=['*'], allow_credentials=True, allow_headers=['*'])
|
||||
|
||||
@app.middleware("http")
|
||||
async def log_and_time(req: Request, call_next):
|
||||
async def api_preprocess(req: Request, call_next):
|
||||
log.critical(f'HERE SCOPE: {req.scope}')
|
||||
log.critical(f'HERE client: {req.client}')
|
||||
try:
|
||||
ts = time.time()
|
||||
res: Response = await call_next(req)
|
||||
|
|
@ -53,11 +55,12 @@ def setup_middleware(app: FastAPI, cmd_opts):
|
|||
if (cmd_opts.api_log) and endpoint.startswith('/sdapi'):
|
||||
if any([endpoint.startswith(x) for x in ignore_endpoints]): # noqa C419 # pylint: disable=use-a-generator
|
||||
return res
|
||||
log.info('API user={user} code={code} {prot}/{ver} {method} {endpoint} {cli} {duration}'.format( # pylint: disable=consider-using-f-string, logging-format-interpolation
|
||||
log.info('API user={user} code={code} {prot}/{ver} {method} {endpoint} {cli} {host} {duration}'.format( # pylint: disable=consider-using-f-string, logging-format-interpolation
|
||||
user = app.tokens.get(token) if hasattr(app, 'tokens') else None,
|
||||
code = res.status_code,
|
||||
ver = req.scope.get('http_version', '0.0'),
|
||||
cli = req.scope.get('client', ('0:0.0.0', 0))[0],
|
||||
host = req.client.host,
|
||||
prot = req.scope.get('scheme', 'err'),
|
||||
method = req.scope.get('method', 'err'),
|
||||
endpoint = endpoint,
|
||||
|
|
@ -65,7 +68,7 @@ def setup_middleware(app: FastAPI, cmd_opts):
|
|||
))
|
||||
return res
|
||||
except CancelledError:
|
||||
log.warning('WebSocket closed (ignore asyncio.exceptions.CancelledError)')
|
||||
log.warning('WebSocket closed')
|
||||
except BaseException as e:
|
||||
return handle_exception(req, e)
|
||||
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ messages_control.disable=[
|
|||
"raw-checker-failed",
|
||||
"simplifiable-if-expression",
|
||||
"suppressed-message",
|
||||
"subprocess-run-check",
|
||||
"too-few-public-methods",
|
||||
"too-many-instance-attributes",
|
||||
"too-many-locals",
|
||||
|
|
|
|||
Loading…
Reference in New Issue