Fix linting issues
This commit is contained in:
parent
fd0add32dd
commit
6ef9ceb259
@ -28,8 +28,6 @@ class JointAttention(nn.Module):
|
|||||||
encoder_hidden_states: mx.array,
|
encoder_hidden_states: mx.array,
|
||||||
image_rotary_emb: mx.array,
|
image_rotary_emb: mx.array,
|
||||||
) -> (mx.array, mx.array):
|
) -> (mx.array, mx.array):
|
||||||
residual = hidden_states
|
|
||||||
|
|
||||||
query = self.to_q(hidden_states)
|
query = self.to_q(hidden_states)
|
||||||
key = self.to_k(hidden_states)
|
key = self.to_k(hidden_states)
|
||||||
value = self.to_v(hidden_states)
|
value = self.to_v(hidden_states)
|
||||||
|
|||||||
@ -83,15 +83,6 @@ class GeneratedImage:
|
|||||||
# Define the UserComment tag ID
|
# Define the UserComment tag ID
|
||||||
USER_COMMENT_TAG_ID = 0x9286
|
USER_COMMENT_TAG_ID = 0x9286
|
||||||
|
|
||||||
# Create an EXIF dictionary
|
|
||||||
exif_dict = {
|
|
||||||
"0th": {},
|
|
||||||
"Exif": {USER_COMMENT_TAG_ID: user_comment_bytes},
|
|
||||||
"GPS": {},
|
|
||||||
"1st": {},
|
|
||||||
"thumbnail": None,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a piexif-compatible dictionary structure
|
# Create a piexif-compatible dictionary structure
|
||||||
exif_piexif_dict = {"Exif": {USER_COMMENT_TAG_ID: user_comment_bytes}}
|
exif_piexif_dict = {"Exif": {USER_COMMENT_TAG_ID: user_comment_bytes}}
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,6 @@ class LoRAConverter:
|
|||||||
def _load_pytorch_weights(lora_path: str) -> dict:
|
def _load_pytorch_weights(lora_path: str) -> dict:
|
||||||
state_dict = {}
|
state_dict = {}
|
||||||
with safe_open(lora_path, framework="pt") as f:
|
with safe_open(lora_path, framework="pt") as f:
|
||||||
metadata = f.metadata()
|
|
||||||
for k in f.keys():
|
for k in f.keys():
|
||||||
state_dict[k] = f.get_tensor(k)
|
state_dict[k] = f.get_tensor(k)
|
||||||
return state_dict
|
return state_dict
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class LoraUtil:
|
|||||||
if parentKey not in visited:
|
if parentKey not in visited:
|
||||||
visited[parentKey] = {}
|
visited[parentKey] = {}
|
||||||
visited[parentKey][splitKey] = weight
|
visited[parentKey][splitKey] = weight
|
||||||
if not "weight" in target:
|
if "weight" not in target:
|
||||||
raise ValueError(f"LoRA weights for layer {parentKey} cannot be loaded into the model.")
|
raise ValueError(f"LoRA weights for layer {parentKey} cannot be loaded into the model.")
|
||||||
if "lora_A" in visited[parentKey] and "lora_B" in visited[parentKey]:
|
if "lora_A" in visited[parentKey] and "lora_B" in visited[parentKey]:
|
||||||
lora_a = visited[parentKey]["lora_A"]
|
lora_a = visited[parentKey]["lora_A"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user