badgr-cli 1.0.42 → 1.0.44

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.
@@ -485,9 +485,44 @@ describe('trainCommand', () => {
485
485
  expect(body.max_runtime_seconds).toBe(60 * 60);
486
486
  });
487
487
 
488
- it('uses unsloth image for unsloth config', async () => {
488
+ it('blocks unsloth config instead of running a mismatched command', async () => {
489
489
  fs.existsSync.mockReturnValue(true);
490
490
  fs.readFileSync.mockReturnValue('# unsloth training config\nmodel: llama\n');
491
+
492
+ await trainCommand(config, ['config.yaml', '--detach'], chalk);
493
+
494
+ expect(process.exitCode).toBe(1);
495
+ expect(fallback.callWithFallback).not.toHaveBeenCalled();
496
+ });
497
+
498
+ it('blocks generic (unrecognized) config instead of guessing a command', async () => {
499
+ fs.existsSync.mockReturnValue(true);
500
+ fs.readFileSync.mockReturnValue('some_key: some_value\nother: 123\n');
501
+
502
+ await trainCommand(config, ['config.yaml', '--detach'], chalk);
503
+
504
+ expect(process.exitCode).toBe(1);
505
+ expect(fallback.callWithFallback).not.toHaveBeenCalled();
506
+ });
507
+
508
+ it('uses the trl CLI command for a trl-detected config', async () => {
509
+ fs.existsSync.mockReturnValue(true);
510
+ fs.readFileSync.mockReturnValue('trainer: SFTTrainer\nmodel: mistral\n');
511
+ fallback.callWithFallback.mockResolvedValue(makeRunDep());
512
+
513
+ const p = trainCommand(config, ['config.yaml', '--detach'], chalk);
514
+ await vi.advanceTimersByTimeAsync(100);
515
+ await p;
516
+
517
+ const bodyBuilder = fallback.callWithFallback.mock.calls[0][2];
518
+ const body = bodyBuilder();
519
+ expect(body.image).toBe('huggingface/trl-source:latest');
520
+ expect(body.command[2]).toContain('trl sft --config /tmp/config.yaml');
521
+ });
522
+
523
+ it('uses the axolotl CLI command for an axolotl-detected config', async () => {
524
+ fs.existsSync.mockReturnValue(true);
525
+ fs.readFileSync.mockReturnValue('base_model: meta-llama/Llama-2-7b-hf\nsequence_len: 2048\n');
491
526
  fallback.callWithFallback.mockResolvedValue(makeRunDep());
492
527
 
493
528
  const p = trainCommand(config, ['config.yaml', '--detach'], chalk);
@@ -496,7 +531,7 @@ describe('trainCommand', () => {
496
531
 
497
532
  const bodyBuilder = fallback.callWithFallback.mock.calls[0][2];
498
533
  const body = bodyBuilder();
499
- expect(body.image).toBe('unslothai/unsloth:latest');
534
+ expect(body.command[2]).toContain('axolotl train /tmp/config.yaml');
500
535
  });
501
536
  });
502
537