diff --git a/compute/core/src/runtime/cpu-budget.ts b/compute/core/src/config/cpu-budget.ts similarity index 100% rename from compute/core/src/runtime/cpu-budget.ts rename to compute/core/src/config/cpu-budget.ts diff --git a/compute/core/src/runtime/timeout-config.ts b/compute/core/src/config/timeout.ts similarity index 100% rename from compute/core/src/runtime/timeout-config.ts rename to compute/core/src/config/timeout.ts diff --git a/compute/core/src/contracts.ts b/compute/core/src/contracts/index.ts similarity index 92% rename from compute/core/src/contracts.ts rename to compute/core/src/contracts/index.ts index bb0a8d7..280e2d9 100644 --- a/compute/core/src/contracts.ts +++ b/compute/core/src/contracts/index.ts @@ -1,19 +1,19 @@ -import type { TTSSentenceAlignment } from './types/tts'; -import type { ParsedPdfDocument } from './types/parsed-pdf'; +import type { TTSSentenceAlignment } from '../types/tts'; +import type { ParsedPdfDocument } from '../types/parsed-pdf'; export type { TTSAudioBuffer, TTSAudioBytes, TTSSentenceAlignment, TTSSentenceWord, -} from './types/tts'; +} from '../types/tts'; export type { ParsedPdfBlockKind, ParsedPdfBlockFragment, ParsedPdfBlock, ParsedPdfPage, ParsedPdfDocument, -} from './types/parsed-pdf'; +} from '../types/parsed-pdf'; export const ALIGN_QUEUE_NAME = 'whisper-align'; export const PDF_LAYOUT_QUEUE_NAME = 'pdf-layout'; diff --git a/compute/core/src/index.ts b/compute/core/src/index.ts index b336427..8cfc7c9 100644 --- a/compute/core/src/index.ts +++ b/compute/core/src/index.ts @@ -3,7 +3,7 @@ export { getComputeJobConcurrency, getAvailableCpuCores, getOnnxThreadsPerJob, -} from './runtime/cpu-budget'; +} from './config/cpu-budget'; export { getComputeTimeoutConfig, getWorkerClientWaitTimeoutMs, @@ -12,7 +12,7 @@ export { type ComputeTimeoutConfig, type ComputeOperationKind, type IdleTimeoutAndHardCapInput, -} from './runtime/timeout-config'; +} from './config/timeout'; export { renderPage } from './pdf-layout/renderPage'; export { mergeTextWithRegions } from './pdf-layout/mergeTextWithRegions'; export { stitchCrossPageBlocks } from './pdf-layout/stitchCrossPageBlocks'; diff --git a/compute/core/src/pdf-layout/ensureModel.ts b/compute/core/src/pdf-layout/ensureModel.ts index fcb15b2..31a472a 100644 --- a/compute/core/src/pdf-layout/ensureModel.ts +++ b/compute/core/src/pdf-layout/ensureModel.ts @@ -2,7 +2,7 @@ import path from 'path'; import { fileURLToPath } from 'url'; import { createHash } from 'crypto'; import { access, mkdir, rename, writeFile, readFile, unlink, copyFile } from 'fs/promises'; -import { DOCSTORE_DIR } from '../runtime/docstore'; +import { DOCSTORE_DIR } from '../platform/docstore'; import manifest from './model/manifest.json'; const DEFAULT_MODEL_BASE_URL = 'https://huggingface.co/Bei0001/PP-DocLayoutV3-ONNX/resolve/main'; diff --git a/compute/core/src/pdf-layout/runLayoutModel.ts b/compute/core/src/pdf-layout/runLayoutModel.ts index 24a7ac8..5280db6 100644 --- a/compute/core/src/pdf-layout/runLayoutModel.ts +++ b/compute/core/src/pdf-layout/runLayoutModel.ts @@ -2,7 +2,7 @@ import * as ort from 'onnxruntime-node'; import { readFile } from 'fs/promises'; import type { LayoutRegion, PdfTextItem } from './types'; import { ensureModel, MODEL_CONFIG_PATH, MODEL_PREPROCESSOR_PATH } from './ensureModel'; -import { getOnnxThreadsPerJob } from '../runtime/cpu-budget'; +import { getOnnxThreadsPerJob } from '../config/cpu-budget'; interface RunLayoutInput { pageWidth: number; diff --git a/compute/core/src/runtime/docstore.ts b/compute/core/src/platform/docstore.ts similarity index 100% rename from compute/core/src/runtime/docstore.ts rename to compute/core/src/platform/docstore.ts diff --git a/compute/core/src/runtime/ffmpeg.ts b/compute/core/src/platform/ffmpeg.ts similarity index 100% rename from compute/core/src/runtime/ffmpeg.ts rename to compute/core/src/platform/ffmpeg.ts diff --git a/compute/core/src/runtime/index.ts b/compute/core/src/runtime/index.ts deleted file mode 100644 index c67490a..0000000 --- a/compute/core/src/runtime/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -export { - getComputeJobConcurrency, - getAvailableCpuCores, - getOnnxThreadsPerJob, -} from './cpu-budget'; - -export { - getComputeTimeoutConfig, - getWorkerClientWaitTimeoutMs, - withTimeout, - withIdleTimeoutAndHardCap, - type ComputeTimeoutConfig, - type ComputeOperationKind, - type IdleTimeoutAndHardCapInput, -} from './timeout-config'; diff --git a/compute/core/src/whisper/alignment.ts b/compute/core/src/whisper/alignment.ts index 9d59ee0..b10b444 100644 --- a/compute/core/src/whisper/alignment.ts +++ b/compute/core/src/whisper/alignment.ts @@ -8,9 +8,9 @@ import * as ort from 'onnxruntime-node'; import { Tokenizer } from '@huggingface/tokenizers'; import JSZip from 'jszip'; import type { TTSAudioBuffer, TTSAudioBytes, TTSSentenceAlignment } from '../types/tts'; -import { getFFmpegPath } from '../runtime/ffmpeg'; -import { getOnnxThreadsPerJob } from '../runtime/cpu-budget'; -import { getComputeTimeoutConfig } from '../runtime/timeout-config'; +import { getFFmpegPath } from '../platform/ffmpeg'; +import { getOnnxThreadsPerJob } from '../config/cpu-budget'; +import { getComputeTimeoutConfig } from '../config/timeout'; import { mapWordsToSentenceOffsets, type WhisperWord, diff --git a/compute/core/src/whisper/ensureModel.ts b/compute/core/src/whisper/ensureModel.ts index 4d2a05c..2ab1455 100644 --- a/compute/core/src/whisper/ensureModel.ts +++ b/compute/core/src/whisper/ensureModel.ts @@ -2,7 +2,7 @@ import path from 'path'; import { fileURLToPath } from 'url'; import { createHash } from 'crypto'; import { access, copyFile, mkdir, readFile, rename, unlink, writeFile } from 'fs/promises'; -import { DOCSTORE_DIR } from '../runtime/docstore'; +import { DOCSTORE_DIR } from '../platform/docstore'; import manifest from './model/manifest.json'; const MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));