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-1.65-cp311-cp311-win_amd64.whl (140.1 kB view details)

Uploaded CPython 3.11Windows x86-64

chytorch-1.65-cp311-cp311-manylinux_2_31_x86_64.whl (559.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ x86-64

chytorch-1.65-cp311-cp311-macosx_14_0_arm64.whl (222.0 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

chytorch-1.65-cp310-cp310-win_amd64.whl (140.0 kB view details)

Uploaded CPython 3.10Windows x86-64

chytorch-1.65-cp310-cp310-manylinux_2_31_x86_64.whl (523.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

chytorch-1.65-cp310-cp310-macosx_14_0_arm64.whl (222.3 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

chytorch-1.65-cp39-cp39-win_amd64.whl (140.5 kB view details)

Uploaded CPython 3.9Windows x86-64

chytorch-1.65-cp39-cp39-manylinux_2_31_x86_64.whl (526.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.31+ x86-64

chytorch-1.65-cp39-cp39-macosx_14_0_arm64.whl (223.4 kB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

chytorch-1.65-cp38-cp38-win_amd64.whl (140.7 kB view details)

Uploaded CPython 3.8Windows x86-64

chytorch-1.65-cp38-cp38-manylinux_2_31_x86_64.whl (540.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.31+ x86-64

chytorch-1.65-cp38-cp38-macosx_14_0_arm64.whl (223.3 kB view details)

Uploaded CPython 3.8macOS 14.0+ ARM64

File details

Details for the file chytorch-1.65-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: chytorch-1.65-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 140.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for chytorch-1.65-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9c54339165c9cb01b4792e1bb319b20419ecc6939c8da8e4bbea9d532fd8b45d
MD5 07604ef9987bf8f3b05117dfc6c4a249
BLAKE2b-256 99e5a6a024ba40fd1c2a6f82cfc16e61250b6c5a04d53792c860f28f41428ce9

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 745b67045e5cc5885db6567d5990864d2e43405fd15464044b6414fccedb76ae
MD5 4f67b3541a096d0819591b8be99e624a
BLAKE2b-256 62ca3698b7a11b38186260ce2555b7b41574384176b13a7e756585404a19ee28

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 546582776d7c9e8be73b03a3e6aa75ca14ec3cbab6bf01ec68c99cf4189d3243
MD5 64e7793054b261d596d004260f234ab0
BLAKE2b-256 fac47dd79b6f13e165972973f40c6423203f9c7af11a27140cd8aaa42ab4c327

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: chytorch-1.65-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 140.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for chytorch-1.65-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2826e302ed15d632c925056fdd1186fe53803f9440cf1bdc2003d3d5e898327e
MD5 396ce4b19d18083d3444349748efba8a
BLAKE2b-256 97afc68e8fbebfb4719a040c074fb10213656f662b7f2ef44eb0970f41a4a7ed

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 4f7748d996f89f63af3bd6cfb9221eee4e69f961d648b0b6f146ab16086d4c81
MD5 d99a2dcf29c8546858d9d271f130d854
BLAKE2b-256 81c6f86fe3858fbba097de2e22c4feb40633a5e809a7dd8275d61c88a96903cb

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 0eea7ddc40bfb9ea1b6437128f2867d9025e37befecf8580754c44acca0b457b
MD5 7358371ad4b6358a5bde2f0aa0e5c2b7
BLAKE2b-256 312c7a307b54eaf829d81d9481bc31e4f160178cc3ab26f5c390e61736eecb5c

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: chytorch-1.65-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 140.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.13

File hashes

Hashes for chytorch-1.65-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 600e9f4d8f77fd9fa60e744b4eb6bd84f289cb6fa6df2aee590b83ab1973ea02
MD5 2eaadca43d36be2d1c404ed18be12fdb
BLAKE2b-256 6ff2ccb58ebd7a491d737d2e9806bf74208881657945587f76880a4f88e38cf0

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp39-cp39-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 27ea7d7b8e1fccea118cbf82c29e30ac0c41a8d33f1174e9ee2fb477f7288d07
MD5 65f00c50bbf258770cf925395366777c
BLAKE2b-256 2a4450a76c4c7a5a61c3c4bd8e8742f9818e2c758dc48d0b2407d2e805f6ddfd

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 cd93d5086a1553c7672979369867c5d11a09c9273771284d700d290390d9c35e
MD5 417d2ad135a204a19a3e777228e49d0b
BLAKE2b-256 329a7de93872a8d732660ae9caa7cc0f277537f70d5a12379d14114de9b6b8ce

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: chytorch-1.65-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 140.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for chytorch-1.65-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 56c30b2a4809e4003ae896bb9bd8821d4ac8ff429f00bf75581a08ca4f21aed1
MD5 f89f99980b90fc585ca89389d64c7f2b
BLAKE2b-256 2bfcae4915f3454fa91d3717cce79711a05f4c0690ec032ada2f2d234f4df64e

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp38-cp38-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 ac8aa0343944eae55c71e9c7ace1d4e39cb3534eb2f23b409e88e7e46bfc07af
MD5 519c12cca16ac80c8c14930baabbd992
BLAKE2b-256 57f9814a5a49f649fbb9c23e6c4f5378f96d9b6372bc499c0963c6869960308f

See more details on using hashes here.

File details

Details for the file chytorch-1.65-cp38-cp38-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for chytorch-1.65-cp38-cp38-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 368e6c241db50077708922eeb528a29d0e20038ff63d5a8b3f47d4ec6a4762d8
MD5 ca96b6899dc4ed6875283abd84ef114c
BLAKE2b-256 dd3d235c813758f84185863f1aa6ba50ecfce99174f5072fbd91f2453f17b7d1

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