|
9 | 9 |
|
10 | 10 | import click |
11 | 11 |
|
12 | | -from vlora.io import LoRAWeights, load_adapter, save_adapter |
| 12 | +from vlora.io import load_adapter, save_adapter |
13 | 13 | from vlora.ops import explained_variance_ratio |
14 | 14 | from vlora.subspace import SharedSubspace |
15 | 15 |
|
@@ -65,7 +65,7 @@ def info(subspace_path: str, as_json: bool): |
65 | 65 | click.echo(f" Tasks: {len(sub.tasks)}") |
66 | 66 |
|
67 | 67 | if sub.tasks: |
68 | | - click.echo(f"\n Task IDs:") |
| 68 | + click.echo("\n Task IDs:") |
69 | 69 | for tid in sorted(sub.tasks.keys()): |
70 | 70 | click.echo(f" - {tid}") |
71 | 71 |
|
@@ -102,7 +102,7 @@ def compress(adapter_dirs: tuple[str, ...], output: str, num_components: int | N |
102 | 102 | task_ids.append(path.name) |
103 | 103 | click.echo(f" Loaded: {path.name}") |
104 | 104 |
|
105 | | - click.echo(f" Building subspace...") |
| 105 | + click.echo(" Building subspace...") |
106 | 106 | sub = SharedSubspace.from_adapters( |
107 | 107 | adapters, |
108 | 108 | task_ids=task_ids, |
@@ -210,7 +210,7 @@ def analyze(adapter_dirs: tuple[str, ...], threshold: float, as_json: bool): |
210 | 210 | for n in names: |
211 | 211 | click.echo(f" Loaded: {n}") |
212 | 212 |
|
213 | | - click.echo(f"\n Pairwise Cosine Similarity:") |
| 213 | + click.echo("\n Pairwise Cosine Similarity:") |
214 | 214 | header = " " + " " * 20 + " ".join(f"{n[:8]:>8}" for n in names) |
215 | 215 | click.echo(header) |
216 | 216 | for i, name in enumerate(names): |
@@ -242,7 +242,7 @@ def validate(subspace_path: str): |
242 | 242 | import torch |
243 | 243 |
|
244 | 244 | sub = SharedSubspace.load(subspace_path) |
245 | | - issues = {"errors": [], "warnings": []} |
| 245 | + issues: dict[str, list[str]] = {"errors": [], "warnings": []} |
246 | 246 |
|
247 | 247 | click.echo(f"\n Validating: {subspace_path}") |
248 | 248 | click.echo(f" Tasks: {len(sub.tasks)}, Layers: {len(sub.layer_names)}, k={sub.num_components}") |
@@ -298,7 +298,7 @@ def validate(subspace_path: str): |
298 | 298 | for warn in issues["warnings"]: |
299 | 299 | click.echo(f" [WARN] {warn}") |
300 | 300 | if not issues["errors"] and not issues["warnings"]: |
301 | | - click.echo(f"\n All checks passed.") |
| 301 | + click.echo("\n All checks passed.") |
302 | 302 |
|
303 | 303 | click.echo() |
304 | 304 |
|
@@ -347,7 +347,6 @@ def diff(subspace_path: str, task_a: str, task_b: str): |
347 | 347 | @click.argument("subspace_path", type=click.Path(exists=True)) |
348 | 348 | def benchmark(subspace_path: str): |
349 | 349 | """Benchmark subspace operations: reconstruct, project, absorb.""" |
350 | | - import torch |
351 | 350 |
|
352 | 351 | sub = SharedSubspace.load(subspace_path) |
353 | 352 | task_ids = sorted(sub.tasks.keys()) |
@@ -418,11 +417,11 @@ def merge(adapter_dirs: tuple[str, ...], output: str, method: str, weights: str |
418 | 417 |
|
419 | 418 | fn = MERGE_METHODS[method] |
420 | 419 | if method == "ties": |
421 | | - merged = fn(adapters, density=density, weights=parsed_weights) |
| 420 | + merged = fn(adapters, density=density, weights=parsed_weights) # type: ignore[operator] |
422 | 421 | elif method == "dare": |
423 | | - merged = fn(adapters, drop_rate=drop_rate, weights=parsed_weights, seed=seed) |
| 422 | + merged = fn(adapters, drop_rate=drop_rate, weights=parsed_weights, seed=seed) # type: ignore[operator] |
424 | 423 | else: |
425 | | - merged = fn(adapters, weights=parsed_weights) |
| 424 | + merged = fn(adapters, weights=parsed_weights) # type: ignore[operator] |
426 | 425 |
|
427 | 426 | save_adapter(merged, output) |
428 | 427 | click.echo(f" Merged adapter saved to: {output}") |
|
0 commit comments