Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/sequence-embeddings-resource-formulas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@platforma-open/milaboratories.sequence-embeddings.software": minor
"@platforma-open/milaboratories.sequence-embeddings.workflow": patch
"@platforma-open/milaboratories.sequence-embeddings.model": patch
"@platforma-open/milaboratories.sequence-embeddings.ui": patch
"@platforma-open/milaboratories.sequence-embeddings": minor
---

Optimize embedding compute-resource requests via the fluent `exec.formula` API (workflow-tengo 6.7.x) and size the GPU batch from the allocated VRAM.

- **Workflow** — the embedding exec now declares resources with `.resources({ onCPU | onGPU })` instead of a flat 16 CPU / 32 GiB / 16 GiB-VRAM request:
- GPU path: host CPU/RAM cut to 2 cores / 8 GiB (single streaming process; the accelerator does the work, per-chunk CPU work is interleaved, and the heavy PColumn→TSV shaping is already upstream CPU execs), and VRAM is model-tiered — 6 GiB for the wider checkpoints (ESM-2 650M, CurrAb, PeptideCLM-2), 3 GiB otherwise. This fits the cheapest fractional-L4 tiers (gpu-3g `g6f.xlarge` / gpu-6g `g6f.2xlarge`) instead of forcing the 4×L40S `g6e.12xlarge` the old 16 CPU / 32 GiB / 16 GiB-VRAM request required.
- CPU path: cores scale with the batch's token volume (`size("batch")`, 4–16) and RAM tracks the core count (2 GiB/core, 8–32 GiB), with a `.staticFallback` equal to the old fixed 16 / 32 GiB for backends that cannot evaluate resource formulas. Advanced-settings overrides still win per dimension.
- The run-report counting pass now sizes its RAM from the source-TSV size (it full-loads the TSV), replacing the flat 4 GiB that could OOM on large inputs.
- **Software** — on CUDA the per-forward token budget is now auto-sized from the allocated VRAM (`PLATFORMA_GPU_MEMORY`), mirroring how `--max-memory-gb` sizes the host-RAM path: a larger VRAM request yields larger batches (higher throughput), a smaller one stays safe. An explicit `--token-budget` still wins, and the halve-on-OOM retry remains the backstop.
- **Model / UI** — the `mem` / `cpu` Advanced-Settings fields are now opt-in: a new block leaves them unset so the workflow's automatic sizing applies, and a user value overrides it per dimension. (Existing projects keep any value they already had.)
6 changes: 3 additions & 3 deletions model/src/dataModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const blockDataModel = new DataModelBuilder()
// The selection is seeded by the UI on first input connection (specialist-first);
// starts blank so the dropdowns have an object to bind to before an input exists.
embedding: {},
// Resource defaults for the embedding step (Advanced Settings).
mem: 32,
cpu: 16,
// mem/cpu are intentionally left UNSET: the workflow sizes the embedding step's
// resources automatically from device (CPU/GPU) and input volume. They become
// opt-in overrides — set only when the user fills them in Advanced Settings.
}));
10 changes: 5 additions & 5 deletions model/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ export type BlockDataV1 = {
scopesInitializedForAnchor?: string;
/**
* Advanced — host resources for the embedding step (Resource Allocation in
* Advanced Settings). `mem` is GiB, `cpu` is cores. Undefined → workflow
* defaults (32 GiB / 16 cores).
* Advanced Settings). `mem` is GiB, `cpu` is cores. Undefined → workflow sizes
* automatically from device (CPU/GPU) and input volume.
*/
mem?: number;
cpu?: number;
Expand All @@ -227,7 +227,7 @@ export type BlockDataV2 = {
* Init-guard: canonical id of the anchor whose default cards were last seeded.
*/
embeddingsInitializedForAnchor?: string;
/** Advanced resource overrides (GiB / cores); undefined → workflow defaults. */
/** Advanced resource overrides (GiB / cores); undefined → workflow sizes automatically from device + input. */
mem?: number;
cpu?: number;
defaultBlockLabel?: string;
Expand All @@ -249,7 +249,7 @@ export type BlockDataV3 = {
* input change.
*/
embeddingInitializedForAnchor?: string;
/** Advanced resource overrides (GiB / cores); undefined → workflow defaults. */
/** Advanced resource overrides (GiB / cores); undefined → workflow sizes automatically from device + input. */
mem?: number;
cpu?: number;
defaultBlockLabel?: string;
Expand Down Expand Up @@ -279,7 +279,7 @@ export type BlockArgs = {
inputAnchor: PlRef;
/** Tasks to emit — a 1-element list projected from `data.embedding` (validated complete + compatible). */
embeddings: EmbeddingTask[];
/** Advanced resource overrides for the embedding step (GiB / cores); undefined → workflow defaults. */
/** Advanced resource overrides for the embedding step (GiB / cores); undefined → workflow sizes automatically. */
mem?: number;
cpu?: number;
};
Loading
Loading