mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
fix loading hypernetwork
This commit is contained in:
@@ -187,7 +187,10 @@ function setupExtraNetworksForTab(tabname) {
|
||||
|
||||
const intersectionObserver = new IntersectionObserver((entries) => {
|
||||
if (!en) return;
|
||||
for (const el of Array.from(gradioApp().querySelectorAll('.extra-networks-page'))) el.style.height = `${window.opts.extra_networks_height}vh`;
|
||||
for (const el of Array.from(gradioApp().querySelectorAll('.extra-networks-page'))) {
|
||||
el.style.height = `${window.opts.extra_networks_height}vh`;
|
||||
el.parentElement.style.width = '-webkit-fill-available';
|
||||
}
|
||||
if (entries[0].intersectionRatio > 0) {
|
||||
if (window.opts.extra_networks_card_cover === 'cover') {
|
||||
en.style.transition = '';
|
||||
|
||||
@@ -221,10 +221,10 @@ class Hypernetwork:
|
||||
torch.save(optimizer_saved_dict, f"{filename}.optim")
|
||||
|
||||
def load(self, filename):
|
||||
self.filename = filename
|
||||
self.filename = filename if os.path.exists(filename) else os.path.join(shared.opts.hypernetwork_dir, filename)
|
||||
if self.name is None:
|
||||
self.name = os.path.splitext(os.path.basename(filename))[0]
|
||||
with progress.open(filename, 'rb', description=f'Loading hypernetwork: [cyan]{filename}', auto_refresh=True, console=shared.console) as f:
|
||||
self.name = os.path.splitext(os.path.basename(self.filename))[0]
|
||||
with progress.open(self.filename, 'rb', description=f'Loading hypernetwork: [cyan]{self.filename}', auto_refresh=True, console=shared.console) as f:
|
||||
state_dict = torch.load(f, map_location='cpu')
|
||||
self.layer_structure = state_dict.get('layer_structure', [1, 2, 1])
|
||||
self.optional_info = state_dict.get('optional_info', None)
|
||||
|
||||
Reference in New Issue
Block a user