Skip to content

Commit 216ad50

Browse files
committed
fix(models): check for all expected ONNX files during conversion
CodeT5 produces multiple ONNX files (encoder_model.onnx and decoder_model.onnx) but convertToOnnx was only checking for a single model.onnx file. This caused the conversion step to be marked as complete when the files didn't actually exist, leading to build failures in the quantization step. Fix: Use config.files to check for all expected ONNX files based on model type.
1 parent 68641fe commit 216ad50

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/models/scripts/build.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,12 @@ async function convertToOnnx(modelKey) {
156156

157157
const config = MODEL_SOURCES[modelKey]
158158
const modelDir = join(MODELS, modelKey)
159-
const onnxPath = join(modelDir, 'model.onnx')
160159

161-
if (existsSync(onnxPath)) {
160+
// Check for expected ONNX files based on model type.
161+
const expectedFiles = config.files.filter(f => f.endsWith('.onnx'))
162+
const allExist = expectedFiles.every(f => existsSync(join(modelDir, f)))
163+
164+
if (allExist) {
162165
logger.success('Already in ONNX format')
163166
await createCheckpoint(PACKAGE_NAME, `converted-${modelKey}`, { modelKey })
164167
return

0 commit comments

Comments
 (0)