Skip to content

Commit

Permalink
Split ferritin-featurizes into amplify and ligandmpnn (#65)
Browse files Browse the repository at this point in the history
* refactored Amplify and Ligandmpnn

* fix imports and tests
  • Loading branch information
zachcp authored Dec 4, 2024
1 parent baf17e6 commit a2e3637
Show file tree
Hide file tree
Showing 46 changed files with 182 additions and 300 deletions.
64 changes: 40 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ members = [
"ferritin-bevy",
"ferritin-cellscape",
"ferritin-core",
"ferritin-featurizers",
"ferritin-amplify",
"ferritin-ligandmpnn",
"ferritin-molviewspec",
"ferritin-pymol",
"ferritin-test-data",
Expand Down
8 changes: 6 additions & 2 deletions docs/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Native Rust access to pymol `pse` binary files. [rust-docs](https://zachcp.gith

Utilities for consuming and creating [molviewspec files](https://molstar.org/mol-view-spec/). [rust-docs](https://zachcp.github.io/ferritin/doc/ferritin_molviewspec/index.html). [source](https://github.com/zachcp/ferritin/tree/main/ferritin-molviewspec).

### Ferritin-Featurizer
### Ferritin-Amplify

Utilities for converting proteins into tensors. [rust-docs](https://zachcp.github.io/ferritin/doc/ferritin_featurizers/index.html). [source](https://github.com/zachcp/ferritin/tree/main/ferritin-featurizers).
Inference using amplify. [rust-docs](https://zachcp.github.io/ferritin/doc/ferritin_amplify/index.html). [source](https://github.com/zachcp/ferritin/tree/main/ferritin-amplify).

### Ferritin-LigandMPNN

Inference using proteinmpnn/ligandmpnn. [rust-docs](https://zachcp.github.io/ferritin/doc/ferritin_ligandmpnn/index.html). [source](https://github.com/zachcp/ferritin/tree/main/ferritin-ligandmpnn).
File renamed without changes.
33 changes: 33 additions & 0 deletions ferritin-amplify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "ferritin-amplify"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
description.workspace = true

[features]
metal = ["candle-core/metal", "candle-nn/metal", "candle-metal-kernels"]

[dependencies]
anyhow.workspace = true
candle-core = { git = "https://github.com/huggingface/candle.git", package = "candle-core", features = [
] }
candle-hf-hub = "0.3.3"
candle-nn = { git = "https://github.com/huggingface/candle.git", package = "candle-nn" }
ferritin-test-data = { path = "../ferritin-test-data" }
rand = "0.8.5"
safetensors = "0.4.5"
tokenizers = "0.21.0"

[target.'cfg(target_os = "macos")'.features]
metal = []

[target.'cfg(target_os = "macos")'.dependencies]
candle-metal-kernels = { git = "https://github.com/huggingface/candle.git", package = "candle-metal-kernels", optional = true }

[dev-dependencies]
candle-examples = { git = "https://github.com/huggingface/candle.git", package = "candle-examples" }
ferritin-test-data = { path = "../ferritin-test-data" }
assert_cmd = "2.0.16"
tempfile = "3.14.0"
8 changes: 8 additions & 0 deletions ferritin-amplify/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ferritin-amplify

- use the AMPLIFY_120M model from Candle


```shell
just amplify
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```sh
RUST_BACKTRACE=1 cargo run --example amplify
cargo test -p ferritin-featurizers test_amplify_round_trip -- --nocapture
cargo test -p ferritin-amplify test_amplify_round_trip -- --nocapture
```

## Model Tensors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use candle_core::{DType, Device, D};
use candle_hf_hub::{api::sync::Api, Repo, RepoType};
use candle_nn::VarBuilder;
use ferritin_featurizers::{AMPLIFYConfig, ProteinTokenizer, AMPLIFY};
use ferritin_amplify::{AMPLIFYConfig, ProteinTokenizer, AMPLIFY};
use safetensors::SafeTensors;

fn main() -> Result<()> {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions ferritin-amplify/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! ferritin-amplify
//! - [amplify model](https://github.com/chandar-lab/AMPLIFY)
//! - [amplify hf - 120M](https://huggingface.co/chandar-lab/AMPLIFY_120M)
//!
mod amplify;
pub use amplify::amplify::{AMPLIFYConfig, ModelOutput, AMPLIFY};
pub use amplify::tokenizer::ProteinTokenizer;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use candle_core::utils::{cuda_is_available, metal_is_available};
use candle_core::{Device, D};
use ferritin_featurizers::AMPLIFY;
use ferritin_amplify::AMPLIFY;

pub fn device(cpu: bool) -> Result<Device> {
if cpu {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use candle_hf_hub::{api::sync::Api, Repo, RepoType};
use ferritin_featurizers::ProteinTokenizer;
use ferritin_amplify::ProteinTokenizer;

#[test]
#[ignore]
Expand Down
2 changes: 1 addition & 1 deletion ferritin-cellscape/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ description.workspace = true
[dependencies]
ferritin-core = { path = "../ferritin-core" }
pdbtbx = { workspace = true }
geo = "0.29.2"
geo = "0.29.3"
svg = "0.18.0"
17 changes: 0 additions & 17 deletions ferritin-featurizers/src/lib.rs

This file was deleted.

5 changes: 0 additions & 5 deletions ferritin-featurizers/src/models/ligandmpnn/mod.rs

This file was deleted.

Loading

0 comments on commit a2e3637

Please sign in to comment.