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

Function getattr_recursive

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

Source from the content-addressed store, hash-verified

3from typing import Union, Tuple, Any
4
5def getattr_recursive(obj: Any, path: str) -> Any:
6 parts = path.split('.')
7 for part in parts:
8 if part.isnumeric():
9 obj = obj[int(part)]
10 else:
11 obj = getattr(obj, part)
12 return obj
13
14target_modules: list[str] = ["to_q", "to_k", "to_v", "query", "key", "value"]
15

Callers 1

add_lora_to_unetMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected