Skip to main content

Library for modeling molecules and reactions in torch way

Project description

Chytorch [kʌɪtɔːrtʃ]

Library for modeling molecules and reactions in torch way.

Installation

Use pip install chytorch to install release version.

Or pip install . in source code directory to install DEV version.

Pretrained models

Chytorch main package doesn't include models zoo. Each model has its own named package and can be installed separately. Installed models can be imported as from chytorch.zoo.<model_name> import Model.

Usage

chytorch.nn.MoleculeEncoder - core graphormer layer for molecules encoding. API is combination of torch.nn.TransformerEncoderLayer with torch.nn.TransformerEncoder.

Batch preparation:

chytorch.utils.data.MoleculeDataset - Map-like on-the-fly dataset generators for molecules. Supported chython.MoleculeContainer objects, and PaCh structures.

chytorch.utils.data.collate_molecules - collate function for torch.utils.data.DataLoader.

Note: torch DataLoader automatically do proper collation since 1.13 release.

Example:

from chytorch.utils.data import MoleculeDataset, SMILESDataset
from torch.utils.data import DataLoader

data = ['CCO', 'CC=O']
ds = MoleculeDataset(SMILESDataset(data, cache={}))
dl = DataLoader(ds, batch_size=10)

Forward call:

Molecules coded as tensors of:

  • atoms numbers shifted by 2 (e.g. hydrogen = 3). 0 - reserved for padding, 1 - reserved for CLS token, 2 - extra reservation.

  • neighbors count, including implicit hydrogens shifted by 2 (e.g. CO = CH3OH = [6, 4]). 0 - reserved for padding, 1 - extra reservation, 2 - no-neighbors, 3 - one neighbor.

  • topological distances' matrix shifted by 2 with upper limit. 0 - reserved for padding, 1 - reserved for not-connected graph components coding, 2 - self-loop, 3 - connected atoms.

    from chytorch.nn import MoleculeEncoder

    encoder = MoleculeEncoder() for b in dl: encoder(b)

Combine molecules and labels:

chytorch.utils.data.chained_collate - helper for combining different data parts. Useful for tricky input.

from torch import stack
from torch.utils.data import DataLoader, TensorDataset
from chytorch.utils.data import chained_collate, collate_molecules, MoleculeDataset

dl = DataLoader(TensorDataset(MoleculeDataset(molecules_list), properties_tensor),
    collate_fn=chained_collate(collate_molecules, stack))

Voting NN with single hidden layer:

chytorch.nn.VotingClassifier, chytorch.nn.BinaryVotingClassifier and chytorch.nn.VotingRegressor - speed optimized multiple heads for ensemble predictions.

Helper Modules:

chytorch.nn.Slicer - do tensor slicing. Useful for transformer's CLS token extraction in torch.nn.Sequence.

Data Wrappers:

In chytorch.utils.data module stored different data wrappers for simplifying ML workflows. All wrappers have torch.utils.data.Dataset interface.

  • SizedList - list wrapper with size() method. Useful with torch.utils.data.TensorDataset.
  • SMILESDataset - on-the-fly smiles to chython.MoleculeContainer or chython.ReactionContainer parser.
  • LMDBMapper - LMDB KV storage to dataset mapper.
  • TensorUnpack, StructUnpack, PickleUnpack - bytes to tensor/object unpackers

Publications

1 Bidirectional Graphormer for Reactivity Understanding: Neural Network Trained to Reaction Atom-to-Atom Mapping Task

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

chytorch_synplan-1.70-cp314-cp314-win_amd64.whl (135.6 kB view details)

Uploaded CPython 3.14Windows x86-64

chytorch_synplan-1.70-cp314-cp314-win32.whl (123.1 kB view details)

Uploaded CPython 3.14Windows x86

