turbollm 0.6.1 → 0.6.2

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/cli.js CHANGED
@@ -569,12 +569,32 @@ async function probeMlx(python) {
569
569
  );
570
570
  return `mlx-lm ${stdout.trim()}`;
571
571
  }
572
- function mlxServerCommand(python, model, port2, host2) {
572
+ function mlxServerCommand(python, model, port2, host2, extraArgs = []) {
573
573
  return {
574
574
  cmd: python,
575
- args: ["-m", "mlx_lm", "server", "--model", model, "--host", host2, "--port", String(port2)]
575
+ args: [
576
+ "-m",
577
+ "mlx_lm",
578
+ "server",
579
+ "--model",
580
+ model,
581
+ "--host",
582
+ host2,
583
+ "--port",
584
+ String(port2),
585
+ ...extraArgs
586
+ ]
576
587
  };
577
588
  }
589
+ function mlxSamplingArgs(s) {
590
+ if (!s) return [];
591
+ const a = [];
592
+ if (typeof s.temp === "number") a.push("--temp", String(s.temp));
593
+ if (typeof s.topP === "number") a.push("--top-p", String(s.topP));
594
+ if (typeof s.topK === "number") a.push("--top-k", String(s.topK));
595
+ if (typeof s.minP === "number") a.push("--min-p", String(s.minP));
596
+ return a;
597
+ }
578
598
 
579
599
  // src/engines/slot-cache.ts
580
600
  import { createHash } from "crypto";
@@ -1005,7 +1025,7 @@ var Manager = class {
1005
1025
  };
1006
1026
  function engineCommand(opts, port2, slotSavePath) {
1007
1027
  if (opts.engine.kind === "mlx") {
1008
- return mlxServerCommand(opts.engine.binPath, opts.modelPath, port2, "127.0.0.1");
1028
+ return mlxServerCommand(opts.engine.binPath, opts.modelPath, port2, "127.0.0.1", opts.extraArgs);
1009
1029
  }
1010
1030
  if (opts.engine.kind === "vllm") {
1011
1031
  return vllmServerCommand(opts.engine.binPath, opts.modelPath, port2, "127.0.0.1", opts.tensorParallelSize);
@@ -3802,13 +3822,14 @@ var ModelRouter = class {
3802
3822
  const cfg2 = this.store.snapshot();
3803
3823
  const sys = getSysInfo();
3804
3824
  if (entry.format !== "gguf") {
3805
- const savedGpu = cfg2.modelProfiles[entry.key]?.gpu;
3825
+ const savedProfile = cfg2.modelProfiles[entry.key];
3806
3826
  return {
3807
3827
  engine,
3808
3828
  model: { key: entry.key, name: entry.name, quant: entry.quant, ctx: entry.nativeCtx, vision: false },
3809
3829
  modelPath: entry.path,
3810
- extraArgs: [],
3811
- tensorParallelSize: savedGpu?.tensorParallelSize
3830
+ // MLX honors sampling as launch defaults; vLLM takes no extra flags here.
3831
+ extraArgs: engine.kind === "mlx" ? mlxSamplingArgs(savedProfile?.sampling) : [],
3832
+ tensorParallelSize: savedProfile?.gpu?.tensorParallelSize
3812
3833
  };
3813
3834
  }
3814
3835
  const saved = cfg2.modelProfiles[entry.key];
@@ -4447,13 +4468,15 @@ function registerApi(app2, d) {
4447
4468
  }
4448
4469
  let opts2;
4449
4470
  if (entry.format !== "gguf") {
4450
- const savedGpu = cfg2.modelProfiles[entry.key]?.gpu;
4471
+ const savedProfile = cfg2.modelProfiles[entry.key];
4451
4472
  opts2 = {
4452
4473
  engine: active,
4453
4474
  model: { key: entry.key, name: entry.name, quant: entry.quant, ctx: entry.nativeCtx, vision: false },
4454
4475
  modelPath: entry.path,
4455
- extraArgs: [],
4456
- tensorParallelSize: savedGpu?.tensorParallelSize
4476
+ // MLX honors sampling as launch defaults; vLLM gets no extra flags here
4477
+ // (its multi-GPU shard count maps to --tensor-parallel-size below).
4478
+ extraArgs: active.kind === "mlx" ? mlxSamplingArgs(savedProfile?.sampling) : [],
4479
+ tensorParallelSize: savedProfile?.gpu?.tensorParallelSize
4457
4480
  };
4458
4481
  } else {
4459
4482
  const saved = cfg2.modelProfiles[entry.key];