Commit Graph

162 Commits

Author SHA1 Message Date
Alpamys 02a2af4b83 fix: v0.24.1 — Windows Unicode fix, AWQ/GPTQ output path traversal
- Replace non-ASCII symbols (checkmarks, arrows, bullets, em-dashes)
  with ASCII equivalents in Rich console output to prevent
  UnicodeEncodeError on Windows without PYTHONIOENCODING=utf-8
- Add _validate_output_path() for AWQ/GPTQ export — output path
  traversal is now checked before import check (previously unreachable
  when autoawq/auto-gptq not installed)
- 4 new tests for output path validation (2065 total, 0 failures)
- Update SECURITY.md with v0.22.0–v0.24.1 hardening history
2026-04-03 23:41:44 +05:00
Alpamys d83dad0a3b docs: update CONTRIBUTING.md for v0.24.0, add CODEOWNERS
- Update test counts to 74 files / 2061 tests (was 62 / 1789)
- Add complete test file table matching CLAUDE.md
- Sync PR checklist with .github/pull_request_template.md
- Add Good First Issues section and New Recipe guide
- Add Conventional Commits format for commit messages
- Add CODEOWNERS for auto-reviewer assignment
2026-04-03 22:22:00 +05:00
Alpamys 1b6b428aaa feat: v0.24.0 — Dataset Hub, Freeze Training, Loss Watchdog, Dataset Registry
Part A: HuggingFace Dataset browser
- soup data search: search HF Hub for datasets (sort by downloads/likes)
- soup data preview: preview remote dataset metadata, splits, features
- soup data download: stream HF dataset to local JSONL (with format conversion)
- Security: trust_remote_code=False, path traversal protection, samples cap at 1M

Part B: Freeze training (like LLaMA-Factory finetuning_type: freeze)
- freeze_layers / freeze_ratio config fields
- soup_cli/utils/freeze.py: detect layers, freeze bottom N
- Wired into SFT trainer before LoRA application
- Supports LLaMA (layers.N) and GPT-2 (h.N) naming

Part C: Loss watchdog (like Axolotl loss_watchdog_threshold)
- loss_watchdog, loss_watchdog_threshold, loss_watchdog_patience config
- Implemented in SoupTrainerCallback with patience counter
- Rich warning panel (stops Live display first), fires only once
- Wired into all 11 trainers via callback kwargs

Part D: Dataset info registry
- soup data register/unregister/registry commands
- ~/.soup/datasets.json local name→path+format mapping
- Name validation, path traversal protection, Rich markup escaping

82 new tests (2061 total), 74 test files.
2026-04-03 16:35:23 +05:00
Alpamys ada4a078b6 fix: v0.23.1 — CI fix, security warnings, expanded test coverage
- Fix macOS CI: CLI help tests use inspect.signature (Rich truncation)
- Security: trust_remote_code warning panels for AWQ/GPTQ export
- Tests: packing trainer mock, curriculum fallback branch, empty list edge case
- 1979 tests across 70 test files
2026-04-03 14:20:21 +05:00
Alpamys 6db403f6c3 fix: CLI help tests use inspect.signature instead of Rich-rendered output
Rich/Typer truncates help panel on narrow terminals (macOS CI), causing
--bits and --group-size flags to not appear in rendered help text. Switch
to inspecting the function signature directly for cross-platform reliability.
2026-04-03 14:08:36 +05:00
Alpamys 50ccf15113 fix: v0.23.0 security — trust_remote_code warning panels for AWQ/GPTQ export 2026-04-03 14:01:16 +05:00
Alpamys f272ee2f4f feat: v0.23.0 — AWQ/GPTQ Export, Sample Packing, Data Split, Curriculum Learning
- AWQ export (`soup export --format awq`) via autoawq, with --bits, --group-size, --calibration-data
- GPTQ export (`soup export --format gptq`) via auto-gptq, with calibration data support
- Sample packing (`packing: true`) for SFT/Pretrain trainers via TRL's native packing
- `soup data split` — train/val/test splitting with random and stratified strategies
- Curriculum learning (`curriculum: true`) — sort dataset by difficulty for staged training
- New utility: soup_cli/utils/curriculum.py (sort_by_length, create_buckets)
- Security: calibration data path traversal protection, bits validation (4/8 only)
- 1970 tests across 70 test files
2026-04-03 13:55:01 +05:00
Alpamys 559203c2e3 fix: v0.22.1 — Python 3.9 compat (str | None → Optional[str]), version bump
The v0.22.0 release broke CI on Python 3.9 because serve.py used
PEP 604 union syntax (str | None) at module level, which requires 3.10+.
Fixed in previous commit; this bumps version to v0.22.1 for a clean PyPI release.
2026-04-03 13:09:16 +05:00
Alpamys f3c2dda9f2 fix: Python 3.9 compat — replace str | None with Optional[str] in serve.py
The `str | None` union syntax at module level requires Python 3.10+.
serve.py cannot use `from __future__ import annotations` because it
defines Pydantic models inside functions (FastAPI needs runtime types).
2026-04-03 13:02:20 +05:00
Alpamys dee9317dde feat: v0.22.0 — Training Profiler, Multi-Adapter Serving, Data Sampling, Adapter Management
New commands:
- `soup profile` — estimate memory, speed, GPU requirements before training
  (--config, --gpu, --json flags)
