# Repository Briefing: skorch-dev/skorch
> Source: https://repoforai.com/repo/skorch-dev/skorch (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/skorch-dev/skorch
- **Category**: LLMs & Inference (大模型与推理微调)
- **Primary Language**: Jupyter Notebook
- **License**: BSD-3-Clause
- **Engineering Health**: A (82/100 · Maintenance 31/35 · Adoption 17/25 · Releases 14/20 · License 20/20)
- **Latest Release**: v1.4.0 (2026-05-14) — https://github.com/skorch-dev/skorch/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Docker
- **Momentum**: 6,186 ★ total (+0 24h / +2 7d) · 426 forks
- **Topics**: `scikit-learn`, `pytorch`, `machine-learning`, `huggingface`
- **When to Use**: Best for: Teams with an existing scikit-learn preprocessing and evaluation workflow that need to train and tune a custom PyTorch model within it. Skip if: You primarily need an LLM serving engine, require direct control over the training loop, or can meet the modeling goal with a native scikit-learn estimator.

## Overview
```text
### Architecture & Core Mechanics
skorch is an in-process estimator adapter, not a model server. The caller supplies a PyTorch `nn.Module`; `NeuralNetClassifier` wraps its training and prediction lifecycle behind scikit-learn methods such as `fit` and `predict_proba`. A `Pipeline` can fit a `StandardScaler` before the network, and `GridSearchCV` can vary both estimator settings and module constructor arguments through names such as `module__num_units`.

The setuptools configuration packages `skorch*` and excludes notebooks and assets from package discovery. The declared runtime dependencies are NumPy, scikit-learn, SciPy, tabulate, and tqdm. PyTorch is installed separately for the target platform. The extension points shown are the user’s module, nested training settings such as `iterator_train__shuffle`, and training callbacks; there is no separate service to connect to.

### Key Capabilities & Differentiators
The concrete classifier workflow accepts NumPy input, trains a user-defined network, and returns class probabilities. The same estimator can sit behind preprocessing or be tuned with cross-validation. Training features include learning-rate scheduling, scikit-learn and custom scoring, early stopping, checkpointing, parameter freezing and unfreezing, and progress reporting in terminals or notebooks.

Hugging Face and GPyTorch integrations extend interoperability, with GPyTorch covering Gaussian-process workflows. They do not establish support for any particular LLM family, serving protocol, or inference throughput. v1.4.0 adds scikit-learn metadata routing so supported workflows can pass information such as groups through `Pipeline` and `GridSearchCV`. It also extends tensor-to-NumPy conversion to more device types without specifying an exhaustive device matrix.

### Trade-offs & Limitations
Choose skorch over a handwritten PyTorch loop when estimator compatibility is the main requirement: preprocessing, scoring, and parameter search can stay in scikit-learn. A direct loop is preferable when the training procedure must be controlled explicitly and the estimator interface adds little. If a native scikit-learn estimator already meets the modeling goal, it avoids the extra PyTorch runtime and model code.

Grid search still repeats training across candidates and folds. With an internal validation split enabled, each outer fit trains on less of its fold; disabling it, as the example does, means revisiting callbacks that need internal validation scores. Size the runtime around the network, batch size, optimizer state, and concurrent fits rather than the adapter itself. The project is in low-development mode: maintenance continues, but adoption should not depend on a steady stream of new features.

### Hardware & Deployment Guide
For this checkout, use Python 3.11 or newer: `pyproject.toml` sets that floor even though the installation prose still mentions Python 3.9. Install the CPU or accelerator build of PyTorch appropriate for the host, then install skorch with pip or from the checkout. Training and prediction run in the application process without a hosted API. For reproducibility, pin and test the Python, PyTorch, and scikit-learn combination you deploy.

Treat the root Dockerfile as legacy rather than as a current deployment recipe. It starts from `nvidia/cuda:9.0-cudnn7-runtime`, installs Python 3.5 tooling, and copies a `requirements.txt` not listed in the supplied root tree. Build a fresh image if containerization is required. Recent releases address compatibility: v1.3.0 added the fitted-state protocol, v1.3.1 fixed the boolean result of `__sklearn_is_fitted__` for scikit-learn 1.8 compatibility, and v1.4.0 added metadata routing and broader device conversion.
```

## Key Capabilities
```text
- Estimator interface: `NeuralNetClassifier` exposes `fit` and `predict_proba` for a PyTorch `nn.Module`.
- Pipeline tuning: Search `module__num_units` alongside learning rate and epoch count, with the pipeline step prefix when applicable.
- Training controls: Configurable loader shuffling, learning-rate schedules, early stopping, checkpointing, and parameter freezing.
- Metadata routing: v1.4.0 makes `NeuralNet` a scikit-learn metadata router and consumer.
- Runtime packaging: The current `pyproject.toml` requires Python 3.11+ and leaves PyTorch installation separate.
- Container caveat: The Dockerfile uses CUDA 9.0/cuDNN 7 and Python 3.5-era tooling; its `requirements.txt` input is absent from the supplied root tree.
```

## Quick Start / Clone
```bash
git clone --depth 1 https://github.com/skorch-dev/skorch.git
cd skorch
```
