# CCSD - Combinatorial Complex Score-based Diffusion Modelling through Stochastic Differential Equations
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pypi version](https://img.shields.io/pypi/v/ccsd.svg)](https://pypi.python.org/pypi/ccsd)
[![Documentation Status](https://readthedocs.org/projects/ccsd/badge/?version=latest)](https://ccsd.readthedocs.io/en/latest/?badge=latest)
[![visitors](https://visitor-badge.laobi.icu/badge?page_id=AdrienC21.CCSD&right_color=%23FFA500)](https://github.com/AdrienC21/CCSD)
[![Downloads](https://static.pepy.tech/badge/ccsd)](https://pepy.tech/project/ccsd)
[![Python versions](https://img.shields.io/badge/python-3.10%20%7C%203.11-blue)](https://pypi.python.org/pypi/ccsd)
[![Test](https://github.com/AdrienC21/CCSD/actions/workflows/test.yml/badge.svg)](https://github.com/AdrienC21/CCSD/actions/workflows/test.yml)
[![Lint](https://github.com/AdrienC21/CCSD/actions/workflows/lint.yml/badge.svg)](https://github.com/AdrienC21/CCSD/actions/workflows/lint.yml)
[![Codecov](https://codecov.io/gh/AdrienC21/CCSD/branch/main/graph/badge.svg)](https://app.codecov.io/gh/AdrienC21/CCSD)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)
<p align="center"><img src="https://github.com/AdrienC21/CCSD/blob/main/logo.png?raw=true" alt="CCSD_logo" width="600"/></p>
**CCSD** is a sophisticated score-based diffusion model designed to generate Combinatorial Complexes using Stochastic Differential Equations. This cutting-edge approach enables the generation of complex objects with higher-order structures and relations, thereby enhancing our ability to learn underlying distributions and produce more realistic objects.
## Table of Contents
- [CCSD - Combinatorial Complex Score-based Diffusion Modeling through Stochastic Differential Equations](#ccsd---combinatorial-complex-score-based-diffusion-modeling-through-stochastic-differential-equations)
- [Table of Contents](#table-of-contents)
- [CCSD](#ccsd)
- [Introduction](#introduction)
- [Why CCSD?](#why-ccsd)
- [Author](#author)
- [Contributions](#contributions)
- [Installation](#installation)
- [Using pip](#using-pip)
- [Manually](#manually)
- [Next steps](#next-steps)
- [Plotly engine](#plotly-engine)
- [Dependencies and other packages/libraries](#dependencies-and-other-packageslibraries)
- [Tests and errors](#tests-and-errors)
- [Dependencies](#dependencies)
- [Testing](#testing)
- [Datasets](#datasets)
- [Process molecular datasets](#process-molecular-datasets)
- [Generate generic graphs datasets](#generate-generic-graphs-datasets)
- [Usage](#usage)
- [General](#general)
- [Command line](#command-line)
- [CCSD class](#ccsd-class)
- [Documentation](#documentation)
- [Commons errors](#commons-errors)
- [Installation of MOSES](#installation-of-moses)
- [Package-related errors](#package-related-errors)
- [Error due to MOSES](#error-due-to-moses)
- [Error due to TopoNetX when running the tests](#error-due-to-toponetx-when-running-the-tests)
- [Citation](#citation)
- [Acknowledgement](#acknowledgement)
- [Changelog](#changelog)
- [License](#license)
## CCSD
### Introduction
Complex object generation is a challenging problem with application in various fields such as drug discovery. The CCSD model offers a novel approach to tackle this problem by leveraging Diffusion Models and Stochastic Differential Equations to generate Combinatorial Complexes (CC). This topological structure generalizes the different mathematical stuctures used in Topological/Geometric Deep Learning to represent complex objects with higher-order structures and relations. The integration of the higher-order domain during the generation enhances the learning of the underlying distribution of the data and thus, allows for better data generation.
If you find this project interesting, we would appreciate your support by leaving a star ⭐ on this [GitHub repository](https://github.com/AdrienC21/CCSD).
Code still in **Alpha version!**
### Why CCSD?
CCSD stands out from traditional complex object generation models due to the following key advantages:
- *Combinatorial Complexes:* The model generates Combinatorial Complexes, enabling the synthesis of complex objects with rich structures and relationships.
- *Score-Based Diffusion:* CCSD utilizes score-based diffusion techniques, allowing for efficient, high-quality and state-of-the-art complex object generation.
- *Enhanced "Realism":* By incorporating higher-order structures, the generated objects are more representative of the underlying data distribution.
Also, this **repository is highly documented and commented**, which makes it easy to use, understand, deploy, and which offers endless possibilities for improvements.
### Author
The research has been conducted by **Adrien Carrel** as part of his requirements for the MSc degree in Advanced Computing of Imperial College London, United Kingdom, and his requirements for the MEng in Applied Mathematics (Diplôme d'Ingénieur) at CentraleSupélec, France.
<a href="https://linkedin.com/in/adrien.carrel/" target="_blank"><img align="center" src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/linkedin.svg" alt="linkedin" height="39" width="52"/></a>
<a href="https://www.instagram.com/adrien.carrel" target="_blank"><img align="center" src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/instagram.svg" alt="instagram" height="39" width="52" /></a>
<a href="https://github.com/AdrienC21/" target="_blank"><img align="center" src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/github.svg" alt="github" height="39" width="52" /></a>
This project has been **supervised by [Dr. Tolga Birdal](https://www.imperial.ac.uk/people/t.birdal)**, Assistant Professor (Lecturer) in the Department of Computing of Imperial College London.
### Contributions
We welcome new contributors with various background and programming levels who would like to contribute to the fields of diffusion models and topological deep learning. Feel free to suggest new ideas, submit pull requests, etc.
Feel free to check our [Code of Conduct](https://github.com/AdrienC21/CCSD/CODE_OF_CONDUCT.md) if you wish to contribute.
## Installation
If you encounter an error during the installation, please refer to the section **Commons errors** below. If you are creating an Ubuntu instance on a Public Cloud service to train/sample from the model, you may want to use the `post_installation_script.sh` script provided to automate the process (just modify the **Git configurations** section inside the script with your details).
### Using pip
To get started with CCSD, you can install the package using pip by typing the command:
```bash
pip install ccsd
```
### Manually
If you encounter, if you want to use the latest version, or if you prefer the command line interface, you can use it locally by cloning or forking this repository to your local machine.
```bash
git clone https://github.com/AdrienC21/CCSD.git
```
### Next steps
#### Plotly engine
For Windows users, the recommended version of kaleido is *0.1.0.post1*. You can install it by typing:
```bash
pip install kaleido==0.1.0post1
```
For Linux users, the latest version of kaleido seems fine. For those who want to use `orca`, you can install it via the *npm* command of *Node.js*. For the installation, type:
```bash
sudo NEEDRESTART_MODE=a apt install -y nodejs
sudo NEEDRESTART_MODE=a apt install -y npm
npm install -g electron@6.1.4 orca
```
#### Dependencies and other packages/libraries
Install the dependencies (see the section **Dependencies** below).
When installing PyTorch and its componenents, or when install TopoModelX along with TopoNetX, run the commands below:
```bash
pip install torch==2.0.1 --extra-index-url https://download.pytorch.org/whl/${CUDA}
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.0.1+${CUDA}.html
```
where ${CUDA} could be `cu117`, `cu118`, or `cpu` if you want to use the CPU. For GPU, we recommend `cu118`. Also, TopoModelX should be installed after TopoNetX to avoid versioning issues.
If you are using a **Linux** system, you may need to install libxrender1 by typing:
```bash
sudo apt-get install libxrender1
```
#### Tests and errors
To test your installation, refer to the section **Testing** below.
If you encounter an error, please refer to the section **Commons errors** below.
## Dependencies
CCSD requires a recent version of Python, probably 3.7, but preferably **3.10 or higher**.
It also requires the following dependencies:
- dill>=0.3.6
- easydict>=1.10
- freezegun>=1.2.2
- hypernetx>=1.2.5
- imageio>=2.31.1
- joblib>=1.3.1
- kaleido>=0.1.0.post1
- matplotlib>=3.7.2
- networkx>=2.8.8
- numpy>=1.24.4
- pandas>=2.0.3
- plotly>=5.15.0
- pyemd>=1.0.0
- pytest>=7.4.0
- pytz>=2023.3
- pyyaml>=6.0
- rdkit>=2023.3.2
- scikit_learn>=1.3.0
- scipy>=1.11.1
- Cython
- pomegranate
- toponetx
- torch>=2.0.1
- tqdm>=4.65.0
- molsets>=0.3.1
- pytest-cov
- wandb
- pandas>=2.0.3
Please make sure you have the required dependencies installed before using CCSD.
You can install all of them by running the command:
```bash
pip install -r requirements.txt
```
## Testing
To ensure the correctness and robustness of CCSD and to allow researchers to build upon this tool, we have provided an extensive test suite. To run the tests, clone the repository, change your directory to the root folder of this project and execute the following command:
```bash
pytest tests/ -W ignore::DeprecationWarning
```
If you encounter an error during the testing, please refer to the section **Commons errors** below.
The output should look like this:
```bash
==================================================== test session starts ====================================================
...
tests\utils\test_mol_utils.py .................. [ 98%]
tests\utils\test_time_utils.py .. [100%]
============================================== 128 passed in 70.03s (0:01:10) ===============================================
```
## Datasets
For more information about the script below and their arguments, you can type:
```bash
python <script_path> --help
```
### Process molecular datasets
If you want to use molecular datasets such as QM9 or ZINC250k, you first need to run the two following commands:
```bash
python ccsd/data/preprocess.py --dataset <dataset_name> --folder <folder_name>
python ccsd/data/preprocess_for_nspdk.py --dataset <dataset_name> --folder <folder_name>
```
`<dataset_name>` has to be chosen from this list: `["QM9", "ZINC250k"]`. `<folder_name>` is the location of the `data` folder that contains the datasets (default to `./`).
### Generate generic graphs datasets
If you want to generate generic graphs datasets, you can run the following command:
```bash
python ccsd/data/data_generators.py --dataset <dataset_name> --folder <folder_name>
```
`<dataset_name>` has to be chosen from this list: `["community_small", "grid", "ego_small", "ENZYMES"]`. `<folder_name>` is the location of the `data` folder that will contain the generated dataset (default to `./`).
## Usage
For a more complete documentation on all the classes and functions, please refer to the **Documentation** page (link in the section below) and [here](https://readthedocs.org/projects/ccsd/).
### General
To use CCSD, follow the steps outlined below:
**Edit your general configurations:**
Edit the file `config\general_config.py` to provide your *wandb* (Weights & Biases) information (if you want to use wandb), your timezone, and some other general parameters.
Edit the `engine` value with the plotly engine you want to use. For Windows users, we recommend `kaleido` (see installation instructions below). For Linux users, we recommend `orca` (see installation instructions below).
**Execute the code:**
You can either use the command line or directly the CCSD class (more information in the subsections below).
**Combinatorial Complexes:**
To generate combinatorial complexes and not graphs, just put the parameter `is_cc` to True in your configuration files, specify the `d_min` and `d_max` parameters of your dataset (see the thesis for more information on that), and pick a ScoreNetwork model for the rank2 score predictions (see example of configurations).
**Figures and output:**
The figures, the graphs, combinatorial complexes, molecules, etc, will all be saved into a `samples` folder, and in the logs folders `logs_sample` and `logs_train`.
The output in the command line should look like below, where a logo is printed, the current experiment information, and then the training/sampling information:
```bash
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP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PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
----------------------------------------------------------------------------------------------------
Current experiment:
type: train
config: qm9
comment:
seed: 42
...
```
### Command line
**Help:**
- Get more information by typing:
```bash
python main.py --help
```
**Train a model:**
- Define your own config or use one from the **config** folder.
- Use the command:
```bash
python main.py --type train --config <config_name>
```
where `<config_name>` should be the name of your configuration file.
- If you want to sample directly after the training of your model, just provide in the configuration file the sampling parameters.
**Sample from a model:**
- Define your own sample config or use one from the **config** folder.
- Use the command:
```bash
python main.py --type sample --config <config_name>
```
where `<config_name>` should be the name of your sampling configuration file.
**Other:**
- Other parameters include:
`--comment COMMENT`: A single line comment for the experiment
`--seed SEED`: Random seed for reproducibility
`--folder FOLDER`: Directory to save the results, load checkpoints, load config, etc
- To provide additional information about the GPU, you can provide the ID(s) of the GPU(s) to use by typing:
```bash
CUDA_VISIBLE_DEVICES=0,1 python main.py --type <type> --config <config_name>
```
if you want to use the GPUs 0 and 1, or to only use the GPU 0:
```bash
CUDA_VISIBLE_DEVICES=0 python main.py --type <type> --config <config_name>
```
### CCSD class
- Run an experiment by adapting the code below:
```python
from ccsd.diffusion import CCSD
params = {
"type": "train",
"config": "qm9_CC",
"folder": "./", # optional
"comment": "test experiment", # optional
"seed": 42 # optional
}
diffusion_model = CCSD(**params) # define the object
diffusion_model.run() # run the experiment
```
- To get more information about the parameters and the other functions availables, you can ask for help by typing:
```python
from ccsd import CCSD
help(CCSD)
```
## Documentation
Here is the link to the documentation of this library: [https://ccsd.readthedocs.io/en/latest/](https://ccsd.readthedocs.io/en/latest/). It contains more information regarding all the classes and functions of this package.
## Commons errors
### Installation of MOSES
If you encounter an error during the installation of MOSES, please follow the steps below:
First, if you are on Windows, make sure you have installed the *C++ Dev kit via Visual Studio 2022 community*.
Then, for all users, install rdkit, Cython, and pomegranate using the commands:
```bash
pip install rdkit
pip install Cython
pip install pomegranate
```
Finally, either install MOSES directly using:
```bash
pip install molsets
```
**Or**, first install lfs by running
```bash
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git-lfs install
```
And then use one of the two options below to install MOSES:
1 - via git
```bash
git lfs install
pip install git+https://github.com/molecularsets/moses.git
```
2 - install it manually (if the previous steps doesn't work):
```bash
git lfs install
git clone https://github.com/molecularsets/moses.git
cd moses
python setup.py install
```
### Package-related errors
The errors related to packages (MOSES, TopoNetX, etc) can be fixed by running the script `apply_fixes.py` located in `.github/workflows/` or by following the steps for each individual packages below:
#### Error due to MOSES
If you get an error related to a `._append` method that no longer exists in Pandas and that is still used in the MOSES package, please replace in the MOSES package the file `utils.py` with the one provided in this repository: **fixes\utils.py**. The MOSES `utils.py` file should be located somewhere like:
`C:\Users\<username>\miniconda3\lib\site-packages\moses\metrics\utils.py` or `miniconda\lib\python3.11\site-packages\molsets-1.0-py3.11.egg\moses\metrics\utils.py`
More precisely the error should look like this:
```bash
_mcf.append(_pains, sort=True)['smarts'].values]
...
AttributeError: 'DataFrame' object has no attribute 'append'
```
The trick is to replace this line (24) by:
```python
pd.concat([_mcf, _pains], sort=True)['smarts'].values]
```
**Remark:** The entire operation can be done through the command line by using sed:
```bash
sed -i "24s/.*/\t\t\tpd.concat([_mcf, _pains], sort=True)[\o047smarts\o047].values]/" <path_to_moses_utils.py>
```
#### Error due to TopoNetX when running the tests
Install an old version of `TopoNetX`, by running for example the command:
```bash
pip install git+https://github.com/pyt-team/TopoNetX.git@a389bd8bb11c731bb98d79da8392e3396ea9db8c
```
Then, replace the file `combinatorial_complex.py` of TopoNetX by the updated one provided in this repository: **fixes\combinatorial_complex.py**
The file in TopoNetX should be located somewhere like:
`C:\Users\<username>\miniconda3\Lib\site-packages\toponetx\classes\combinatorial_complex.py` or `miniconda\lib\python3.11\site-packages\toponetx\classes\combinatorial_complex.py`
## Citation
If you use CCSD in your research or work, please consider citing it using the following BibTeX entry:
```bibtex
Carrel, A. (2023). CCSD - Combinatorial Complex Score-based Diffusion model using stochastic differential equations. (Version 1.0.0) [Computer software]. https://github.com/AdrienC21/CCSD
```
## Acknowledgement
The Laboratory for Computational Physiology (LCP) at the Massachusetts Institute of Technology (MIT) for partially hosting me during the redaction of my thesis.
[Dr. Tolga Birdal](https://www.imperial.ac.uk/people/t.birdal) for his supervision and for the valuable advice and ressources that he provided.
[Dr. Mustafa Hajij](https://www.mustafahajij.com/) and the members of the [pyt-team](https://github.com/pyt-team/) for the package [TopoNetX](https://github.com/pyt-team/TopoNetX) and their work on Combinatorial Complexes and Topological Deep Learning: [Topological Deep Learning: Going Beyond Graph Data](https://arxiv.org/abs/2206.00606).
[Jo, J. & al.](https://harryjo97.github.io/) for their paper [Score-based Generative Modeling of Graphs via the System of Stochastic Differential Equations](https://arxiv.org/abs/2202.02514) that served as a baseline for both the theoretical and empirical part of this work.
All my friends and my family for the support.
Logo created by me using the icon: "topology" icon by VectorsLab from Noun Project CC BY 3.0.
## Changelog
See the [change log](https://github.com/AdrienC21/CCSD/CHANGELOG.rst) for a history of all changes to **CCSD**.
## License
CCSD is licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to use and modify the code as per the terms of the license.
Changelog
==================================
0.3.3 (2023/09/18)
--------------------
- Debug like 0.3.1 (add path to general_config in diffusion.py and main.py)
0.3.2 (2023/09/18)
--------------------
- Debug like 0.3.1
0.3.1 (2023/09/18)
--------------------
- Debug folder structure when calling some functions
- Add example script and notebook
0.3.0 (2023/09/18)
--------------------
- Debugging, additional plots
- More configuration options with more datasets
- New scripts (Tanimoto similarity, plot datasets)
0.2.1 (2023/08/13)
--------------------
- Debug the initial release of the package.
0.2.0 (2023/08/13)
--------------------
- Debug the initial release of the package.
0.1.0 (2023/08/10)
--------------------
- Version 1 of the CCSD Python package.
Raw data
{
"_id": null,
"home_page": "https://ccsd.readthedocs.io/en/latest/",
"name": "ccsd",
"maintainer": "Adrien Carrel",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "a.carrel@hotmail.fr",
"keywords": "ccsd,python,diffusion-models,combinatorial-complex,score-based-generative-models,score-based-generative-modelingtopological-deep-learning,higher-order-models,tdl,molecule,molecule-generation,machine-learning,deep-learning,graph-neural-networks,graph,topology,diffusion,artificial-intelligence,topological-neural-networks,topological-data-analysis",
"author": "Adrien Carrel",
"author_email": "a.carrel@hotmail.fr",
"download_url": "https://files.pythonhosted.org/packages/92/46/d15524ea33b19d10148bbb40ce6483b952785a9622571c737092f04643c7/ccsd-0.3.3.tar.gz",
"platform": null,
"description": "# CCSD - Combinatorial Complex Score-based Diffusion Modelling through Stochastic Differential Equations\r\n\r\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\r\n[![pypi version](https://img.shields.io/pypi/v/ccsd.svg)](https://pypi.python.org/pypi/ccsd)\r\n[![Documentation Status](https://readthedocs.org/projects/ccsd/badge/?version=latest)](https://ccsd.readthedocs.io/en/latest/?badge=latest)\r\n[![visitors](https://visitor-badge.laobi.icu/badge?page_id=AdrienC21.CCSD&right_color=%23FFA500)](https://github.com/AdrienC21/CCSD)\r\n[![Downloads](https://static.pepy.tech/badge/ccsd)](https://pepy.tech/project/ccsd)\r\n[![Python versions](https://img.shields.io/badge/python-3.10%20%7C%203.11-blue)](https://pypi.python.org/pypi/ccsd)\r\n[![Test](https://github.com/AdrienC21/CCSD/actions/workflows/test.yml/badge.svg)](https://github.com/AdrienC21/CCSD/actions/workflows/test.yml)\r\n[![Lint](https://github.com/AdrienC21/CCSD/actions/workflows/lint.yml/badge.svg)](https://github.com/AdrienC21/CCSD/actions/workflows/lint.yml)\r\n[![Codecov](https://codecov.io/gh/AdrienC21/CCSD/branch/main/graph/badge.svg)](https://app.codecov.io/gh/AdrienC21/CCSD)\r\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)\r\n\r\n<p align=\"center\"><img src=\"https://github.com/AdrienC21/CCSD/blob/main/logo.png?raw=true\" alt=\"CCSD_logo\" width=\"600\"/></p>\r\n\r\n**CCSD** is a sophisticated score-based diffusion model designed to generate Combinatorial Complexes using Stochastic Differential Equations. This cutting-edge approach enables the generation of complex objects with higher-order structures and relations, thereby enhancing our ability to learn underlying distributions and produce more realistic objects.\r\n\r\n## Table of Contents\r\n\r\n- [CCSD - Combinatorial Complex Score-based Diffusion Modeling through Stochastic Differential Equations](#ccsd---combinatorial-complex-score-based-diffusion-modeling-through-stochastic-differential-equations)\r\n - [Table of Contents](#table-of-contents)\r\n - [CCSD](#ccsd)\r\n - [Introduction](#introduction)\r\n - [Why CCSD?](#why-ccsd)\r\n - [Author](#author)\r\n - [Contributions](#contributions)\r\n - [Installation](#installation)\r\n - [Using pip](#using-pip)\r\n - [Manually](#manually)\r\n - [Next steps](#next-steps)\r\n - [Plotly engine](#plotly-engine)\r\n - [Dependencies and other packages/libraries](#dependencies-and-other-packageslibraries)\r\n - [Tests and errors](#tests-and-errors)\r\n - [Dependencies](#dependencies)\r\n - [Testing](#testing)\r\n - [Datasets](#datasets)\r\n - [Process molecular datasets](#process-molecular-datasets)\r\n - [Generate generic graphs datasets](#generate-generic-graphs-datasets)\r\n - [Usage](#usage)\r\n - [General](#general)\r\n - [Command line](#command-line)\r\n - [CCSD class](#ccsd-class)\r\n - [Documentation](#documentation)\r\n - [Commons errors](#commons-errors)\r\n - [Installation of MOSES](#installation-of-moses)\r\n - [Package-related errors](#package-related-errors)\r\n - [Error due to MOSES](#error-due-to-moses)\r\n - [Error due to TopoNetX when running the tests](#error-due-to-toponetx-when-running-the-tests)\r\n - [Citation](#citation)\r\n - [Acknowledgement](#acknowledgement)\r\n - [Changelog](#changelog)\r\n - [License](#license)\r\n\r\n## CCSD\r\n\r\n### Introduction\r\n\r\nComplex object generation is a challenging problem with application in various fields such as drug discovery. The CCSD model offers a novel approach to tackle this problem by leveraging Diffusion Models and Stochastic Differential Equations to generate Combinatorial Complexes (CC). This topological structure generalizes the different mathematical stuctures used in Topological/Geometric Deep Learning to represent complex objects with higher-order structures and relations. The integration of the higher-order domain during the generation enhances the learning of the underlying distribution of the data and thus, allows for better data generation.\r\n\r\nIf you find this project interesting, we would appreciate your support by leaving a star \u2b50 on this [GitHub repository](https://github.com/AdrienC21/CCSD).\r\n\r\nCode still in **Alpha version!**\r\n\r\n### Why CCSD?\r\n\r\nCCSD stands out from traditional complex object generation models due to the following key advantages:\r\n\r\n- *Combinatorial Complexes:* The model generates Combinatorial Complexes, enabling the synthesis of complex objects with rich structures and relationships.\r\n\r\n- *Score-Based Diffusion:* CCSD utilizes score-based diffusion techniques, allowing for efficient, high-quality and state-of-the-art complex object generation.\r\n\r\n- *Enhanced \"Realism\":* By incorporating higher-order structures, the generated objects are more representative of the underlying data distribution.\r\n\r\nAlso, this **repository is highly documented and commented**, which makes it easy to use, understand, deploy, and which offers endless possibilities for improvements.\r\n\r\n### Author\r\n\r\nThe research has been conducted by **Adrien Carrel** as part of his requirements for the MSc degree in Advanced Computing of Imperial College London, United Kingdom, and his requirements for the MEng in Applied Mathematics (Dipl\u00f4me d'Ing\u00e9nieur) at CentraleSup\u00e9lec, France.\r\n\r\n<a href=\"https://linkedin.com/in/adrien.carrel/\" target=\"_blank\"><img align=\"center\" src=\"https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/linkedin.svg\" alt=\"linkedin\" height=\"39\" width=\"52\"/></a>\r\n<a href=\"https://www.instagram.com/adrien.carrel\" target=\"_blank\"><img align=\"center\" src=\"https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/instagram.svg\" alt=\"instagram\" height=\"39\" width=\"52\" /></a>\r\n<a href=\"https://github.com/AdrienC21/\" target=\"_blank\"><img align=\"center\" src=\"https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/github.svg\" alt=\"github\" height=\"39\" width=\"52\" /></a>\r\n\r\nThis project has been **supervised by [Dr. Tolga Birdal](https://www.imperial.ac.uk/people/t.birdal)**, Assistant Professor (Lecturer) in the Department of Computing of Imperial College London.\r\n\r\n### Contributions\r\n\r\nWe welcome new contributors with various background and programming levels who would like to contribute to the fields of diffusion models and topological deep learning. Feel free to suggest new ideas, submit pull requests, etc.\r\n\r\nFeel free to check our [Code of Conduct](https://github.com/AdrienC21/CCSD/CODE_OF_CONDUCT.md) if you wish to contribute.\r\n\r\n## Installation\r\n\r\nIf you encounter an error during the installation, please refer to the section **Commons errors** below. If you are creating an Ubuntu instance on a Public Cloud service to train/sample from the model, you may want to use the `post_installation_script.sh` script provided to automate the process (just modify the **Git configurations** section inside the script with your details).\r\n\r\n### Using pip\r\n\r\nTo get started with CCSD, you can install the package using pip by typing the command:\r\n\r\n```bash\r\npip install ccsd\r\n```\r\n\r\n### Manually\r\n\r\nIf you encounter, if you want to use the latest version, or if you prefer the command line interface, you can use it locally by cloning or forking this repository to your local machine.\r\n\r\n```bash\r\ngit clone https://github.com/AdrienC21/CCSD.git\r\n```\r\n\r\n### Next steps\r\n\r\n#### Plotly engine\r\n\r\nFor Windows users, the recommended version of kaleido is *0.1.0.post1*. You can install it by typing:\r\n\r\n```bash\r\npip install kaleido==0.1.0post1\r\n```\r\n\r\nFor Linux users, the latest version of kaleido seems fine. For those who want to use `orca`, you can install it via the *npm* command of *Node.js*. For the installation, type:\r\n\r\n```bash\r\nsudo NEEDRESTART_MODE=a apt install -y nodejs\r\nsudo NEEDRESTART_MODE=a apt install -y npm\r\nnpm install -g electron@6.1.4 orca\r\n```\r\n\r\n#### Dependencies and other packages/libraries\r\n\r\nInstall the dependencies (see the section **Dependencies** below).\r\n\r\nWhen installing PyTorch and its componenents, or when install TopoModelX along with TopoNetX, run the commands below:\r\n\r\n```bash\r\npip install torch==2.0.1 --extra-index-url https://download.pytorch.org/whl/${CUDA}\r\npip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.0.1+${CUDA}.html\r\n```\r\n\r\nwhere ${CUDA} could be `cu117`, `cu118`, or `cpu` if you want to use the CPU. For GPU, we recommend `cu118`. Also, TopoModelX should be installed after TopoNetX to avoid versioning issues.\r\n\r\nIf you are using a **Linux** system, you may need to install libxrender1 by typing:\r\n\r\n```bash\r\nsudo apt-get install libxrender1\r\n```\r\n\r\n#### Tests and errors\r\n\r\nTo test your installation, refer to the section **Testing** below.\r\n\r\nIf you encounter an error, please refer to the section **Commons errors** below.\r\n\r\n## Dependencies\r\n\r\nCCSD requires a recent version of Python, probably 3.7, but preferably **3.10 or higher**.\r\n\r\nIt also requires the following dependencies:\r\n\r\n- dill>=0.3.6\r\n- easydict>=1.10\r\n- freezegun>=1.2.2\r\n- hypernetx>=1.2.5\r\n- imageio>=2.31.1\r\n- joblib>=1.3.1\r\n- kaleido>=0.1.0.post1\r\n- matplotlib>=3.7.2\r\n- networkx>=2.8.8\r\n- numpy>=1.24.4\r\n- pandas>=2.0.3\r\n- plotly>=5.15.0\r\n- pyemd>=1.0.0\r\n- pytest>=7.4.0\r\n- pytz>=2023.3\r\n- pyyaml>=6.0\r\n- rdkit>=2023.3.2\r\n- scikit_learn>=1.3.0\r\n- scipy>=1.11.1\r\n- Cython\r\n- pomegranate\r\n- toponetx\r\n- torch>=2.0.1\r\n- tqdm>=4.65.0\r\n- molsets>=0.3.1\r\n- pytest-cov\r\n- wandb\r\n- pandas>=2.0.3\r\n\r\nPlease make sure you have the required dependencies installed before using CCSD.\r\n\r\nYou can install all of them by running the command:\r\n\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\n## Testing\r\n\r\nTo ensure the correctness and robustness of CCSD and to allow researchers to build upon this tool, we have provided an extensive test suite. To run the tests, clone the repository, change your directory to the root folder of this project and execute the following command:\r\n\r\n```bash\r\npytest tests/ -W ignore::DeprecationWarning\r\n```\r\n\r\nIf you encounter an error during the testing, please refer to the section **Commons errors** below.\r\n\r\nThe output should look like this:\r\n\r\n```bash\r\n==================================================== test session starts ====================================================\r\n\r\n...\r\n\r\ntests\\utils\\test_mol_utils.py .................. [ 98%]\r\ntests\\utils\\test_time_utils.py .. [100%]\r\n\r\n============================================== 128 passed in 70.03s (0:01:10) =============================================== \r\n```\r\n\r\n## Datasets\r\n\r\nFor more information about the script below and their arguments, you can type:\r\n\r\n```bash\r\npython <script_path> --help\r\n```\r\n\r\n### Process molecular datasets\r\n\r\nIf you want to use molecular datasets such as QM9 or ZINC250k, you first need to run the two following commands:\r\n\r\n```bash\r\npython ccsd/data/preprocess.py --dataset <dataset_name> --folder <folder_name>\r\npython ccsd/data/preprocess_for_nspdk.py --dataset <dataset_name> --folder <folder_name>\r\n```\r\n\r\n`<dataset_name>` has to be chosen from this list: `[\"QM9\", \"ZINC250k\"]`. `<folder_name>` is the location of the `data` folder that contains the datasets (default to `./`).\r\n\r\n### Generate generic graphs datasets\r\n\r\nIf you want to generate generic graphs datasets, you can run the following command:\r\n\r\n```bash\r\npython ccsd/data/data_generators.py --dataset <dataset_name> --folder <folder_name>\r\n```\r\n\r\n`<dataset_name>` has to be chosen from this list: `[\"community_small\", \"grid\", \"ego_small\", \"ENZYMES\"]`. `<folder_name>` is the location of the `data` folder that will contain the generated dataset (default to `./`).\r\n\r\n## Usage\r\n\r\nFor a more complete documentation on all the classes and functions, please refer to the **Documentation** page (link in the section below) and [here](https://readthedocs.org/projects/ccsd/).\r\n\r\n### General\r\n\r\nTo use CCSD, follow the steps outlined below:\r\n\r\n**Edit your general configurations:**\r\n\r\nEdit the file `config\\general_config.py` to provide your *wandb* (Weights & Biases) information (if you want to use wandb), your timezone, and some other general parameters.\r\n\r\nEdit the `engine` value with the plotly engine you want to use. For Windows users, we recommend `kaleido` (see installation instructions below). For Linux users, we recommend `orca` (see installation instructions below).\r\n\r\n**Execute the code:**\r\n\r\nYou can either use the command line or directly the CCSD class (more information in the subsections below).\r\n\r\n**Combinatorial Complexes:**\r\n\r\nTo generate combinatorial complexes and not graphs, just put the parameter `is_cc` to True in your configuration files, specify the `d_min` and `d_max` parameters of your dataset (see the thesis for more information on that), and pick a ScoreNetwork model for the rank2 score predictions (see example of configurations).\r\n\r\n**Figures and output:**\r\n\r\nThe figures, the graphs, combinatorial complexes, molecules, etc, will all be saved into a `samples` folder, and in the logs folders `logs_sample` and `logs_train`.\r\n\r\nThe output in the command line should look like below, where a logo is printed, the current experiment information, and then the training/sampling information:\r\n\r\n```bash\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP5JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJYPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP? 7PPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPP5YY5PPPPPPPPPP5YY5PPPPPPPPPPPPPPPPPP? .^!7?????7!^. 7PPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPP5^. ~JYYY55557^....^?PPPPPPPPPPPPPPPP? :!J5PPPPPPPPPPP5J!. 7PPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPP? :^ ~^ ~PPPPPPPPPPPPPPP? .?5PPPPPPPPPPPPPPPPP5! 7PPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPP?^:^?J??777?.. .:5PPPPPPPPPPPPPP? ^5PPPPPP5?~^^~!?5PPPY!: 7PPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPG5^:^. ^: :75PPPPPPPPPPPP? :5PPPPPP7. .7!: 7PPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPP5!. !?^^~JJ~ .^!^^^~75PPPPP? 7PPPPPPJ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PPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP | | | | \\___ \\| | | | PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP | |___| |____ ____) | |__| | PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP \\_____\\_____|_____/|_____/ PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\r\n----------------------------------------------------------------------------------------------------\r\nCurrent experiment:\r\n\r\n type: train\r\n config: qm9\r\n comment: \r\n seed: 42\r\n\r\n...\r\n```\r\n\r\n### Command line\r\n\r\n**Help:**\r\n\r\n- Get more information by typing:\r\n\r\n```bash\r\npython main.py --help\r\n```\r\n\r\n**Train a model:**\r\n\r\n- Define your own config or use one from the **config** folder.\r\n\r\n- Use the command:\r\n\r\n```bash\r\npython main.py --type train --config <config_name>\r\n```\r\n\r\nwhere `<config_name>` should be the name of your configuration file.\r\n\r\n- If you want to sample directly after the training of your model, just provide in the configuration file the sampling parameters.\r\n\r\n**Sample from a model:**\r\n\r\n- Define your own sample config or use one from the **config** folder.\r\n\r\n- Use the command:\r\n\r\n```bash\r\npython main.py --type sample --config <config_name>\r\n```\r\n\r\nwhere `<config_name>` should be the name of your sampling configuration file.\r\n\r\n**Other:**\r\n\r\n- Other parameters include:\r\n\r\n`--comment COMMENT`: A single line comment for the experiment\r\n\r\n`--seed SEED`: Random seed for reproducibility\r\n\r\n`--folder FOLDER`: Directory to save the results, load checkpoints, load config, etc\r\n\r\n- To provide additional information about the GPU, you can provide the ID(s) of the GPU(s) to use by typing:\r\n\r\n```bash\r\nCUDA_VISIBLE_DEVICES=0,1 python main.py --type <type> --config <config_name>\r\n```\r\n\r\nif you want to use the GPUs 0 and 1, or to only use the GPU 0:\r\n\r\n```bash\r\nCUDA_VISIBLE_DEVICES=0 python main.py --type <type> --config <config_name>\r\n```\r\n\r\n### CCSD class\r\n\r\n- Run an experiment by adapting the code below:\r\n\r\n```python\r\nfrom ccsd.diffusion import CCSD\r\n\r\n\r\nparams = {\r\n \"type\": \"train\",\r\n \"config\": \"qm9_CC\",\r\n \"folder\": \"./\", # optional\r\n \"comment\": \"test experiment\", # optional\r\n \"seed\": 42 # optional\r\n}\r\ndiffusion_model = CCSD(**params) # define the object\r\ndiffusion_model.run() # run the experiment\r\n```\r\n\r\n- To get more information about the parameters and the other functions availables, you can ask for help by typing:\r\n\r\n```python\r\nfrom ccsd import CCSD\r\n\r\nhelp(CCSD)\r\n```\r\n\r\n## Documentation\r\n\r\nHere is the link to the documentation of this library: [https://ccsd.readthedocs.io/en/latest/](https://ccsd.readthedocs.io/en/latest/). It contains more information regarding all the classes and functions of this package.\r\n\r\n## Commons errors\r\n\r\n### Installation of MOSES\r\n\r\nIf you encounter an error during the installation of MOSES, please follow the steps below:\r\n\r\nFirst, if you are on Windows, make sure you have installed the *C++ Dev kit via Visual Studio 2022 community*.\r\n\r\nThen, for all users, install rdkit, Cython, and pomegranate using the commands:\r\n\r\n```bash\r\npip install rdkit\r\npip install Cython\r\npip install pomegranate\r\n```\r\n\r\nFinally, either install MOSES directly using:\r\n\r\n```bash\r\npip install molsets\r\n```\r\n\r\n**Or**, first install lfs by running\r\n\r\n```bash\r\ncurl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash\r\nsudo apt-get install git-lfs\r\ngit-lfs install\r\n```\r\n\r\nAnd then use one of the two options below to install MOSES:\r\n\r\n1 - via git\r\n\r\n```bash\r\ngit lfs install\r\npip install git+https://github.com/molecularsets/moses.git\r\n```\r\n\r\n2 - install it manually (if the previous steps doesn't work):\r\n\r\n```bash\r\ngit lfs install\r\ngit clone https://github.com/molecularsets/moses.git\r\ncd moses\r\npython setup.py install\r\n```\r\n\r\n### Package-related errors\r\n\r\nThe errors related to packages (MOSES, TopoNetX, etc) can be fixed by running the script `apply_fixes.py` located in `.github/workflows/` or by following the steps for each individual packages below:\r\n\r\n#### Error due to MOSES\r\n\r\nIf you get an error related to a `._append` method that no longer exists in Pandas and that is still used in the MOSES package, please replace in the MOSES package the file `utils.py` with the one provided in this repository: **fixes\\utils.py**. The MOSES `utils.py` file should be located somewhere like:\r\n\r\n`C:\\Users\\<username>\\miniconda3\\lib\\site-packages\\moses\\metrics\\utils.py` or `miniconda\\lib\\python3.11\\site-packages\\molsets-1.0-py3.11.egg\\moses\\metrics\\utils.py`\r\n\r\nMore precisely the error should look like this:\r\n\r\n```bash\r\n_mcf.append(_pains, sort=True)['smarts'].values]\r\n...\r\nAttributeError: 'DataFrame' object has no attribute 'append'\r\n```\r\n\r\nThe trick is to replace this line (24) by:\r\n\r\n```python\r\n pd.concat([_mcf, _pains], sort=True)['smarts'].values]\r\n```\r\n\r\n**Remark:** The entire operation can be done through the command line by using sed:\r\n\r\n```bash\r\nsed -i \"24s/.*/\\t\\t\\tpd.concat([_mcf, _pains], sort=True)[\\o047smarts\\o047].values]/\" <path_to_moses_utils.py>\r\n```\r\n\r\n#### Error due to TopoNetX when running the tests\r\n\r\nInstall an old version of `TopoNetX`, by running for example the command:\r\n\r\n```bash\r\npip install git+https://github.com/pyt-team/TopoNetX.git@a389bd8bb11c731bb98d79da8392e3396ea9db8c\r\n```\r\n\r\nThen, replace the file `combinatorial_complex.py` of TopoNetX by the updated one provided in this repository: **fixes\\combinatorial_complex.py**\r\n\r\nThe file in TopoNetX should be located somewhere like:\r\n\r\n`C:\\Users\\<username>\\miniconda3\\Lib\\site-packages\\toponetx\\classes\\combinatorial_complex.py` or `miniconda\\lib\\python3.11\\site-packages\\toponetx\\classes\\combinatorial_complex.py`\r\n\r\n## Citation\r\n\r\nIf you use CCSD in your research or work, please consider citing it using the following BibTeX entry:\r\n\r\n```bibtex\r\nCarrel, A. (2023). CCSD - Combinatorial Complex Score-based Diffusion model using stochastic differential equations. (Version 1.0.0) [Computer software]. https://github.com/AdrienC21/CCSD\r\n```\r\n\r\n## Acknowledgement\r\n\r\nThe Laboratory for Computational Physiology (LCP) at the Massachusetts Institute of Technology (MIT) for partially hosting me during the redaction of my thesis.\r\n\r\n[Dr. Tolga Birdal](https://www.imperial.ac.uk/people/t.birdal) for his supervision and for the valuable advice and ressources that he provided.\r\n\r\n[Dr. Mustafa Hajij](https://www.mustafahajij.com/) and the members of the [pyt-team](https://github.com/pyt-team/) for the package [TopoNetX](https://github.com/pyt-team/TopoNetX) and their work on Combinatorial Complexes and Topological Deep Learning: [Topological Deep Learning: Going Beyond Graph Data](https://arxiv.org/abs/2206.00606).\r\n\r\n[Jo, J. & al.](https://harryjo97.github.io/) for their paper [Score-based Generative Modeling of Graphs via the System of Stochastic Differential Equations](https://arxiv.org/abs/2202.02514) that served as a baseline for both the theoretical and empirical part of this work.\r\n\r\nAll my friends and my family for the support.\r\n\r\nLogo created by me using the icon: \"topology\" icon by VectorsLab from Noun Project CC BY 3.0.\r\n\r\n## Changelog\r\n\r\nSee the [change log](https://github.com/AdrienC21/CCSD/CHANGELOG.rst) for a history of all changes to **CCSD**.\r\n\r\n## License\r\n\r\nCCSD is licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to use and modify the code as per the terms of the license.\r\n\r\n\r\nChangelog\r\n==================================\r\n\r\n0.3.3 (2023/09/18)\r\n--------------------\r\n\r\n- Debug like 0.3.1 (add path to general_config in diffusion.py and main.py)\r\n\r\n0.3.2 (2023/09/18)\r\n--------------------\r\n\r\n- Debug like 0.3.1\r\n\r\n0.3.1 (2023/09/18)\r\n--------------------\r\n\r\n- Debug folder structure when calling some functions\r\n\r\n- Add example script and notebook\r\n\r\n0.3.0 (2023/09/18)\r\n--------------------\r\n\r\n- Debugging, additional plots\r\n\r\n- More configuration options with more datasets\r\n\r\n- New scripts (Tanimoto similarity, plot datasets)\r\n\r\n0.2.1 (2023/08/13)\r\n--------------------\r\n\r\n- Debug the initial release of the package.\r\n\r\n0.2.0 (2023/08/13)\r\n--------------------\r\n\r\n- Debug the initial release of the package.\r\n\r\n0.1.0 (2023/08/10)\r\n--------------------\r\n\r\n- Version 1 of the CCSD Python package.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CCSD (Combinatorial Complex Score-based Diffusion) is a sophisticated score-based diffusion model designed to generate Combinatorial Complexes using Stochastic Differential Equations. This cutting-edge approach enables the generation of complex objects with higher-order structures and relations, thereby enhancing our ability to learn underlying distributions and produce more realistic objects.",
"version": "0.3.3",
"project_urls": {
"Bug Tracker": "https://github.com/AdrienC21/CCSD/issues",
"Documentation": "https://ccsd.readthedocs.io/en/latest/",
"Download": "https://pypi.org/project/ccsd/",
"Homepage": "https://ccsd.readthedocs.io/en/latest/",
"Source Code": "https://github.com/AdrienC21/CCSD"
},
"split_keywords": [
"ccsd",
"python",
"diffusion-models",
"combinatorial-complex",
"score-based-generative-models",
"score-based-generative-modelingtopological-deep-learning",
"higher-order-models",
"tdl",
"molecule",
"molecule-generation",
"machine-learning",
"deep-learning",
"graph-neural-networks",
"graph",
"topology",
"diffusion",
"artificial-intelligence",
"topological-neural-networks",
"topological-data-analysis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c505aaa9482e510f3b352b001ade2549ccfe5513cae669e56feea59519d2db99",
"md5": "54a063ac1fa5261827852d4efb0e00d9",
"sha256": "10a4af06a8fc7374695e278fa11f780969e950584c250925ac5e7bfe986bca58"
},
"downloads": -1,
"filename": "ccsd-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54a063ac1fa5261827852d4efb0e00d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 138045,
"upload_time": "2023-09-18T09:25:11",
"upload_time_iso_8601": "2023-09-18T09:25:11.887321Z",
"url": "https://files.pythonhosted.org/packages/c5/05/aaa9482e510f3b352b001ade2549ccfe5513cae669e56feea59519d2db99/ccsd-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9246d15524ea33b19d10148bbb40ce6483b952785a9622571c737092f04643c7",
"md5": "525f67a71d3dd17b515da93cf3b9d77c",
"sha256": "4a84fb42b2d770aede5bc0f50bdf8c6f44ac870ff231b4b9017291f3369334c3"
},
"downloads": -1,
"filename": "ccsd-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "525f67a71d3dd17b515da93cf3b9d77c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 103246654,
"upload_time": "2023-09-18T09:25:22",
"upload_time_iso_8601": "2023-09-18T09:25:22.092839Z",
"url": "https://files.pythonhosted.org/packages/92/46/d15524ea33b19d10148bbb40ce6483b952785a9622571c737092f04643c7/ccsd-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-18 09:25:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AdrienC21",
"github_project": "CCSD",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "ccsd"
}