- `soup adapters list/info/compare` — LoRA adapter management
- `soup data sample` — intelligent dataset sampling (random/diverse/hard strategies)
- `soup serve --adapters` — multi-adapter serving with adapter selection

New files:
- soup_cli/utils/profiler.py — memory/speed estimation engine
- soup_cli/commands/profile.py — profile CLI command
- soup_cli/commands/adapters.py — adapter management CLI

Security:
- Multi-adapter: adapter path traversal protection (resolve + relative_to)
- Multi-adapter: adapter name validation (alphanumeric + hyphens only)
- Multi-adapter: unknown adapter → 404, no adapter name leakage in errors
- Multi-adapter: /v1/adapters returns names only (no filesystem paths)
- Multi-adapter: --adapters rejected for non-transformers backends
- Data sample: output path confinement (resolve + relative_to(cwd))

101 new tests (1890 total), 66 test files, 65.5% coverage, ruff clean.
2026-04-03 12:54:24 +05:00
Alpamys 0a4095eb0b fix: v0.21.1 — Windows UnicodeEncodeError, load_config str, recipe count
- fix: replace Unicode ⚠ (U+26A0) with ASCII [yellow]![/] in migrate
  warnings to prevent UnicodeEncodeError on Windows cp1251/cp866
- fix: load_config() now accepts str in addition to Path
- fix: recipe count in docs corrected from 30 to 29
- chore: bump version to v0.21.1
2026-04-02 14:31:17 +05:00
Alpamys eba63f2387 fix: allow exit code 2 for `soup recipes` no-args help (Typer compat)
Different Typer versions return exit code 0 or 2 for no_args_is_help.
Accept both in the test to fix CI on macOS/Python 3.11.
2026-04-02 14:12:32 +05:00
Alpamys 1b1d679141 feat: v0.21.0 — migrate, recipes, NEFTune, rsLoRA
- `soup migrate` — import configs from LLaMA-Factory, Axolotl, Unsloth
  notebooks (AST-only .ipynb parsing, path traversal protection)
- `soup recipes` — 30 ready-made configs for popular models
  (list/show/use/search with path traversal protection)
