Skip to content

Commit a271b0b

Browse files
fix(fish-speech): resolve relocated source
The editable install records the backend build path, which does not exist after LocalAI relocates the packaged backend. Add the runtime source directory to PYTHONPATH so inference modules remain importable. Assisted-by: Codex:gpt-5
1 parent 0761bd0 commit a271b0b

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

backend/python/fish-speech/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
.PHONY: fish-speech test-source-preparation
2-
fish-speech: test-source-preparation
1+
.PHONY: fish-speech test-source-preparation test-runtime-import
2+
fish-speech: test-source-preparation test-runtime-import
33
bash install.sh
44

55
test-source-preparation:
66
bash prepare-source_test.sh
77

8+
test-runtime-import:
9+
bash run_test.sh
10+
811
.PHONY: run
912
run: fish-speech
1013
@echo "Running fish-speech..."

backend/python/fish-speech/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
2-
backend_dir=$(dirname $0)
2+
backend_dir=$(dirname "$(realpath "$0")")
33
if [ -d $backend_dir/common ]; then
44
source $backend_dir/common/libbackend.sh
55
else
66
source $backend_dir/../common/libbackend.sh
77
fi
88

9+
export PYTHONPATH="${backend_dir}/fish-speech-src${PYTHONPATH:+:${PYTHONPATH}}"
10+
911
startBackend $@
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
5+
WORK_DIR=$(mktemp -d)
6+
trap 'rm -rf "$WORK_DIR"' EXIT
7+
8+
mkdir -p "$WORK_DIR/runtime/common" "$WORK_DIR/runtime/fish-speech-src/fish_speech"
9+
cp "$SCRIPT_DIR/run.sh" "$WORK_DIR/runtime/run.sh"
10+
11+
cat > "$WORK_DIR/runtime/fish-speech-src/fish_speech/inference_engine.py" <<'PY'
12+
IMPORT_OK = True
13+
PY
14+
15+
cat > "$WORK_DIR/runtime/common/libbackend.sh" <<'SH'
16+
startBackend() {
17+
python3 -c 'from fish_speech.inference_engine import IMPORT_OK; assert IMPORT_OK'
18+
}
19+
SH
20+
21+
bash "$WORK_DIR/runtime/run.sh"
22+
23+
echo "PASS: runtime launcher imports relocated fish-speech source"

0 commit comments

Comments
 (0)