replicas-cli 0.3.536 → 0.3.537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +38 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24559,7 +24559,7 @@ var init_gpu = __esm({
|
|
|
24559
24559
|
init_compute();
|
|
24560
24560
|
COMPUTE_SANDBOX_WORKDIR = COMPUTE_SANDBOX_WORKDIRS.gpu;
|
|
24561
24561
|
SECTION6 = `### GPU sandboxes
|
|
24562
|
-
Run GPU workloads (training, inference, CUDA builds, rendering) on cloud GPU sandboxes with \`replicas gpu\`. The workspace itself has no GPU.
|
|
24562
|
+
Run GPU workloads (training, inference, CUDA builds, rendering) on cloud GPU sandboxes with \`replicas gpu\`. The workspace itself has no GPU, but GPU sandboxes are available when a task needs one.
|
|
24563
24563
|
|
|
24564
24564
|
**Reference:** \`references/GPU.md\`
|
|
24565
24565
|
|
|
@@ -24597,6 +24597,41 @@ replicas gpu delete
|
|
|
24597
24597
|
- \`--port 8000\` on create exposes a container port as a public HTTPS URL (shown by \`list\`).
|
|
24598
24598
|
- \`--env KEY=value\` passes secrets such as \`HF_TOKEN\`; never bake them into files you push.
|
|
24599
24599
|
|
|
24600
|
+
## GPU-accelerated browser
|
|
24601
|
+
|
|
24602
|
+
The workspace's browser renders WebGL in software. Chrome in a GPU sandbox also uses software rendering unless it gets the flags below. If you need a page rendered on a real GPU, push a production build and serve it inside the sandbox. The sandbox carries no Replicas login, so it can only open a preview URL (\`references/PREVIEWS.md\`) created without \`--authenticated\`, which anyone with the link can open: ask the user before making a private app public that way, and never recreate an existing authenticated preview without the flag. Then run Playwright in a GPU sandbox:
|
|
24603
|
+
|
|
24604
|
+
\`\`\`bash
|
|
24605
|
+
mkdir -p /tmp/gpu-browser && cd /tmp/gpu-browser
|
|
24606
|
+
cat > fps.mjs <<'EOF'
|
|
24607
|
+
import { chromium } from 'playwright';
|
|
24608
|
+
import { mkdirSync } from 'node:fs';
|
|
24609
|
+
// Without these flags Chrome falls back to SwiftShader, a software renderer.
|
|
24610
|
+
const browser = await chromium.launch({ args: ['--use-angle=vulkan', '--enable-features=Vulkan', '--ignore-gpu-blocklist'] });
|
|
24611
|
+
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
|
|
24612
|
+
await page.goto(process.argv[2], { waitUntil: 'networkidle' });
|
|
24613
|
+
const result = await page.evaluate(async () => {
|
|
24614
|
+
const gl = document.createElement('canvas').getContext('webgl');
|
|
24615
|
+
const info = gl?.getExtension('WEBGL_debug_renderer_info');
|
|
24616
|
+
const renderer = info ? gl.getParameter(info.UNMASKED_RENDERER_WEBGL) : 'no WebGL';
|
|
24617
|
+
const frames = [];
|
|
24618
|
+
await new Promise((done) => {
|
|
24619
|
+
const tick = (t) => { frames.push(t); frames.at(-1) - frames[0] < 5000 ? requestAnimationFrame(tick) : done(); };
|
|
24620
|
+
requestAnimationFrame(tick);
|
|
24621
|
+
});
|
|
24622
|
+
const gaps = frames.slice(1).map((t, i) => t - frames[i]).sort((a, b) => a - b);
|
|
24623
|
+
return { renderer, fps: Math.round((frames.length - 1) / 5), p95FrameMs: Math.round(gaps[Math.floor(gaps.length * 0.95)]) };
|
|
24624
|
+
});
|
|
24625
|
+
console.log(JSON.stringify(result));
|
|
24626
|
+
mkdirSync('outputs', { recursive: true });
|
|
24627
|
+
await page.screenshot({ path: 'outputs/frame.png' });
|
|
24628
|
+
await browser.close();
|
|
24629
|
+
EOF
|
|
24630
|
+
replicas gpu run --image mcr.microsoft.com/playwright:v1.49.0-noble --pull outputs -- "npm i playwright@1.49.0 >/dev/null && node fps.mjs https://<preview-url>/<page>"
|
|
24631
|
+
\`\`\`
|
|
24632
|
+
|
|
24633
|
+
Check that \`renderer\` names the NVIDIA GPU; one naming SwiftShader means the page ran in software. \`fps\` counts the browser's frame callbacks, which is the most the page can draw; a game that skips frames draws fewer, so read its own frame counter (or count calls to its render function) when it has one. Add the interactions the page needs (clicks, waits for a scene to load) before measuring, and keep the Playwright package version matching the image tag.
|
|
24634
|
+
|
|
24600
24635
|
## Choosing hardware and images
|
|
24601
24636
|
|
|
24602
24637
|
- GPUs, picked with \`--gpu\`: ${GPU_TYPES.join(", ")} (default ${DEFAULT_GPU_TYPE}). Add a count for multi-GPU, e.g. \`H100:4\` (max ${COMPUTE_SANDBOX_LIMITS.maxGpuCount}). Pick the smallest GPU that fits: T4/L4 for small models and smoke tests, A100/H100 for real training.
|
|
@@ -24613,7 +24648,7 @@ replicas gpu delete
|
|
|
24613
24648
|
GPU_ABILITY = {
|
|
24614
24649
|
label: "GPU sandboxes",
|
|
24615
24650
|
description: "Run training, inference, and other GPU workloads on cloud GPUs with `replicas gpu`.",
|
|
24616
|
-
bullet: "- Running GPU workloads (training, inference, CUDA, rendering) on cloud GPU sandboxes with `replicas gpu`",
|
|
24651
|
+
bullet: "- Running GPU workloads (training, inference, CUDA, rendering) on cloud GPU sandboxes with `replicas gpu` (this workspace has no GPU of its own)",
|
|
24617
24652
|
section: SECTION6,
|
|
24618
24653
|
referenceFile: { name: "GPU.md", content: REFERENCE6 }
|
|
24619
24654
|
};
|
|
@@ -40345,7 +40380,7 @@ var CLI_VERSION;
|
|
|
40345
40380
|
var init_cli_version = __esm({
|
|
40346
40381
|
"../shared/src/cli-version.ts"() {
|
|
40347
40382
|
"use strict";
|
|
40348
|
-
CLI_VERSION = "0.3.
|
|
40383
|
+
CLI_VERSION = "0.3.537";
|
|
40349
40384
|
}
|
|
40350
40385
|
});
|
|
40351
40386
|
|