- NEFTune (`neftune_alpha`) — noisy embeddings for SFT/DPO/KTO/ORPO/SimPO/IPO
- rsLoRA (`use_rslora`) — rank-stabilized LoRA scaling in all 11 trainers
- Fix: `soup doctor` torchvision circular import crash
- Fix: `load_eval_tasks()` now accepts str in addition to Path
- Security: Rich markup injection prevention in migration warnings
- Security: 10 MB file size limit on migration input files
- 1789 tests, 62 test files, 64% coverage
2026-04-02 14:08:36 +05:00
Alpamys 7f0945c410 chore: bump version to v0.20.2 2026-04-01 18:40:48 +05:00
Alpamys 7aa390b760 fix: restore /static/ prefix for logo path in Web UI 2026-04-01 18:35:59 +05:00
Alpamys d6a7e3f816 chore: bump version to v0.20.1
Bugfix release: ANSI-safe CI test assertions (macOS fix), path
confinement hardening, circular import fix, rate limiting implementation,
trust_remote_code warning, new terracotta logo + Web UI color scheme.
2026-04-01 18:29:48 +05:00
Alpamys 3247dfb1b1 fix: use relative logo path in Web UI, add SVG logo to repo 2026-04-01 18:23:57 +05:00
Alpamys 4164c0ad80 fix: replace SVG logo with PNG (GitHub doesn't render SVG in README) 2026-04-01 18:22:06 +05:00
Alpamys 4ee6968d7e chore: rebrand to new terracotta logo, update Web UI color scheme
Replace purple/cyan cyberpunk theme with warm terracotta palette matching
new SVG logo. Update README to use soup_logo_svg.svg. Update chart colors
in app.js to match new palette (#C0512D primary, #E8975A warm accent).
2026-04-01 18:18:37 +05:00
Alpamys 4affc1a5c7 fix: use ANSI-safe assertions in synth data pro help tests (macOS CI fix) 2026-04-01 18:16:09 +05:00
Alpamys 114225ef59 test: add TDD review gap tests — malformed responses, URL hardcoding, shared utils
Address TDD review findings: test Anthropic hardcoded URL, malformed
response handling for all 3 providers, shared parse_json_array utility.
13 new tests, 1682 total.
2026-04-01 18:11:37 +05:00
Alpamys 6157bbb4b5 fix: implement rate limiting, add trust_remote_code warning, fix dedup logging
- Implement sleep-based rate limiting using --requests-per-minute flag
  (was declared but never enforced).
- Add Rich warning panel before loading local models with
  trust_remote_code=True, matching SGLang/audio precedent.
- Replace silent ValueError pass in dedup pipeline with debug logging.
2026-04-01 18:07:47 +05:00
Alpamys 68d958d14c fix: address python review — extract parse_json_array, narrow exceptions
- Extract _parse_json_array into soup_cli/data/providers/_utils.py to
  avoid circular imports between generate.py and provider modules.
- Narrow bare except Exception in detect_ollama to httpx.HTTPError/OSError
  with debug logging instead of silent swallow.
2026-04-01 18:04:24 +05:00
Alpamys 011ebb6478 docs: update test counts and security notes after path confinement fix 2026-04-01 17:57:29 +05:00
Alpamys 5ecfb0b29c fix: strengthen path confinement in generate command (security review)
Replace simple '..' check with resolve() + relative_to(cwd) for output
path. Add same confinement guard to --seed, --dedup-with, and --context
file paths. Add _path_within_cwd helper. 4 new security tests.
2026-04-01 17:54:02 +05:00
Alpamys ea8f785b50 feat: add synth data gen pro with multi-provider, templates, quality pipeline (v0.20.0)
New providers: Ollama (localhost-only), Anthropic Claude (env-only API key),
vLLM (SSRF-protected). Domain templates: code, conversation, qa, preference,
reasoning. Quality pipeline: --validate, --filter, --dedup, --quality-pipeline.
84 new tests, 1669 total. Security: SSRF protection on all providers, output
path traversal prevention, rate limiting.
2026-04-01 17:44:23 +05:00
Alpamys 45522ef4e7 fix: use ANSI-safe assertions in eval human help test (macOS CI fix)
Rich markup wraps --model-a with ANSI codes on macOS, breaking the
substring check. Strip ANSI codes before asserting, matching the
existing pattern in test_speculative_decoding.py and test_deploy_ollama.py.
2026-04-01 14:51:38 +05:00
Alpamys c46265fd18 feat: add eval platform with custom evals, LLM judge, human eval, leaderboard (v0.19.0)
Full-featured evaluation system with 7 subcommands:
- soup eval benchmark: standard benchmarks via lm-evaluation-harness
- soup eval custom: custom JSONL eval tasks with 4 scoring modes
- soup eval judge: LLM-as-a-judge (OpenAI/Ollama/server backends)
- soup eval auto: automatic post-training evaluation from config
- soup eval compare: side-by-side eval comparison with regression detection
- soup eval leaderboard: local model leaderboard with JSON/CSV export
- soup eval human: terminal A/B comparison with Elo ratings

New modules: soup_cli/eval/ (custom.py, judge.py, human.py, leaderboard.py)
Config: EvalConfig added to schema.py (auto_eval, benchmarks, custom_tasks, judge)
Callback: SoupTrainerCallback.on_train_end triggers auto-eval when configured

Security: SSRF protection on judge API, ReDoS guard on regex scoring,
API key isolation per provider, 10k task/prompt caps, read-only SQL queries

1585 tests, 58 test files, ruff clean
2026-04-01 14:47:08 +05:00
Alpamys eb6d1e8671 docs: update version refs to v0.18.2 in CLAUDE.md 2026-04-01 14:03:57 +05:00
Alpamys e072c9d844 chore: bump version to v0.18.2 2026-04-01 14:02:33 +05:00
Alpamys a55f6745e9 fix: use ANSI-safe assertions in deploy help tests (macOS CI fix)
Rich markup in Typer help output inserts ANSI escape codes around
--flag names on macOS, breaking exact string matches. Check for
lowercase words instead of --prefixed flags.
2026-04-01 14:01:39 +05:00
Alpamys ad819e32af chore: bump version to v0.18.1
Post-review fixes since v0.18.0 tag:
- Validate model name before ollama rm
- Fix reversed mock decorator argument order in tests
- Auto-detect chat template in export --deploy path
- Add 7 edge-case tests (OSError, timeout, boundary)
2026-04-01 13:58:46 +05:00
Alpamys 7416ccdf74 test: add edge-case tests for Ollama deploy (TDD review findings)
Add 7 tests for previously uncovered branches:
- deploy_to_ollama OSError path
- remove_model timeout and OSError paths
- list_soup_models timeout and nonzero returncode
- validate_model_name 128-char boundary
- detect_ollama version-in-stderr fallback
2026-04-01 13:55:12 +05:00
Alpamys 4df66414ce fix: auto-detect chat template in export --deploy ollama path
Use _auto_detect_template() from soup.yaml instead of hardcoding chatml
in the --deploy ollama flow. Falls back to chatml if detection fails.
2026-04-01 13:53:48 +05:00
Alpamys 1d84595938 fix: correct mock parameter names and add assertion in deploy tests
Fix reversed @patch decorator argument binding in 4 tests and add
mock_deploy_fn.assert_called_once() in test_export_deploy_ollama_success.
2026-04-01 13:53:03 +05:00
Alpamys ba7a6b1ee1 fix: validate model name before ollama rm (security review finding)
Add validate_model_name() check in deploy --remove path to prevent
passing unsanitized names to ollama rm subprocess. Adds test coverage.
2026-04-01 13:51:15 +05:00
Alpamys f98519ef87 feat: add Ollama integration — deploy GGUF models in one command (v0.18.0)
New commands:
- `soup deploy ollama` — deploy GGUF to local Ollama with auto-template detection
- `soup deploy ollama --list` / `--remove` — manage Soup-deployed models
- `soup export --deploy ollama` — export + auto-deploy in one step

New files:
- soup_cli/utils/ollama.py — detect, deploy, list, remove, Modelfile generation
- soup_cli/commands/deploy.py — Typer command group with Rich panels
- tests/test_deploy_ollama.py — 78 tests covering all paths

Security hardening:
- GGUF path traversal protection + .gguf extension validation
- Model name validation (no path separators, null bytes)
- Modelfile parameter key allowlist prevents directive injection
- Parameter value newline/null sanitization
- Subprocess calls use list args (no shell injection)
- Warning panel before overwriting existing Ollama models

1449 tests, 57 test files, all passing.
2026-04-01 13:47:40 +05:00
Alpamys 986f8cb26c feat: add GitHub repo link to CLI output, bump version to v0.17.3
Show GitHub URL in `soup version`, `soup version --full`, `soup doctor`,
and `soup --help` so users can find and star the repo.
Extract URL to GITHUB_URL constant in utils/constants.py.
2026-03-26 15:48:04 +05:00
Alpamys 6687f92682 docs: add Troubleshooting section for torch DLL and dual Python issues 2026-03-26 15:20:36 +05:00
Alpamys ab611ce9a5 chore: bump version to v0.17.2 2026-03-26 15:16:04 +05:00
Alpamys 42b56f1570 fix: rename APIs to match test plan, fix RoPE factor detection
- Rename is_liger_available -> check_liger_available
- Rename detect_flash_attention -> check_flash_attn_available
- Rename is_ring_attention_available -> check_ring_attention_available
- Rename is_sglang_available -> check_sglang_available
- Rename compute_coherence_scores -> compute_coherence_score
- Rename FSDP keys: fsdp_full_shard -> full_shard, etc.
- Fix get_rope_scaling_config to accept factor-style args (e.g., 4.0)
- Update all callers, tests, and README
- 1371 tests pass, ruff clean, 58.81% coverage
2026-03-26 15:14:24 +05:00
Alpamys e30a637f48 chore: bump version to v0.17.1
- Fix outdated __version__ reference in CLAUDE.md (was showing 0.14.2)
- Version bump in pyproject.toml, __init__.py, CLAUDE.md, plan.md
- All 1369 tests pass, ruff clean, 58.80% coverage
2026-03-26 14:53:55 +05:00
Alpamys 705e6b260a fix: skip SGLang FastAPI tests when fastapi not installed (CI fix)
SGLang app tests require fastapi which is an optional dependency.
Skip these tests gracefully on CI environments without fastapi installed.
2026-03-26 14:19:43 +05:00
Alpamys 20c2f4e515 fix: use AutoModel for audio, is_relative_to path check, early librosa import
- Use AutoModel instead of AutoModelForCausalLM for audio-language models
  (Qwen2-Audio, Whisper don't work with causal LM auto class)
- Use Path.is_relative_to() for path traversal check (symlink-safe, Python 3.9+)
- Fail fast with helpful error if librosa not installed before dataset processing
2026-03-26 13:59:46 +05:00
Alpamys fb1f49afc8 test: add missing coverage for _parse_json_array, _validate_example, SSRF guards
Addresses TDD review findings:
- Tests for _parse_json_array (markdown fences, NDJSON fallback, empty, invalid)
- Tests for _validate_example (alpaca, sharegpt, chatml, unknown format)
- Tests for _generate_server SSRF validation (scheme whitelist, remote HTTP block)
- Tests for SGLang SSRF validation (URL model path rejection)
- Fix vacuous test_server_provider_accepted assertion

1369 tests, 58.84% coverage.
2026-03-26 13:57:03 +05:00
Alpamys bc743e2814 fix: pad token perf in perplexity scoring, SGLang SSRF validation
- Use -100 ignore_index for pad tokens in perplexity computation (avoids
  redundant softmax on padding positions)
- Block URL-based model paths in SGLang create_sglang_runtime (SSRF protection)
2026-03-26 13:51:57 +05:00
Alpamys 0b7759898c fix: address review findings — immutable rows, response guard, GPU cleanup
- Stop mutating dataset rows in-place in _validate_audio_files (use shallow copy)
- Guard _generate_server response parsing against unexpected JSON shape
- Add empty dataset guard in _prepare_audio_dataset
- Free GPU memory after perplexity scoring in compute_perplexity_scores
2026-03-26 13:49:40 +05:00
Alpamys 3d66b41d00 v0.17.0: data quality filters, audio modality, SGLang backend, server provider
New features:
- soup data filter: quality filters with perplexity and coherence scoring
- modality: audio — Qwen2-Audio, Whisper fine-tuning with audio data format
- --backend sglang for soup serve (SGLang high-throughput inference)
- --provider server for soup data generate (local OpenAI-compatible servers)
- Audio template: soup init --template audio

Security hardening:
- Server provider SSRF validation (scheme whitelist, localhost-only HTTP)
- Audio file path traversal protection (resolved paths confined to audio_dir)
- trust_remote_code warning panels for audio models and SGLang runtime

1348 tests, 56 test files, 58.8% coverage, ruff clean.
2026-03-26 13:46:17 +05:00
Alpamys 83213e86c4 fix: strip ANSI escape codes in CLI help flag tests
Rich inserts color codes between flag name parts (e.g. --speculative
becomes \x1b[1;36m-\x1b[0m\x1b[1;36m-speculative\x1b[0m), so plain
substring match fails in CI. Strip ANSI before asserting.
2026-03-26 12:54:38 +05:00
Alpamys ff88a2c525 fix: resolve CI failures on macOS — speculative decoding flag collision + missing fastapi
- Rename --spec-tokens to --num-speculative-tokens to avoid prefix
  collision with --speculative-decoding in Typer help rendering
- Add pytest.skip for _create_app tests when fastapi is not installed
2026-03-26 12:46:29 +05:00