Synchronize canonical AI-radio asset payload.
Browse files- .gitattributes +3 -0
- .phorcys-artifact-provenance.json +16 -0
- README.md +27 -3
- dot-venv.phzip +3 -0
- pyLib.phzip +3 -0
- requirements.phzip +0 -0
- runtime_bootstrap.py +275 -0
- runtime_manifest.json +55 -0
- verify_runtime.py +36 -0
- wheelhouse.phzip +3 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
dot-venv.phzip filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
pyLib.phzip filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
wheelhouse.phzip filter=lfs diff=lfs merge=lfs -text
|
.phorcys-artifact-provenance.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"SchemaVersion": "phorcys.artifact-provenance.v1",
|
| 3 |
+
"RepositoryId": "stokiz/fish-audio-s2-python-runtime",
|
| 4 |
+
"AssetId": "fish-audio-s2-python-runtime",
|
| 5 |
+
"ProjectName": "Phorcys.Tools.FishAudioS2RuntimeUploader",
|
| 6 |
+
"LaunchProfileName": "fishs2-runtime-linux-cuda-prepare-only",
|
| 7 |
+
"Variant": "StandardOnly",
|
| 8 |
+
"TargetDatasetSlug": "fish-audio-s2-python-runtime",
|
| 9 |
+
"ProducerFingerprint": "abab0cad762ebd4abdeda575b064bf83e45998ba526968bdcd9943c96f89e907",
|
| 10 |
+
"PayloadContentSha256": "9ce0bd408707125e1d72da34bda6a93beb7ca2d635aad94d99778c09dd78195c",
|
| 11 |
+
"PayloadFileCount": 8,
|
| 12 |
+
"PayloadBytes": 8618642062,
|
| 13 |
+
"PreparedUtc": "2026-09-10T02:55:10.2368187+00:00",
|
| 14 |
+
"SourceMode": "local",
|
| 15 |
+
"KaggleEnvironmentBaseline": "kaggle-gpu-v170-2026-06-29"
|
| 16 |
+
}
|
README.md
CHANGED
|
@@ -1,4 +1,28 @@
|
|
| 1 |
-
|
| 2 |
-
viewer: false
|
| 3 |
-
---
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fish Audio S2 runtime payload
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
This private Kaggle dataset is generated by `Phorcys.Tools.FishAudioS2RuntimeUploader` for `PHRunner.Kaggle.Service.FishAudioS2`.
|
| 4 |
+
|
| 5 |
+
Runtime flavor: `LinuxCuda`
|
| 6 |
+
Python tag: `python3.10`
|
| 7 |
+
Generated UTC: `2026-09-10T02:54:33.1065830+00:00`
|
| 8 |
+
|
| 9 |
+
The dataset intentionally contains runtime artifacts, not the GGUF model repository by default. Keep the model files in a separate private Kaggle dataset, for example `kaggle-pool-account/fish-audio-s2-v1-5-gguf`.
|
| 10 |
+
|
| 11 |
+
Top-level runtime directories are uploaded as `.phzip` files by default. This keeps the Kaggle dataset mutation deterministic with `--dir-mode skip` and avoids Kaggle auto-extracting ordinary `.zip` directories during dataset processing. The service kernel extracts the small runtime payload into `/kaggle/working/phorcys_fish_audio_s2_runtime/<dataset-name>` during first activation. Experimental expanded-directory upload is available with `--stage-opaque-archives false`, but the `.phzip` mode remains the safer default for runtime because the virtual environment and vendor tree contain nested directory structures.
|
| 12 |
+
|
| 13 |
+
Kaggle-side activation example:
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
import sys
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
# Try the current Kaggle direct mount first.
|
| 19 |
+
runtime_root = Path('/kaggle/input/fish-audio-s2-python-runtime')
|
| 20 |
+
if not runtime_root.exists():
|
| 21 |
+
# Newer Kaggle notebooks may expose private datasets under /kaggle/input/datasets/<owner>/<slug>.
|
| 22 |
+
runtime_root = Path('/kaggle/input/datasets/kaggle-pool-account/fish-audio-s2-python-runtime')
|
| 23 |
+
sys.path.insert(0, str(runtime_root))
|
| 24 |
+
import runtime_bootstrap
|
| 25 |
+
runtime_bootstrap.activate(runtime_root)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Run `python <runtime-root>/verify_runtime.py` inside a Kaggle notebook when diagnosing import failures. The generated service runner also has an API-download fallback when Kaggle accepts a data source but does not mount it under `/kaggle/input`.
|
dot-venv.phzip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba3ff820a08adf5d63eef50c48df94ab4a2e43c5dfe712c60d5ef1b839637c34
|
| 3 |
+
size 5302673492
|
pyLib.phzip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:720bc483ebd0d85d6792f51c2bb5b5b07e4ebb2c7e5e748fc1a71ea941488a2f
|
| 3 |
+
size 327496
|
requirements.phzip
ADDED
|
Binary file (3.73 kB). View file
|
|
|
runtime_bootstrap.py
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import ctypes
|
| 4 |
+
import os
|
| 5 |
+
import re
|
| 6 |
+
import shutil
|
| 7 |
+
import sys
|
| 8 |
+
import zipfile
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def _runtime_work_root(input_root: Path) -> Path:
|
| 13 |
+
explicit = os.environ.get("FISH_AUDIO_S2_RUNTIME_WORK_DIR")
|
| 14 |
+
if explicit:
|
| 15 |
+
return Path(explicit).expanduser().resolve()
|
| 16 |
+
|
| 17 |
+
root_text = str(input_root)
|
| 18 |
+
if root_text.startswith("/kaggle/input/"):
|
| 19 |
+
return Path(os.environ.get("FISH_AUDIO_S2_SCRATCH_ROOT", "/tmp/phorcys_fish_audio_s2_work")) / "phorcys_fish_audio_s2_runtime" / input_root.name
|
| 20 |
+
|
| 21 |
+
return input_root
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def _contains_expected_payload(root: Path, target_name: str) -> bool:
|
| 25 |
+
if target_name == "pyLib":
|
| 26 |
+
return (root / "fish_audio_s2_runtime.py").exists() or (root / "fish_speech").exists()
|
| 27 |
+
if target_name == ".venv":
|
| 28 |
+
return (root / "bin" / "python").exists() or (root / "Scripts" / "python.exe").exists()
|
| 29 |
+
if target_name in {"native", "native-src"}:
|
| 30 |
+
return any(root.glob("**/s2")) or any(root.glob("**/*.so")) or any(root.glob("**/*.dylib")) or any(root.glob("**/*.pyd"))
|
| 31 |
+
return any(root.iterdir()) if root.exists() and root.is_dir() else False
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def _coerce_archive_root(target: Path, target_name: str) -> Path:
|
| 35 |
+
if _contains_expected_payload(target, target_name):
|
| 36 |
+
return target
|
| 37 |
+
|
| 38 |
+
nested = target / target_name
|
| 39 |
+
if nested.exists() and nested.is_dir():
|
| 40 |
+
return nested
|
| 41 |
+
|
| 42 |
+
visible_children = [child for child in target.iterdir() if child.name != ".phorcys-extracted.ok"] if target.exists() and target.is_dir() else []
|
| 43 |
+
if len(visible_children) == 1 and visible_children[0].is_dir():
|
| 44 |
+
nested = visible_children[0]
|
| 45 |
+
if _contains_expected_payload(nested, target_name):
|
| 46 |
+
return nested
|
| 47 |
+
|
| 48 |
+
return target
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def _site_packages_matches_runtime(path: Path) -> bool:
|
| 52 |
+
match = re.search(r"python(\d+)\.(\d+)", str(path))
|
| 53 |
+
if match is None:
|
| 54 |
+
return True
|
| 55 |
+
return (int(match.group(1)), int(match.group(2))) == (sys.version_info.major, sys.version_info.minor)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def _archive_fingerprint(archive: Path) -> str:
|
| 59 |
+
stat = archive.stat()
|
| 60 |
+
return f"{archive.name}:{stat.st_size}:{stat.st_mtime_ns}"
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def _extract_archive(input_root: Path, work_root: Path, archive_names: tuple[str, ...], target_name: str, expanded_names: tuple[str, ...] = ()) -> Path:
|
| 64 |
+
for expanded_name in (target_name, *expanded_names):
|
| 65 |
+
mounted_target = input_root / expanded_name
|
| 66 |
+
if mounted_target.exists():
|
| 67 |
+
return _coerce_archive_root(mounted_target, target_name)
|
| 68 |
+
|
| 69 |
+
target = work_root / target_name
|
| 70 |
+
for archive_name in archive_names:
|
| 71 |
+
archive = input_root / archive_name
|
| 72 |
+
if not archive.exists():
|
| 73 |
+
continue
|
| 74 |
+
|
| 75 |
+
fingerprint = _archive_fingerprint(archive)
|
| 76 |
+
marker = target / ".phorcys-extracted.ok"
|
| 77 |
+
if target.exists() and marker.exists():
|
| 78 |
+
try:
|
| 79 |
+
if marker.read_text(encoding="utf-8") == fingerprint:
|
| 80 |
+
return _coerce_archive_root(target, target_name)
|
| 81 |
+
except Exception:
|
| 82 |
+
pass
|
| 83 |
+
|
| 84 |
+
if target.exists():
|
| 85 |
+
shutil.rmtree(target)
|
| 86 |
+
target.mkdir(parents=True, exist_ok=True)
|
| 87 |
+
with zipfile.ZipFile(archive, "r") as zip_file:
|
| 88 |
+
zip_file.extractall(target)
|
| 89 |
+
marker.write_text(fingerprint, encoding="utf-8")
|
| 90 |
+
return _coerce_archive_root(target, target_name)
|
| 91 |
+
|
| 92 |
+
if target.exists():
|
| 93 |
+
return _coerce_archive_root(target, target_name)
|
| 94 |
+
|
| 95 |
+
return mounted_target
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def _linux_soname_alias_names(file_name: str) -> list[str]:
|
| 99 |
+
match = re.match(r"^(lib.+?\.so)(?:\.(\d+)(?:\..*)?)?$", file_name)
|
| 100 |
+
if match is None:
|
| 101 |
+
return []
|
| 102 |
+
base_name = match.group(1)
|
| 103 |
+
major_version = match.group(2)
|
| 104 |
+
aliases: list[str] = []
|
| 105 |
+
if file_name != base_name:
|
| 106 |
+
aliases.append(base_name)
|
| 107 |
+
if major_version:
|
| 108 |
+
major_alias = f"{base_name}.{major_version}"
|
| 109 |
+
if file_name != major_alias:
|
| 110 |
+
aliases.append(major_alias)
|
| 111 |
+
elif file_name == base_name:
|
| 112 |
+
aliases.append(f"{base_name}.0")
|
| 113 |
+
return aliases
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def _ensure_linux_soname_aliases(native_dir: Path) -> None:
|
| 117 |
+
if not sys.platform.startswith("linux") or not native_dir.exists():
|
| 118 |
+
return
|
| 119 |
+
sources = [source for source in sorted(native_dir.glob("lib*.so*")) if source.is_file()]
|
| 120 |
+
for source in sources:
|
| 121 |
+
for alias_name in _linux_soname_alias_names(source.name):
|
| 122 |
+
alias = native_dir / alias_name
|
| 123 |
+
if alias.exists() or alias == source:
|
| 124 |
+
continue
|
| 125 |
+
try:
|
| 126 |
+
try:
|
| 127 |
+
alias.symlink_to(source.name)
|
| 128 |
+
except Exception:
|
| 129 |
+
shutil.copy2(source, alias)
|
| 130 |
+
except Exception:
|
| 131 |
+
continue
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def _preload_linux_native_dependencies(native_dir: Path) -> None:
|
| 135 |
+
if not sys.platform.startswith("linux") or not native_dir.exists():
|
| 136 |
+
return
|
| 137 |
+
_ensure_linux_soname_aliases(native_dir)
|
| 138 |
+
candidate_patterns = (
|
| 139 |
+
"libggml.so*",
|
| 140 |
+
"libggml-base.so*",
|
| 141 |
+
"libggml-cpu.so*",
|
| 142 |
+
"libggml-cuda.so*",
|
| 143 |
+
"libggml*.so*",
|
| 144 |
+
"libllama.so*",
|
| 145 |
+
)
|
| 146 |
+
candidates: list[Path] = []
|
| 147 |
+
for pattern in candidate_patterns:
|
| 148 |
+
candidates.extend(sorted(native_dir.glob(pattern)))
|
| 149 |
+
seen: set[str] = set()
|
| 150 |
+
for candidate in candidates:
|
| 151 |
+
if not candidate.is_file() or candidate.name in seen:
|
| 152 |
+
continue
|
| 153 |
+
seen.add(candidate.name)
|
| 154 |
+
try:
|
| 155 |
+
ctypes.CDLL(str(candidate), mode=getattr(ctypes, "RTLD_GLOBAL", 0))
|
| 156 |
+
except OSError:
|
| 157 |
+
continue
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def _ensure_linux_executable_bits(native_dir: Path) -> None:
|
| 161 |
+
if not sys.platform.startswith("linux") or not native_dir.exists():
|
| 162 |
+
return
|
| 163 |
+
for executable in native_dir.glob("**/s2"):
|
| 164 |
+
if not executable.is_file():
|
| 165 |
+
continue
|
| 166 |
+
try:
|
| 167 |
+
executable.chmod(executable.stat().st_mode | 0o755)
|
| 168 |
+
except Exception:
|
| 169 |
+
continue
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def _ensure_fish_speech_project_root_markers(paths: list[Path]) -> list[str]:
|
| 173 |
+
markers: list[str] = []
|
| 174 |
+
candidates: list[Path] = []
|
| 175 |
+
for root in paths:
|
| 176 |
+
if not root.exists():
|
| 177 |
+
continue
|
| 178 |
+
package_dir = root / "fish_speech"
|
| 179 |
+
if package_dir.exists() and package_dir.is_dir():
|
| 180 |
+
candidates.append(package_dir)
|
| 181 |
+
if root.name == "fish_speech" and root.is_dir():
|
| 182 |
+
candidates.append(root)
|
| 183 |
+
|
| 184 |
+
seen: set[str] = set()
|
| 185 |
+
for package_dir in candidates:
|
| 186 |
+
for marker_root in (package_dir.parent, package_dir):
|
| 187 |
+
marker = marker_root / ".project-root"
|
| 188 |
+
key = str(marker)
|
| 189 |
+
if key in seen:
|
| 190 |
+
continue
|
| 191 |
+
seen.add(key)
|
| 192 |
+
try:
|
| 193 |
+
if not marker.exists():
|
| 194 |
+
marker.write_text("phorcys generated marker for pip-installed fish-speech runtime\n", encoding="utf-8")
|
| 195 |
+
markers.append(key)
|
| 196 |
+
except Exception:
|
| 197 |
+
continue
|
| 198 |
+
return markers
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def activate(runtime_root: str | os.PathLike[str] | None = None) -> Path:
|
| 202 |
+
input_root = Path(runtime_root).resolve() if runtime_root else Path(__file__).resolve().parent
|
| 203 |
+
work_root = _runtime_work_root(input_root)
|
| 204 |
+
work_root.mkdir(parents=True, exist_ok=True)
|
| 205 |
+
|
| 206 |
+
py_lib = _extract_archive(input_root, work_root, ("pyLib.phzip", "pyLib.zip"), "pyLib")
|
| 207 |
+
_extract_archive(input_root, work_root, ("requirements.phzip", "requirements.zip"), "requirements")
|
| 208 |
+
_extract_archive(input_root, work_root, ("native.phzip", "native.zip"), "native")
|
| 209 |
+
_extract_archive(input_root, work_root, ("native-src.phzip", "native-src.zip"), "native-src")
|
| 210 |
+
_extract_archive(input_root, work_root, ("stressLexicons.phzip", "stressLexicons.zip"), "stressLexicons")
|
| 211 |
+
_extract_archive(input_root, work_root, ("wheelhouse.phzip", "wheelhouse.zip"), "wheelhouse")
|
| 212 |
+
_extract_archive(input_root, work_root, ("models.phzip", "models.zip"), "models")
|
| 213 |
+
venv_root = _extract_archive(input_root, work_root, ("dot-venv.phzip", "dot-venv.zip", ".venv.zip", "venv.zip"), ".venv", ("dot-venv", "venv"))
|
| 214 |
+
|
| 215 |
+
vendor = py_lib / "vendor"
|
| 216 |
+
site_candidates = []
|
| 217 |
+
site_candidates.extend((venv_root / "lib").glob("python*/site-packages"))
|
| 218 |
+
site_candidates.append(venv_root / "Lib" / "site-packages")
|
| 219 |
+
for candidate in site_candidates:
|
| 220 |
+
if candidate.exists() and _site_packages_matches_runtime(candidate):
|
| 221 |
+
text = str(candidate)
|
| 222 |
+
if text not in sys.path:
|
| 223 |
+
sys.path.insert(0, text)
|
| 224 |
+
source_roots = [vendor / "sglang-omni", vendor / "sglang_omni"]
|
| 225 |
+
for candidate in (py_lib, vendor, *source_roots):
|
| 226 |
+
if candidate.exists():
|
| 227 |
+
text = str(candidate)
|
| 228 |
+
if text not in sys.path:
|
| 229 |
+
sys.path.insert(0, text)
|
| 230 |
+
|
| 231 |
+
native_dirs = [
|
| 232 |
+
vendor / "fish_speech",
|
| 233 |
+
py_lib / "vendor" / "fish_speech",
|
| 234 |
+
input_root / "native",
|
| 235 |
+
input_root / "lib",
|
| 236 |
+
input_root / "libs",
|
| 237 |
+
work_root / "native",
|
| 238 |
+
work_root / "lib",
|
| 239 |
+
work_root / "libs",
|
| 240 |
+
]
|
| 241 |
+
expanded_native_dirs: list[Path] = []
|
| 242 |
+
for native_root in (input_root / "native", work_root / "native"):
|
| 243 |
+
if native_root.exists():
|
| 244 |
+
expanded_native_dirs.append(native_root)
|
| 245 |
+
expanded_native_dirs.extend([child for child in native_root.glob("**") if child.is_dir() and (any(child.glob("s2")) or any(child.glob("*.so*")))])
|
| 246 |
+
existing_native_dirs = []
|
| 247 |
+
seen_native_dirs: set[str] = set()
|
| 248 |
+
for path in [*native_dirs, *expanded_native_dirs]:
|
| 249 |
+
if not path.exists():
|
| 250 |
+
continue
|
| 251 |
+
key = str(path.resolve())
|
| 252 |
+
if key in seen_native_dirs:
|
| 253 |
+
continue
|
| 254 |
+
seen_native_dirs.add(key)
|
| 255 |
+
existing_native_dirs.append(path)
|
| 256 |
+
if existing_native_dirs:
|
| 257 |
+
old = os.environ.get("LD_LIBRARY_PATH", "")
|
| 258 |
+
os.environ["LD_LIBRARY_PATH"] = os.pathsep.join([str(path) for path in existing_native_dirs] + ([old] if old else []))
|
| 259 |
+
old_windows = os.environ.get("FISH_AUDIO_S2_NATIVE_DLL_DIRS", "")
|
| 260 |
+
os.environ["FISH_AUDIO_S2_NATIVE_DLL_DIRS"] = os.pathsep.join([str(path) for path in existing_native_dirs] + ([old_windows] if old_windows else []))
|
| 261 |
+
os.environ["FISH_AUDIO_S2_RUNTIME_NATIVE_DIRS"] = os.pathsep.join(str(path) for path in existing_native_dirs)
|
| 262 |
+
for native_dir in existing_native_dirs:
|
| 263 |
+
_ensure_linux_executable_bits(native_dir)
|
| 264 |
+
_ensure_linux_soname_aliases(native_dir)
|
| 265 |
+
_preload_linux_native_dependencies(native_dir)
|
| 266 |
+
|
| 267 |
+
os.environ["FISH_AUDIO_S2_RUNTIME_ACTIVATED_ROOT"] = str(work_root)
|
| 268 |
+
_ensure_fish_speech_project_root_markers([py_lib, vendor, *site_candidates])
|
| 269 |
+
return work_root
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
if __name__ == "__main__":
|
| 273 |
+
activated = activate(sys.argv[1] if len(sys.argv) > 1 else None)
|
| 274 |
+
print(f"activated={activated}")
|
| 275 |
+
print("sys.path[0:8]=" + repr(sys.path[:8]))
|
runtime_manifest.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"SchemaVersion": 2,
|
| 3 |
+
"CreatedUtc": "2026-09-10T02:54:56.5498280\u002B00:00",
|
| 4 |
+
"RuntimeFlavor": "LinuxCuda",
|
| 5 |
+
"RuntimeBackend": "official-python",
|
| 6 |
+
"RequiredPayloadEntries": [],
|
| 7 |
+
"SourcePackagingPath": "F:\\Code\\Phorcys\\Phorcys.Runners\\Phorcys.Tools.FishAudioS2RuntimeUploader\\.fish-audio-s2-python-runtime-work\\Packaging",
|
| 8 |
+
"PayloadPath": "F:\\Code\\Phorcys\\Phorcys.Runners\\Phorcys.Tools.FishAudioS2RuntimeUploader\\.fish-audio-s2-python-runtime-work\\payload",
|
| 9 |
+
"PythonTag": "python3.10",
|
| 10 |
+
"SitePackagesIncluded": true,
|
| 11 |
+
"WheelhouseIncluded": true,
|
| 12 |
+
"ModelSnapshotsIncluded": false,
|
| 13 |
+
"Sections": [
|
| 14 |
+
{
|
| 15 |
+
"Name": "dot-venv.phzip",
|
| 16 |
+
"FileCount": 1,
|
| 17 |
+
"Bytes": 5302673492
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"Name": "pyLib.phzip",
|
| 21 |
+
"FileCount": 1,
|
| 22 |
+
"Bytes": 327496
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"Name": "README.md",
|
| 26 |
+
"FileCount": 1,
|
| 27 |
+
"Bytes": 1880
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"Name": "requirements.phzip",
|
| 31 |
+
"FileCount": 1,
|
| 32 |
+
"Bytes": 3734
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"Name": "runtime_bootstrap.py",
|
| 36 |
+
"FileCount": 1,
|
| 37 |
+
"Bytes": 10882
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"Name": "verify_runtime.py",
|
| 41 |
+
"FileCount": 1,
|
| 42 |
+
"Bytes": 1150
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"Name": "wheelhouse.phzip",
|
| 46 |
+
"FileCount": 1,
|
| 47 |
+
"Bytes": 3315621760
|
| 48 |
+
}
|
| 49 |
+
],
|
| 50 |
+
"ConsumerEnvironment": {
|
| 51 |
+
"FISH_AUDIO_S2_RUNTIME_DATASET_REF": "/fish-audio-s2-python-runtime",
|
| 52 |
+
"FISH_AUDIO_S2_RUNTIME_MOUNT_CANDIDATES": "/kaggle/input/\u003Cslug\u003E;/kaggle/input/datasets/\u003Cowner\u003E/\u003Cslug\u003E;runtime API-download cache",
|
| 53 |
+
"FISH_AUDIO_S2_RUNTIME_BOOTSTRAP": "\u003Cruntime-root\u003E/runtime_bootstrap.py"
|
| 54 |
+
}
|
| 55 |
+
}
|
verify_runtime.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import importlib
|
| 4 |
+
import json
|
| 5 |
+
import sys
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
import runtime_bootstrap
|
| 9 |
+
|
| 10 |
+
root = runtime_bootstrap.activate(Path(__file__).resolve().parent)
|
| 11 |
+
mods = [
|
| 12 |
+
"numpy",
|
| 13 |
+
"soundfile",
|
| 14 |
+
"torch",
|
| 15 |
+
"transformers",
|
| 16 |
+
"fish_audio_s2_runtime",
|
| 17 |
+
]
|
| 18 |
+
optional_mods = [
|
| 19 |
+
"fish_speech",
|
| 20 |
+
]
|
| 21 |
+
report = {"root": str(root), "imports": {}}
|
| 22 |
+
for name in mods:
|
| 23 |
+
try:
|
| 24 |
+
module = importlib.import_module(name)
|
| 25 |
+
report["imports"][name] = {"ok": True, "file": getattr(module, "__file__", None), "required": True}
|
| 26 |
+
except Exception as exc:
|
| 27 |
+
report["imports"][name] = {"ok": False, "error": repr(exc), "required": True}
|
| 28 |
+
for name in optional_mods:
|
| 29 |
+
try:
|
| 30 |
+
module = importlib.import_module(name)
|
| 31 |
+
report["imports"][name] = {"ok": True, "file": getattr(module, "__file__", None), "required": False}
|
| 32 |
+
except Exception as exc:
|
| 33 |
+
report["imports"][name] = {"ok": False, "error": repr(exc), "required": False}
|
| 34 |
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
| 35 |
+
if not all(item["ok"] for item in report["imports"].values() if item.get("required", True)):
|
| 36 |
+
sys.exit(1)
|
wheelhouse.phzip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6648a131dafeb7df816d3f1ab0f4b7b7eced4bb080bd59683708c8f3825acc33
|
| 3 |
+
size 3315621760
|