# U-Time, four names, one CLI, and a dependency list with no upper bounds

> U-Time is the official training code for U-Time, a general time series segmentation network, and U-Sleep, a fully convolutional sleep staging model built on it. The science is settled and documented; the packaging is where the friction is, with stale Python classifiers, TensorFlow as a hard dependency for prediction, three preserved historical refs, and a pre-trained model that lives on a different site entirely.

**perslev/U-Time** — U-Time: A Fully Convolutional Network for Time Series  Segmentation

- Repository: https://github.com/perslev/U-Time
- Stars: 318 · Forks: 83
- Language: Python
- License: MIT
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/perslev-u-time

## The repository, the package, the environment, and the command

One piece of software goes by four names, and finding the right one at each step is part of the work.

The repository is U-Time. The distribution on PyPI and the package directory are utime. The conda environment created by the install recipe is u-sleep. And the console command the package installs is ut, mapped in setup.py to utime.bin.ut:entry_func.

```bash
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/
```

So a single `ut` invocation is the whole interface, and it is deliberately the only one. The stated benefit of the command line is that you can initialize, train, and evaluate models without modifying the underlying codebase at all, which is the right shape for a research tool that other people need to extend without forking.

There is also a second channel, and the README qualifies it. pip install utime works, but is described as possibly being updated less frequently than the repository. For a project whose reproducibility depends on which ref you are on, a second-class package index is worth knowing about before you pin anything to it.

## The classifiers say 3.6 while the stack needs TensorFlow 2.8

The package metadata and the dependency list were written at different times, and the gap is visible in setup.py.

The classifiers declare Operating System :: POSIX and Programming Language :: Python :: 3.6 and 3.7. The requirements file asks for tensorflow>=2.8.0 and tensorflow-addons>=0.16.1, with numpy at 1.21.5 or newer and scikit-learn at 1.0.2 or newer.

A floor of TensorFlow 2.8 does not sit comfortably beside a Python 3.6 classifier, and the classifiers were clearly not revisited after the neural network stack moved on. Nothing in the file claims a newer Python, so a resolver has to work that out from the requirements rather than from the metadata.

Two other details in the same file are worth knowing. The version is not written in setup.py at all; it is read by executing utime/version.py, and the script raises if it finds nothing. And setup_requires asks for setuptools_git, which is a deprecated setuptools hook rather than the modern equivalent in pyproject.toml.

The long description is assembled as the README plus the contents of HISTORY.rst, so the changelog is appended to the project description on the package page. That is a small thing that tells you the file was written to be read on PyPI rather than only in the repository.

## TensorFlow is a hard dependency even for prediction

There is one requirements file and it serves both training and inference.

Running an already trained U-Sleep model is described as something a modern laptop can typically do. The package it needs is still the same package, and tensorflow>=2.8.0 is in install_requires rather than in an extra. So a prediction-only install pulls the training stack with it.

The rest of the list is eighteen entries with lower bounds and no upper bounds. Alongside TensorFlow and tensorflow-addons there is numpy, scipy, pandas, scikit-learn, matplotlib, h5py, tables for PyTables, mne, wfdb, and psg_utils for signal formats, plus psutil, tabulate, ruamel.yaml, yamlhparams, requests, and carbontracker.

The absence of upper bounds is the part that will bite. tensorflow>=2.8.0 admits every later 2.x release, and tensorflow-addons>=0.16.1 has a much narrower real range than that floor suggests. A fresh install in a year is the case where this matters, not the machine you are on today.

The domain libraries are the interesting part of the list. mne, wfdb, and psg_utils mean the pipeline reads standard sleep and electrophysiology formats directly, which is why a demo can pull data from public databases without a conversion step.

## Three earlier versions are preserved as refs

The repository says out loud that it has drifted from the version in the paper, and then keeps the old ones.

The README notes the repository has been significantly extended since the U-Time work and may gradually diverge from the version described for U-Sleep. It then points at three earlier states: a branch named usleep-paper-version, a branch named utime-latest for the U-Time-only code, and a release tag named utime-paper-version.

So there are four code states available and nothing in the naming tells you which one produced a given result. Two of them are branches, which move, and one is a tag, which does not.

For the U-Time model itself the answer is a dedicated section of the documentation, since the older model can still be trained from the same code. For U-Sleep, the branch is the one you want if you are reproducing a published number, and main if you want the current feature set.

There are no GitHub releases on the default branch, so the release tab shows nothing while a release tag still exists under a name that is easy to miss.

## Four cores and 8 GiB is the floor, 40 GiB is the truth

The hardware section gives a minimum and then tells you what was actually used, and the two are far apart.

