Skip to content

Commit

Permalink
remove hijack access
Browse files Browse the repository at this point in the history
  • Loading branch information
vladmandic committed Jan 10, 2024
1 parent f505988 commit 99ad403
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions scripts/system-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from html.parser import HTMLParser
import torch
import gradio as gr
from modules import paths, script_callbacks, sd_hijack, sd_models, sd_samplers, shared, extensions, devices
from modules import paths, script_callbacks, sd_models, sd_samplers, shared, extensions, devices
from benchmark import run_benchmark, submit_benchmark # pylint: disable=E0401,E0611,C0411


Expand Down Expand Up @@ -299,17 +299,12 @@ def get_version():
return version


def get_embeddings():
return sorted([f'{v} ({sd_hijack.model_hijack.embedding_db.word_embeddings[v].vectors})' for i, v in enumerate(sd_hijack.model_hijack.embedding_db.word_embeddings)])


def get_skipped():
return sorted([k for k in sd_hijack.model_hijack.embedding_db.skipped_embeddings.keys()])


def get_crossattention():
try:
ca = sd_hijack.model_hijack.optimization_method or getattr(shared.opts, 'cross_attention_optimization', 'none')
ca = getattr(shared.opts, 'cross_attention_optimization', None)
if ca is None:
from modules import sd_hijack
ca = sd_hijack.model_hijack.optimization_method
return ca
except Exception:
return 'unknown'
Expand Down Expand Up @@ -368,10 +363,6 @@ def get_loras():
return loras


def get_lycos():
return []


def get_device():
dev = {
'active': str(devices.device),
Expand Down Expand Up @@ -408,11 +399,7 @@ def get_full_data():
global networks # pylint: disable=global-statement
networks = {
'models': get_models(),
'hypernetworks': [name for name in shared.hypernetworks],
'embeddings': get_embeddings(),
'skipped': get_skipped(),
'loras': get_loras(),
'lycos': get_lycos(),
}
return data

Expand Down Expand Up @@ -445,7 +432,7 @@ def refresh_info_quick(_old_data = None):

def refresh_info_full():
get_full_data()
return data['uptime'], dict2text(data['version']), dict2text(data['state']), dict2text(data['memory']), dict2text(data['platform']), data['torch'], dict2text(data['gpu']), list2text(data['optimizations']), data['crossattention'], data['backend'], data['pipeline'], dict2text(data['libs']), dict2text(data['repos']), dict2text(data['device']), dict2text(data['model']), networks['models'], networks['hypernetworks'], networks['embeddings'], networks['skipped'], networks['loras'], networks['lycos'], data['timestamp'], data
return data['uptime'], dict2text(data['version']), dict2text(data['state']), dict2text(data['memory']), dict2text(data['platform']), data['torch'], dict2text(data['gpu']), list2text(data['optimizations']), data['crossattention'], data['backend'], data['pipeline'], dict2text(data['libs']), dict2text(data['repos']), dict2text(data['device']), dict2text(data['model']), networks['models'], networks['loras'], data['timestamp'], data


### ui definition
Expand Down Expand Up @@ -533,19 +520,14 @@ def create_ui(blocks: gr.Blocks = None):
models = gr.JSON(networks['models'], label = 'Models')
with gr.Column():
loras = gr.JSON(networks['loras'], label = 'Available LORA')
lycos = gr.JSON(networks['lycos'], label = 'Available LyCORIS')
with gr.Column():
embeddings = gr.JSON(networks['embeddings'], label = 'Embeddings: loaded')
skipped = gr.JSON(networks['skipped'], label = 'Embeddings: skipped')
hypernetworks = gr.JSON(networks['hypernetworks'], label = 'Hypernetworks')

refresh_quick_btn.click(refresh_info_quick, _js='receive_system_info', show_progress = False,
inputs = [js],
outputs = [statetxt, memorytxt, attentiontxt, timestamp, js]
)
refresh_full_btn.click(refresh_info_full, show_progress = False,
inputs = [],
outputs = [uptimetxt, versiontxt, statetxt, memorytxt, platformtxt, torchtxt, gputxt, opttxt, attentiontxt, backendtxt, pipelinetxt, libstxt, repostxt, devtxt, modeltxt, models, hypernetworks, embeddings, skipped, loras, lycos, timestamp, js]
outputs = [uptimetxt, versiontxt, statetxt, memorytxt, platformtxt, torchtxt, gputxt, opttxt, attentiontxt, backendtxt, pipelinetxt, libstxt, repostxt, devtxt, modeltxt, models, loras, timestamp, js]
)
interrupt_btn.click(shared.state.interrupt, inputs = [], outputs = [])

Expand Down

0 comments on commit 99ad403

Please sign in to comment.