backends/hf: drop duplicate adapter-path normalization, lean on ModelSpec validator (B22)
- SHA
498b85ecc9e1a92cb2214f6cbbac160ad60807a7- Parents
-
9844d7d - Tree
23f275b
498b85e
498b85ecc9e1a92cb2214f6cbbac160ad60807a79844d7d
23f275b| Status | File | + | - |
|---|---|---|---|
| M |
src/dlm_sway/backends/hf.py
|
6 | 1 |
src/dlm_sway/backends/hf.pymodified@@ -215,7 +215,12 @@ class HuggingFaceDifferentialBackend: | ||
| 215 | 215 | torch, transformers, peft = _require_hf() |
| 216 | 216 | self._torch = torch |
| 217 | 217 | self._spec = base_spec |
| 218 | - self._adapter_path = Path(adapter_path).expanduser().resolve() | |
| 218 | + # Path normalization lives in ``ModelSpec.adapter`` (B22). When | |
| 219 | + # the backend is constructed via ``backends.build``, the value | |
| 220 | + # is already absolute. Direct constructions (some tests) may | |
| 221 | + # pass a relative path, so ``Path(...).resolve()`` stays as a | |
| 222 | + # cheap idempotent fallback. | |
| 223 | + self._adapter_path = Path(adapter_path).resolve() | |
| 219 | 224 | |
| 220 | 225 | device_str: Device = ( |
| 221 | 226 | _detect_device() if base_spec.device == "auto" else base_spec.device # type: ignore[assignment] |