|
@@ -120,18 +120,22 @@ async fn symlink_source(
|
|
|
// inside the container where the HF cache is mounted at that exact path.
|
|
// inside the container where the HF cache is mounted at that exact path.
|
|
|
// `ln -snf`: -s symlink, -n no-deref (treat existing symlink as a file,
|
|
// `ln -snf`: -s symlink, -n no-deref (treat existing symlink as a file,
|
|
|
// don't dive into the dir it points to), -f force (overwrite earlier).
|
|
// don't dive into the dir it points to), -f force (overwrite earlier).
|
|
|
|
|
+ //
|
|
|
|
|
+ // Paths are assembled via `printf` (not embedded in double-quoted
|
|
|
|
|
+ // assignments) so shq's single-quote wrapping doesn't become literal
|
|
|
|
|
+ // characters in the path — same pattern as resolve_path_ref_on_node.
|
|
|
let cmd = format!(
|
|
let cmd = format!(
|
|
|
"ref=\"$(cat {refs_q} 2>/dev/null)\" && test -n \"$ref\" && \
|
|
"ref=\"$(cat {refs_q} 2>/dev/null)\" && test -n \"$ref\" && \
|
|
|
- snap=\"{cache}/hub/{model}/snapshots/$ref\" && \
|
|
|
|
|
|
|
+ snap=\"$(printf '%s/hub/%s/snapshots/%s' {cache_q} {model_q} \"$ref\")\" && \
|
|
|
test -d \"$snap\" && \
|
|
test -d \"$snap\" && \
|
|
|
- csnap=\"/root/.cache/huggingface/hub/{model}/snapshots/$ref\" && \
|
|
|
|
|
|
|
+ csnap=\"$(printf '/root/.cache/huggingface/hub/%s/snapshots/%s' {model_q} \"$ref\")\" && \
|
|
|
for f in \"$snap\"/{glob}; do \
|
|
for f in \"$snap\"/{glob}; do \
|
|
|
[ -e \"$f\" ] || [ -L \"$f\" ] || continue; \
|
|
[ -e \"$f\" ] || [ -L \"$f\" ] || continue; \
|
|
|
ln -snf \"$csnap/$(basename \"$f\")\" {host_q}/; \
|
|
ln -snf \"$csnap/$(basename \"$f\")\" {host_q}/; \
|
|
|
done",
|
|
done",
|
|
|
refs_q = shq(&refs_path),
|
|
refs_q = shq(&refs_path),
|
|
|
- cache = shq(cache_str),
|
|
|
|
|
- model = shq(&model_dir),
|
|
|
|
|
|
|
+ cache_q = shq(cache_str),
|
|
|
|
|
+ model_q = shq(&model_dir),
|
|
|
host_q = shq(host_path),
|
|
host_q = shq(host_path),
|
|
|
);
|
|
);
|
|
|
|
|
|