The minimum for training from scratch is Linux with 4 or more CPU cores, 8 GiB of RAM or more, significant storage, and one CUDA enabled GPU. Smaller machines and CPU-only runs are described as possible but taking considerable time.

The reference configuration behind the published model is 8 CPU cores, 1 GPU, and 40 GiB of RAM. A full reproduction of that result needs approximately 4 TiB of available storage, and the footnote says hard disk requirements scale with the number and size of datasets considered.

The memory figure is the one to read twice, because it is not really about RAM. If the dataset exceeds system memory, data must be preprocessed and streamed from disk instead of held in a pool. On larger machines the advice is to keep a larger pool in memory. That is a fork in the pipeline rather than a performance knob: an in-memory run and a streaming run are different code paths with different failure modes.

## The tested platforms are three operating systems old

The software requirements name specific versions, and every one of them has moved on.

Development and testing were on Red Hat Enterprise Linux 7.8 and Ubuntu 18.04 servers, with the note that any modern distribution should work. macOS Catalina 10.15.6 was tested for CPU-based training and prediction only. Anaconda or Miniconda 4.5 or higher, 64-bit, is the environment.

For GPU work the requirements are NVIDIA drivers at v450.x or higher, CUDA Toolkit v11.2, and cuDNN SDK v8.1, with TensorFlow 2.8.0 needed for the package to use a GPU at all.

There is an odd sentence about TensorFlow worth quoting accurately, because it reads as a contradiction: you do not need to install TensorFlow yourself, since the installation guide handles it, but the driver, toolkit, and cuDNN software must be installed before you proceed.

So the system layer is pinned to a CUDA generation and two long-term-support Linux releases, and the inference-only path on macOS is explicitly narrower than the training path.

## The trained model is not in this repository

If you want to use U-Sleep rather than train it, this repository is the wrong place to look.

The README routes anyone interested in the pre-trained model to sleep.ai.ku.dk and points at a separate repository for Python bindings to that web server API. It also states that U-Sleep is available under research and commercial licences through the youSleep BETA platform, which is a third destination again.

That makes the division of labour clear. This repository trains and evaluates. The hosted service applies. And a separate platform handles licensing for people who want to run the model rather than rebuild it.

The demo in between is sized for a first run: about 30 minutes on a typical machine, of which most of it is spent downloading data from public databases, and roughly 11 GiB of disk. It trains on a significantly limited subset of the datasets used for the published model, which is the right way to check the pipeline before committing to the four-terabyte version.

Three tiers of access, three places to look, and one repository that only covers the middle one.

## Conclusion

Use this repository if you intend to train U-Sleep yourself rather than consume a hosted sleep staging service, since a trained model and its web API are offered separately. Check four things before you start. Which ref you want, because main has drifted from the published U-Sleep version and two branches plus a release tag preserve the earlier states. Whether your Python and TensorFlow versions resolve, since the classifier metadata still advertises 3.6 and 3.7 while the requirements floor is TensorFlow 2.8. Whether your data fits in RAM, because a dataset larger than memory means preprocessing and streaming rather than a slower run. And whether you need 4 TiB of disk, which is what a full reproduction is said to require.

## FAQ

### How do I install and run the U-Time package?

Clone the repository, create the conda environment from U-Time/environment.yaml, activate it as u-sleep, and pip install U-Time/. There is also pip install utime from PyPI, described as possibly updated less frequently. The console command the package installs is ut, mapped to utime.bin.ut:entry_func.

### What hardware does training U-Sleep need?

The stated minimum is Linux with 4 or more CPU cores, 8 GiB of RAM, and one CUDA enabled GPU. The published model was trained with 8 CPU cores, 1 GPU, and 40 GiB of RAM, and a full reproduction needs approximately 4 TiB of storage. Prediction with a trained model may typically be done on any modern laptop.

### Which code version should I use to reproduce U-Sleep?

The README says the repository has been extended since the U-Time work and may gradually diverge from the version described for U-Sleep. Earlier states are kept as a branch named usleep-paper-version, a branch named utime-latest, and a release tag named utime-paper-version.

### Does TensorFlow come with U-Time, and which version?

It is a hard runtime requirement in requirements.txt at tensorflow>=2.8.0, alongside tensorflow-addons>=0.16.1, with no upper bounds. GPU use additionally needs NVIDIA drivers at v450.x or higher, CUDA Toolkit v11.2, and cuDNN SDK v8.1 installed on the system first.

## Sources

- [Issues](https://github.com/perslev/U-Time/issues)
- [License: MIT](https://github.com/perslev/U-Time/blob/main/LICENSE)
- [perslev/U-Time on GitHub](https://github.com/perslev/U-Time)
- [README](https://github.com/perslev/U-Time/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/perslev-u-time
