volvoxai 0.2.0 → 0.3.0

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/bin/volvox.js CHANGED
@@ -27,10 +27,13 @@ program
27
27
  .action(async (options) => {
28
28
  try {
29
29
  installFileFetchShim();
30
- console.log(`[Volvox CLI] Initializing Engine (Backend: ${options.backend})...`);
30
+ console.log(`[Volvox CLI] Initializing runtime (backend: ${options.backend})...`);
31
31
  const cliDir = path.dirname(fileURLToPath(import.meta.url));
32
32
  const wasmPath = path.resolve(cliDir, '..', 'dist', packageVersion, 'volvoxai.wasm');
33
- const engine = await VolvoxAI.init(options.backend, wasmPath);
33
+ const runtime = await VolvoxAI.createRuntime({
34
+ backends: [options.backend],
35
+ wasmUrl: wasmPath,
36
+ });
34
37
 
35
38
  console.log(`[Volvox CLI] Loading Model: ${options.model}`);
36
39
  if (!fs.existsSync(options.model)) {
@@ -39,14 +42,20 @@ program
39
42
  }
40
43
 
41
44
  const modelUrl = 'file://' + path.resolve(options.model);
42
- const graph = await engine.loadGraph(modelUrl);
43
-
44
- console.log(`[Volvox CLI] Compiling Model...`);
45
- const executor = await engine.compile(graph, modelUrl);
45
+ const model = await runtime.loadModel(modelUrl);
46
46
 
47
- console.log(`[Volvox CLI] Model Ready! Provide input data via scripts for full inference.`);
48
- // TODO: In a real CLI, we would parse JSON inputs or specific tensors,
49
- // and call executor.execute(inputs).
47
+ console.log('[Volvox CLI] Compiling model...');
48
+ const compiled = await model.compile({
49
+ backend: {
50
+ mode: 'require',
51
+ backend: options.backend,
52
+ operatorFallback: 'forbid',
53
+ },
54
+ });
55
+ console.log(`[Volvox CLI] Model ready on ${compiled.backend}.`);
56
+ await compiled.close();
57
+ await model.close();
58
+ await runtime.close();
50
59
 
51
60
  } catch (err) {
52
61
  console.error('[Volvox CLI] Error during execution:', err);