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.69-cp312-cp312-win_amd64.whl (134.4 kB view details)

Uploaded CPython 3.12Windows x86-64

chytorch_synplan-1.69-cp312-cp312-win32.whl (122.8 kB view details)

Uploaded CPython 3.12Windows x86

chytorch_synplan-1.69-cp312-cp312-manylinux_2_17_x86_64.whl (701.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

chytorch_synplan-1.69-cp312-cp312-macosx_14_0_arm64.whl (215.0 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

chytorch_synplan-1.69-cp311-cp311-win_amd64.whl (133.9 kB view details)

Uploaded CPython 3.11Windows x86-64

chytorch_synplan-1.69-cp311-cp311-win32.whl (122.8 kB view details)

Uploaded CPython 3.11Windows x86

chytorch_synplan-1.69-cp311-cp311-manylinux_2_17_x86_64.whl (704.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

chytorch_synplan-1.69-cp311-cp311-macosx_14_0_arm64.whl (213.9 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

chytorch_synplan-1.69-cp310-cp310-win_amd64.whl (134.1 kB view details)

Uploaded CPython 3.10Windows x86-64

chytorch_synplan-1.69-cp310-cp310-win32.whl (123.2 kB view details)

Uploaded CPython 3.10Windows x86

chytorch_synplan-1.69-cp310-cp310-manylinux_2_17_x86_64.whl (675.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

chytorch_synplan-1.69-cp310-cp310-macosx_14_0_arm64.whl (213.5 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 50c5944eb8d910af34b20e812898b90d85565c159a657cb980065f1cf616bfad
MD5 fe749b1fad808c6225de2ad9298ebaba
BLAKE2b-256 a5e25acff2de74068a4a2c24fd00794b2c526fc7f2d43c6b8630e0b97f555546

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 4f9b155a75ca91eb16a2c0a4cbcdda9edc4e6d3f860aa6404ebaad72ee1ed15b
MD5 eb71b1460d8074cfa99462d12f8286ad
BLAKE2b-256 42fa4cecb37c1d15accf1562ebcc27d21c898b3137d2e120208b06fabea5701d

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.69-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 65a42a58d7a8cd25b9d40777f4c53991a373db88410a28a2d59e9e52f67653a2
MD5 84769bb8681ef777ef13e356d670723c
BLAKE2b-256 e6800ded1bfebb7ffaf43833edc61aa6905d40ae732d6794ed45c78497f29d8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 cfb07b01031080e99e5278fc1ff31ef79603afb8b8fc3c1c1793d741a9d59e02
MD5 744105bf1c30d0db45951437bbc9a862
BLAKE2b-256 4aa668718d3fcab037616be8cf52794e679ba5dda45cd4fed6a5331a034c10aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 696a1d79ead22054294c98f723c12b6b3e1842f1d7797c8cf78ddb67fb9922bf
MD5 26c488ba23780e5e8dd4ea064e0618ce
BLAKE2b-256 b09b2b4c72c328947cf9e159e2844f0947169628a1d0ae256cf1904d3a02f10d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 1fc0d175322fa81711e568be4842ce0c4b6175db7bd80514d24916f9f75c8f6b
MD5 bc859aadf8dd1a87e30fb3b1ab9bf0a0
BLAKE2b-256 db7020256d638841cfed208dcbb8e1e1c73b938013e069150eb94421d3331b4a

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.69-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6473399479cca16433e583aa37199627b45ec3b36a36d3af1626c6648cd8dbdf
MD5 77b12847c61d1903d35cb968bcb85777
BLAKE2b-256 71f393f1d91a6bfc7d26f65991aec9426bb9239b0c4db6edb97a4661569b55d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9c03d221a21031e749895e07af7714d7a8c9e6f3a20337000acd452174736e05
MD5 7f63f685cbc859ab45a90059b98f959e
BLAKE2b-256 756a24e4514b8ffb8feb12b98b558c77768f2022a5bc66acf25ea659658de3c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 374613858f39ac15c59c59170a14e4a0139e6abd3c902d8a4c1ea53f5f61dab6
MD5 c4be50d1888ba8cebe9f995792af95c0
BLAKE2b-256 4027898c78ae624cb5e799dae02ce9c95624db60e77f8d4e5e0d083701180c00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 63d150971b88ee8bffa0b4d6a1517fbf19ffae92afc9c558fe39ca16660fd0c9
MD5 7601d90f75beb16d2aeec3cc1c072af5
BLAKE2b-256 a03b9614299f41b01d8b1c5bb6e4c19b31273585fa79abcd7315e3c24ced8eb2

See more details on using hashes here.

File details

Details for the file chytorch_synplan-1.69-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c5bc34e2ca45df5dcac408a6f40b09e510d4155cd006b7de37de3c25723fac61
MD5 619ff0301130315733a31ee2a616fa59
BLAKE2b-256 fbf50a156a2a2878b151ec994692caec1a979a6211d69b2d1d9f2ddcde12b25e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chytorch_synplan-1.69-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 db07f694072a91d0ce6568a4b4612f38a6da763405137c8e26b35ef9132a751d
MD5 6213b641af4f1a208b71d652f673c9b4
BLAKE2b-256 51c08970ebfa956565d5ee844766d7b2bd6e0d6aacfcd93b13bcaba39e564358

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