chytorch_synplan-1.70-cp314-cp314-manylinux_2_28_x86_64.whl (721.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

chytorch_synplan-1.70-cp314-cp314-macosx_14_0_arm64.whl (206.9 kB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

chytorch_synplan-1.70-cp313-cp313-win_amd64.whl (132.9 kB view details)

Uploaded CPython 3.13Windows x86-64

chytorch_synplan-1.70-cp313-cp313-win32.whl (121.1 kB view details)

Uploaded CPython 3.13Windows x86

chytorch_synplan-1.70-cp313-cp313-manylinux_2_28_x86_64.whl (722.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

chytorch_synplan-1.70-cp313-cp313-macosx_14_0_arm64.whl (206.5 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

chytorch_synplan-1.70-cp312-cp312-win_amd64.whl (133.2 kB view details)

Uploaded CPython 3.12Windows x86-64

chytorch_synplan-1.70-cp312-cp312-win32.whl (121.2 kB view details)

Uploaded CPython 3.12Windows x86

chytorch_synplan-1.70-cp312-cp312-manylinux_2_28_x86_64.whl (725.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

chytorch_synplan-1.70-cp312-cp312-macosx_14_0_arm64.whl (208.1 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

chytorch_synplan-1.70-cp311-cp311-win_amd64.whl (132.4 kB view details)

Uploaded CPython 3.11Windows x86-64

chytorch_synplan-1.70-cp311-cp311-win32.whl (121.0 kB view details)

Uploaded CPython 3.11Windows x86

chytorch_synplan-1.70-cp311-cp311-manylinux_2_28_x86_64.whl (725.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

chytorch_synplan-1.70-cp311-cp311-macosx_14_0_arm64.whl (207.3 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

chytorch_synplan-1.70-cp310-cp310-win_amd64.whl (132.8 kB view details)

Uploaded CPython 3.10Windows x86-64

chytorch_synplan-1.70-cp310-cp310-win32.whl (121.3 kB view details)

Uploaded CPython 3.10Windows x86

chytorch_synplan-1.70-cp310-cp310-manylinux_2_28_x86_64.whl (699.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

chytorch_synplan-1.70-cp310-cp310-macosx_14_0_arm64.whl (208.6 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file chytorch_synplan-1.70-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 5fd4de0a1f64bc0c7f8cac26494461808b0dab17d2c7fb446ec4f9775b38435c
MD5 f601e495dbee37233a64a2715d5c927c
BLAKE2b-256 72f8c462156fa3d783ded70c20875838cd239c4e0d32f13ff22fa5b198b8006c

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp314-cp314-win32.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 6bde75156c8372a646214ca658d0e1d13ae033069febf6db811ad7c54d9fe9e1
MD5 b64fdc8e588930a950e1420b77c5ca0c
BLAKE2b-256 a532dcb2987233b150304b77bde5002329aae119fc0ae1997354545b147e8f33

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9c5f4f36398689d0fcd0b1bc898bc648ee113c47c54d4a757a000f2793392d9
MD5 d92d7555f59ffa502193329d96503244
BLAKE2b-256 76c7fc287e773ae6f3a370302374d81efc512946d340a93940d1590d693b86f1

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 6ca827a788676988dbd2b6b96c89c74cd7272653aa15f221f0e30745a3d797af
MD5 0b851a58ccef18b59471b8893a88b757
BLAKE2b-256 514f8ca4c5f12388cc46ed65f70acceb965da641a6a8c86876a7eab3c72e4c4c

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b2d21d4246ab7e678eb00ab2401fc69481cb48d1120ee6d28100da54d56d7e36
MD5 980736162c79196b2e85343950790824
BLAKE2b-256 06dd998fd021eb3ab38667c2bdf5d3334a4ccbfca468920223b26b8e095ea9b7

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d2748ea8b827010a8df5071840bf0c118a7a2ac87c7d3efd1b4515f6c4f50a41
MD5 ce5599dd473c450e177bbeccb7d4e65b
BLAKE2b-256 f5074ac657631e2bc6552a86d399d0842e95e94985cbf3aeae58e276fb9f595f

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 57c4ad4aeeff99ae268352a8089f6c830349bb3b00af2703eda7f7982ee5f4ea
MD5 ec5d2da97881892cf1d2ed3b4b1c4ed1
BLAKE2b-256 5dc98d7375702707ce3750656dd48cf2cb653d36aabedaa81acea47bd8815d4e

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 84745ab632130536bb0e8e00a87159ddeafde566bf02cebf834bccddf1676230
MD5 51f656e7e12675728940cc0fa72e3e57
BLAKE2b-256 eee794ed47cbfadd7ca948b343309e46b23033422d5d5071eb325b78b467aeaf

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6a5e136d7684d66f9d71db2ddd8ba77cc2e8013e9198518c7591e97cf36024ff
MD5 043192c7b2ab6208d98e65edcf631441
BLAKE2b-256 82e7c8f5140c19c5775a8689a8d6795908acfad6e277a3c469cb4b29cb2b4a0e

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 6230ef7fd0c78fd73b1cfdf51e6907f77ebf2cda725ab642baec71cd9cc45fd3
MD5 dc2238986cd50674058b755d18650edd
BLAKE2b-256 32d0aaefcafdbdadc0f7536ddfeeedc40da534267bb24a33ed28cfd4a146782b

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4a8052892756cdb3674dff3d6cca2b63a1bc0df9c571638b823bbce594a126d6
MD5 0d2b203c42e9931b7dd9d42a4972de64
BLAKE2b-256 d08edbbf61744ed85af2d8ad715fd24b23c60509615dcea82ea57bcb5b03f4c2

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4ee5a415bd7f635689efbd099621e57a6694e05ad8a13d6a7a6895494b2fa90c
MD5 91ee1ea65bd2c9912bd231152047135e
BLAKE2b-256 232068472896b74e63df8fd7ab4704ba7581355dbe41bb1cf8a44db0bb09faf7

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5bf015d03e4a66478b34324f0421dcf8f959f74749f94ff933b0374e268657e8
MD5 80e6eb6458469513783c9eafcdf5f7d7
BLAKE2b-256 33fd7819a21298db0c22318d805dd6f3d57e80c00e8c20ac92b7d3dee72c9d80

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d35567865a39211d54792236dc2049814caf51554ef8474cd12b213998eecc5a
MD5 4ebfcdbc44a70758e181ea9415c9d8d0
BLAKE2b-256 cbe5db9ee76d9854b48b231d3a48b3d1b80cd476384b521e963c49e2eeadf5e3

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0de8be20c453dd6fb14617c3a542c0322a2b192228fd07cb71d5ad4ca60806a4
MD5 325282c3d172eac1cb03170d312742a9
BLAKE2b-256 f70fb443909ec9db98a7c83157c823e7e13b903b898b44807fac7b2aaafdc183

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7aed724851f96c57b9885625ee44044b1af0d21a8853ad4b6eaaec279caab23e
MD5 2fa449a9af26cafc1e5512627d66eed5
BLAKE2b-256 3d403c178e6349ffc839e17f1c4e871afff64d35ecc2311d7197e374ac9b4cb5

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f47aab40ff2a36e9ce6fd2c439c9f420752415d7778d62f7e28b8a7ea467f88a
MD5 bcd74eba507b4e74cba6faf2251db894
BLAKE2b-256 0b01c70e925cc95426edf6975d1ff2bda66468c740767bc5e2ad7884088045bc

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 fb8f3cb79e78e396870b8181299afc2caa92113bd01c157764d46c802422dafe
MD5 b3210104327480e4fcaf37fe6be80c6b
BLAKE2b-256 137cd613d6b7515d418f942e1ec87d2488a0125c99c486d2286e12442616a5e9

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 84586ef7306a4363aa7fe7b7c8920059fda333db2cc61d5d0b5dc6abbd67b9fa
MD5 4f3d50330019cd31a5f54c75f64f8b1d
BLAKE2b-256 7734cf989a3aaf61da4e52b96c5faa84b0641ab0e78e29ee008d5332845767e3

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.70-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.70-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c8c7e9341bdcf4f56f152e182f788d4e1fcde6337d50a65199ff6d534b807af6
MD5 035922314631e685e010bfa9111faa2f
BLAKE2b-256 290af176f2f7e6c89c0bc7a7de76717e19c5b716a4436ab71f76d233dd4f3d95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page