tenseleyflow/sway / 498b85e

Browse files

backends/hf: drop duplicate adapter-path normalization, lean on ModelSpec validator (B22)

Authored by espadonne
SHA
498b85ecc9e1a92cb2214f6cbbac160ad60807a7
Parents
9844d7d
Tree
23f275b

1 changed file

StatusFile+-
M src/dlm_sway/backends/hf.py 6 1
src/dlm_sway/backends/hf.pymodified
@@ -215,7 +215,12 @@ class HuggingFaceDifferentialBackend:
215215
         torch, transformers, peft = _require_hf()
216216
         self._torch = torch
217217
         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()
219224
 
220225
         device_str: Device = (
221226
             _detect_device() if base_spec.device == "auto" else base_spec.device  # type: ignore[assignment]