MCPcopy Create free account
hub / github.com/CompVis/diff2flow / setattr_recursive

Function setattr_recursive

diff2flow/lora.py:16–23  ·  view source on GitHub ↗
(obj: Any, path: str, value: Any)

Source from the content-addressed store, hash-verified

14target_modules: list[str] = ["to_q", "to_k", "to_v", "query", "key", "value"]
15
16def setattr_recursive(obj: Any, path: str, value: Any) -> None:
17 parts = path.split('.')
18 for part in parts[:-1]:
19 if part.isnumeric():
20 obj = obj[int(part)]
21 else:
22 obj = getattr(obj, part)
23 setattr(obj, parts[-1], value)
24
25class DataProvider:
26 def __init__(self):

Callers 1

add_lora_to_unetMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected