mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
Merge branch 'dev' into feature/chroma-support
This commit is contained in:
+25
-1
@@ -97,6 +97,27 @@ class NetworkOnDisk:
|
||||
if not self.hash:
|
||||
self.set_hash(hashes.sha256(self.filename, "lora/" + self.name, use_addnet_hash=self.is_safetensors) or '')
|
||||
|
||||
def get_info(self):
|
||||
data = {}
|
||||
if shared.cmd_opts.no_metadata:
|
||||
return data
|
||||
if self.filename is not None:
|
||||
fn = os.path.splitext(self.filename)[0] + '.json'
|
||||
if os.path.exists(fn):
|
||||
data = shared.readfile(fn, silent=True)
|
||||
if type(data) is list:
|
||||
data = data[0]
|
||||
return data
|
||||
|
||||
def get_desc(self):
|
||||
if shared.cmd_opts.no_metadata:
|
||||
return None
|
||||
if self.filename is not None:
|
||||
fn = os.path.splitext(self.filename)[0] + '.txt'
|
||||
if os.path.exists(fn):
|
||||
return shared.readfile(fn, silent=True)
|
||||
return None
|
||||
|
||||
def get_alias(self):
|
||||
if shared.opts.lora_preferred_name == "filename":
|
||||
return self.name
|
||||
@@ -131,7 +152,10 @@ class NetworkModule:
|
||||
self.sd_key = weights.sd_key
|
||||
self.sd_module = weights.sd_module
|
||||
if hasattr(self.sd_module, 'weight'):
|
||||
self.shape = self.sd_module.weight.shape
|
||||
if hasattr(self.sd_module, "sdnq_dequantizer"):
|
||||
self.shape = self.sd_module.sdnq_dequantizer.original_shape
|
||||
else:
|
||||
self.shape = self.sd_module.weight.shape
|
||||
self.dim = None
|
||||
self.bias = weights.w.get("bias")
|
||||
self.alpha = weights.w["alpha"].item() if "alpha" in weights.w else None
|
||||
|
||||
Reference in New Issue
Block a user