MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / get_adapter_info

Function get_adapter_info

core/lora_import.py:87–122  ·  view source on GitHub ↗

Get information about a LoRA adapter. Args: adapter_path: Path to adapter directory Returns: Dict with adapter information

(adapter_path: str)

Source from the content-addressed store, hash-verified

85
86
87def get_adapter_info(adapter_path: str) -> Dict:
88 """
89 Get information about a LoRA adapter.
90
91 Args:
92 adapter_path: Path to adapter directory
93
94 Returns:
95 Dict with adapter information
96 """
97 adapter_dir = Path(adapter_path)
98 info_dict = {
99 "path": str(adapter_dir),
100 "size_mb": 0,
101 "base_model": "unknown",
102 "lora_r": "unknown",
103 "lora_alpha": "unknown",
104 }
105
106 # Calculate size
107 total_size = sum(f.stat().st_size for f in adapter_dir.rglob("*") if f.is_file())
108 info_dict["size_mb"] = total_size / (1024 * 1024)
109
110 # Read config
111 config_path = adapter_dir / "adapter_config.json"
112 if config_path.exists():
113 try:
114 with open(config_path) as f:
115 config = json.load(f)
116 info_dict["base_model"] = config.get("base_model_name_or_path", "unknown")
117 info_dict["lora_r"] = config.get("r", "unknown")
118 info_dict["lora_alpha"] = config.get("lora_alpha", "unknown")
119 except:
120 pass
121
122 return info_dict
123
124
125# =============================================================================

Callers 2

test_get_infoMethod · 0.90
import_lora_adapterFunction · 0.85

Calls 4

is_fileMethod · 0.80
existsMethod · 0.80
loadMethod · 0.80
getMethod · 0.45

Tested by 1

test_get_infoMethod · 0.72