Skip to main content

Digtal Organoid On Chips

Project description

DOoC

Usage

Train

# Regression train
from moltx import tokenizers
from dooc import models, datasets, nets


tk = tokenizers.MoltxTokenizer.from_pretrain(models.AdaMRTokenizerConfig.Prediction)
ds = datasets.MutSmiXAttention(tokenizer=tk, device=torch.device('cpu'))
smiles = ["c1cccc1c", "CC[N+](C)(C)Cc1ccccc1Br"]
mutations = [[1, 0, 0, ...], [1, 0, 1, ...]]
# e.g.
# import random
# [random.choice([0, 1]) for _ in range(3008)]
values = [0.85, 0.78]
smiles_src, smiles_tgt, mutations_src, out = ds(smiles, mutations, values)

model = models.MutSmiXAttention()
model.load_pretrained_ckpt('/path/to/drugcell.ckpt', '/path/to/moltx.ckpt')

crt = nn.MSELoss()

optim.zero_grad()
pred = model(smiles_src, smiles_tgt, mutations_src)
loss = crt(pred, out)
loss.backward()
optim.step()

torch.save(model.state_dict(), '/path/to/mutsmixattention.ckpt')

Inference

from dooc import pipelines, models
# dooc
model = models.MutSmiXAttention()
model.load_ckpt('/path/to/mutsmixattention.ckpt')
pipeline = pipelines.MutSmiXAttention()
pipeline([1, 0, 0, ...], "C=CC=CC=C")
# 0.85

Project details


Download files

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

Source Distribution

dooc-0.0.2.tar.gz (282.3 kB view details)

Uploaded Source

Built Distribution

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

dooc-0.0.2-py3-none-any.whl (287.4 kB view details)

Uploaded Python 3

File details

Details for the file dooc-0.0.2.tar.gz.

File metadata

  • Download URL: dooc-0.0.2.tar.gz
  • Upload date:
  • Size: 282.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for dooc-0.0.2.tar.gz
Algorithm Hash digest
SHA256 40ba254f21396935e3e384eed7f3e6a3e4d4e10c78c8c795340cc6c19d2c0285
MD5 fb8558b27af407a70e63f6360b2706f3
BLAKE2b-256 3922ab489a2776ad7d4a0a31fec64631296a2d9ba3df2adc80a83b237cfcc1f8

See more details on using hashes here.

File details

Details for the file dooc-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: dooc-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 287.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for dooc-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d20ea9ecfcc5af20e684de8ea711c017dc1c006b8a79298b7ddbbd9c45ded65
MD5 eb065df12e44f034ee903c1ed9127bc4
BLAKE2b-256 41a4888e0b9cb580f34b4a7b05b3cc93856a2c5d4265a221456918d53aa482ba

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