U-Time: training U-Sleep across many polysomnography datasets from one command line
U-Time: A Fully Convolutional Network for Time Series Segmentation
At a glance
- What is it?
- The repository behind the U-Sleep sleep staging model is a training and evaluation harness, not a pretrained model. It is built for people who want to retrain or extend the architecture on their own PSG recordings, and it assumes a Linux box, a CUDA GPU and a lot of disk.
- Who is it for?
- Adopt U-Time if you have your own polysomnography corpora and want to train or extend a fully convolutional sleep stager on them; skip it if you only need staging output, because the README points that use case at the hosted sleep.ai.ku.dk service and the Python bindings repository instead.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 83 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
The problem U-Time solves is channel heterogeneity, not sleep staging in the abstract
Sleep staging models are usually trained on one cohort with one montage. A model fitted that way tends to degrade when the next hospital records with a different electrode set, a different sampling rate or a different amplifier. U-Time exists to attack that specific failure. The README describes the software as allowing "simultaneous training of U-Sleep across any number of PSG datasets using on-the-fly random selection of input channel configurations." That sentence is the whole design brief. Instead of fixing the input tensor to one channel layout, the training loop draws a channel configuration at random for each sample, so the network sees many montages during a single run. The intended user is a researcher or clinical data engineer with several PSG corpora in hand and a GPU to train on, not a clinician who wants a staging report. The README is explicit about that split: people who want to use the pretrained model are directed to the sleep.ai.ku.dk webserver and to a separate repository of Python bindings for its API.
What the repository actually contains: two models, one codebase, diverging branches
The naming is the first thing to get straight. U-Time is the general purpose time-series segmentation model from the NeurIPS 2019 paper. U-Sleep is the later, sleep-specific model built for what the README calls "resilient high-frequency sleep staging." The repository on the main branch trains both, but the README warns that it "has been significantly extended since [1] and may gradually diverge from the version described in [2]." Frozen copies are kept as tags and branches: a usleep-paper-version branch, a utime-latest branch, and a utime-paper-version release. If you are trying to reproduce a published number, that warning matters. The main branch is a moving target, and the paper-faithful code lives elsewhere in the same repository. There are no retrieved releases on the default branch, so pinning to a commit hash rather than tracking main is the safer habit for a training run you intend to report.
The interface is a command-line tool, and the README stops short of documenting it
The README states that the package "features a command-line interface for initializing, training and evaluating models without needing to modify the underlying codebase." That is the intended workflow: you generate a project directory, point the trainer at your datasets, and run. What the supplied material does not give is the actual subcommands, their flags, or the project directory schema. The Demo section begins preparing a project directory and is truncated mid-sentence, so the concrete commands for initializing a project, selecting datasets or launching training are not visible here. Installation, by contrast, is fully specified. On a Linux machine with a CUDA GPU and conda installed:
git clone https://github.com/perslev/U-Time.git conda env create --file U-Time/environment.yaml conda activate u-sleep pip install U-Time/
or, from PyPI, with the caveat that the README says the PyPI package "may be updated less frequently":
pip install utime
The environment file is the pinned dependency source, and it is the thing to read first if you need to know which TensorFlow and NumPy versions you are signing up for.
Hardware and storage are the real admission price
The README gives a recommended training machine: Linux, 4 or more CPU cores, 8 or more GiB of RAM, a CUDA enabled GPU, and what it calls "significant physical storage space." The footnotes turn that into numbers. The demo needs about 11 GiB of disk and roughly 30 minutes on a typical computer and network connection, with most of that time spent downloading data from public databases. The full reproduction of U-Sleep needs approximately 4 TiB. The authors report training the published U-Sleep model on 8 CPU cores, 1 GPU and 40 GiB of RAM. GPU software is pinned too: TensorFlow 2.8.0, NVIDIA drivers 450.x or higher, CUDA Toolkit 11.2, cuDNN 8.1. That combination is old by current standards, and it is the most likely place for an install to fail on a newer machine. CPU-only training is possible and the software has been tested on MacOS Catalina for CPU-based training and prediction, but the README's own phrasing is that doing so "may take considerable time." If the dataset exceeds system memory, the README says data must be preprocessed and streamed from disk, with the demo showing how.
Where this is the wrong tool: you want labels, not a training harness
The clearest boundary is stated in the README itself. If your goal is automated sleep staging on recordings you already have, the repository is the wrong entry point. The maintainers direct that audience to the hosted U-Sleep service and its API bindings, and note that U-Sleep is also offered under research and commercial licences on the youSleep BETA platform. Cloning this repository to get predictions means taking on the whole training stack for something the project already serves over HTTP. A second limitation is portability of the pinned stack. The environment targets TensorFlow 2.8.0 with CUDA 11.2 and cuDNN 8.1, which constrains which GPUs and drivers you can use without editing the environment file. A third is reproducibility against the papers: because the main branch has been extended and may diverge, a run on main is not automatically a run of the published U-Sleep configuration. The paper versions are preserved as separate branches and tags precisely because of that drift.
How it differs from a general segmentation library
The obvious comparison is a general purpose time-series segmentation toolkit, for example a framework built around sliding windows and a standard supervised loop. The difference is in what gets randomized. A conventional pipeline fixes the feature set before training: you decide the channels, resample everything to match, and the model learns one input distribution. U-Time instead samples channel configurations during training, which is why the README can claim one model instance works across populations and acquisition protocols. The cost of that choice is that your data loaders and preprocessing have to support many montages rather than one, and the training loop carries the complexity of that sampling. The other comparison the README makes is against the hosted service. The webserver gives you staging output with no environment to build; the repository gives you the ability to retrain, extend or adapt the model, and in exchange you own the GPU, the storage and the dependency pins. Neither is a substitute for the other.
Licence, maintenance and what a fork actually costs you
The repository is MIT licensed, which is permissive and places few conditions on reuse beyond preserving the licence notice. That licence covers this code, not any pretrained weights or hosted service; the README notes that U-Sleep is available under separate research and commercial licences on the youSleep BETA platform, so check which artefact you are actually redistributing. Treat that as a pointer to read the terms, not as legal advice. On maintenance: the last push is dated 2026-06-24 and the repository is not archived, but there are no retrieved releases on the default branch, so there is no versioned artefact to upgrade against. Upgrading means re-resolving the conda environment and re-checking the TensorFlow, CUDA and cuDNN pins, which is the step most likely to break. If you fork, budget for owning that environment file, because the pinned stack will age faster than the model code around it.
Editorial conclusion
Adopt U-Time if you have your own polysomnography corpora and want to train or extend a fully convolutional sleep stager on them; skip it if you only need staging output, because the README points that use case at the hosted sleep.ai.ku.dk service and the Python bindings repository instead. Before committing, verify three things on your own machine: that the conda environment resolves with TensorFlow 2.8.0 and your CUDA 11.2 / cuDNN 8.1 driver stack, that you have the disk headroom the demo and full reproduction demand (roughly 11 GiB and 4 TiB respectively according to the README), and that your PSG channel naming can be mapped to the input configurations the training loop samples from.
Community notes