Skip to content
Projekte

Über uns

Eine auf PyTorch aufbauende Bibliothek zur Erstellung von Embeddings für diskrete Ereignisfolgen mithilfe von Selbstüberwachung

Entwicklerwerkzeuge

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
-1
in 15 days
+1
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

ptls-logo

GitHub license PyPI version GitHub issues Telegram

pytorch-lifestream or ptls a library built upon PyTorch for building embeddings on discrete event sequences using self-supervision. It can process terabyte-size volumes of raw events like game history events, clickstream data, purchase history or card transactions.

It supports various methods of self-supervised training, adapted for event sequences:

  • Contrastive Learning for Event Sequences (CoLES)
  • Contrastive Predictive Coding (CPC)
  • Replaced Token Detection (RTD) from ELECTRA
  • Next Sequence Prediction (NSP) from BERT
  • Sequences Order Prediction (SOP) from ALBERT
  • Masked Language Model (MLM) from ROBERTA

It supports several types of encoders, including Transformer and RNN. It also supports many types of self-supervised losses.

The following variants of the contrastive losses are supported:

Install from PyPi

pip install pytorch-lifestream

Install from source

Install uv, then run from the repository root:

uv sync --locked
uv run pytest

For a runtime-only environment, use uv sync --locked --no-dev. The development dependencies support Python 3.10 and 3.13. To select a version, run uv sync --locked --python 3.13 and uv run --python 3.13 pytest (replace 3.13 with 3.10 for Python 3.10). PySpark tests require Java 17. Dockerfile uses the same lockfile for tests. DockerfilePaper retains the separate, historical paper reproduction environment.

Demo notebooks

We have a demo notebooks here, some of them:

  • Supervised model training notebook Open In Colab
  • Self-supervided training and embeddings for downstream task notebook Open In Colab
  • Self-supervided embeddings in CatBoost notebook
  • Self-supervided training and fine-tuning notebook Open In Colab
  • Self-supervised TrxEncoder only training with Masked Language Model task and fine-tuning notebook
  • Pandas data preprocessing options notebook Open In Colab
  • PySpark and Parquet for data preprocessing notebook
  • Fast inference on large dataset notebook
  • Supervised multilabel classification notebook Open In Colab
  • CoLES multimodal notebook Open In Colab

And we have a tutorials here

Docs

Documentation

Library description index

Experiments on public datasets

pytorch-lifestream usage experiments on several public event datasets are available in the separate repo

PyTorch-LifeStream in ML Competitions

How to contribute

  1. Make your chages via Fork and Pull request.
  2. Write unit test for new code in ptls_tests.
  3. Check unit test via pytest: Example.

Citation

We have a paper you can cite it:

@inproceedings{sakhno2025pytorch,
  title={PyTorch-Lifestream: Learning Embeddings on Discrete Event Sequences},
  author={Sakhno, Artem and Kireev, Ivan and Babaev, Dmitrii and Savchenko, Maxim and Gusev, Gleb and Savchenko, Andrey},
  booktitle={Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence},
  pages={11104--11108},
  year={2025}
}

Ähnliche Projekte entdecken

Wird geladen…