You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky onnx.spec.ts failure due to parallel @xenova/transformers cache race #1306
discojs/src/models/onnx.spec.ts intermittently fails in verify / test / discojs (pnpm exec vitest --run --project=discojs):
stderr | discojs/src/models/onnx.spec.ts > ONNXModel.predict > should generate the next token ID from a prompt
Error: Failed to load model because protobuf parsing failed.
at new OnnxruntimeSessionHandler (.../onnxruntime-node@1.14.0/node_modules/onnxruntime-node/dist/backend.js:27:92)
Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback.
FAIL discojs/src/models/onnx.spec.ts > ONNXModel.predict > should generate the next token ID from a prompt
TypeError: The worker script or module filename must be an absolute path or a relative path starting with './' or '../'. Received "blob:nodedata:..."
Both discojs/src/models/onnx.spec.ts and discojs/src/models/implementations/hellaswag.spec.ts call ONNXModel.init_pretrained("Xenova/gpt2") (AutoModelForCausalLM.from_pretrained("Xenova/gpt2")) concurrently in separate Vitest workers sharing the same @xenova/transformers on-disk cache directory.
Because @xenova/transformers does not coordinate/lock concurrent writes to the same cache file, onnx.spec.ts can read a partially downloaded .onnx file (protobuf parsing failed), triggering a fallback to onnxruntime-web's wasm backend which fails in Node on blob:nodedata:.... In the same CI run, hellaswag.spec.ts finished loading the exact same Xenova/gpt2 model ~0.6 s later and passed.
Proposed fix
Pre-fetch Xenova/gpt2 once before parallel Vitest workers start (e.g., via a Vitest globalSetup hook and/or CI cache step), or
Isolate @xenova/transformersenv.cacheDir per worker so parallel specs cannot corrupt each other's downloads.
Activity