Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
xyang16 committed Nov 14, 2024
1 parent fa18bad commit 6e5a0cb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ def validate_long_lora_scaling_factors(cls, val):
if isinstance(val, str):
val = ast.literal_eval(val)
if not isinstance(val, tuple):
raise ValueError("long_lora_scaling_factors must be tuple")
if isinstance(val, list):
val = tuple(val)
elif isinstance(val, float):
val = (val, )
elif isinstance(val, (int, long)):
val = (float(val), )
else:
raise ValueError("long_lora_scaling_factors must be tuple")
return val

@field_validator('limit_mm_per_prompt', mode="before")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ def validate_long_lora_scaling_factors(cls, val):
if isinstance(val, str):
val = ast.literal_eval(val)
if not isinstance(val, tuple):
raise ValueError("long_lora_scaling_factors must be tuple")
if isinstance(val, list):
val = tuple(val)
elif isinstance(val, float):
val = (val, )
elif isinstance(val, (int, long)):
val = (float(val), )
else:
raise ValueError("long_lora_scaling_factors must be tuple")
return val

@field_validator('limit_mm_per_prompt', mode="before")
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/llm/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@
"option.fully_sharded_loras":
"true",
"option.long_lora_scaling_factors":
"(4.0, )",
4.0,
"adapter_ids": [
"UnderstandLing/Llama-3-8B-Instruct-fr",
"UnderstandLing/Llama-3-8B-Instruct-es",
Expand Down Expand Up @@ -831,7 +831,7 @@
"option.fully_sharded_loras":
"true",
"option.long_lora_scaling_factors":
"(4.0, )",
4.0,
"adapter_ids": [
"UnderstandLing/Llama-3-8B-Instruct-fr",
"UnderstandLing/Llama-3-8B-Instruct-es",
Expand Down

0 comments on commit 6e5a0cb

Please sign in to comment.