Spaces:
Runtime error
Runtime error
Merge branch 'clean' into main
Browse files
clean_selection/analyze_new_price_pppl.ipynb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be031f05f2b7d92cc5ee89671a8ddd9d844ea0c8e9b803f5dcb70bdcab2b67a5
|
| 3 |
+
size 228782
|
clean_selection/compute_new_price_pppl.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoModelForMaskedLM, AutoTokenizer
|
| 2 |
+
from protein_conformal.scope_utils import calculate_pppl
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
torch.cuda.set_device(0)
|
| 6 |
+
device = torch.device("cuda:0")
|
| 7 |
+
|
| 8 |
+
# Load the model and tokenizer
|
| 9 |
+
model_name = "facebook/esm1b_t33_650M_UR50S" ## this is the backbone ESM model used for CLEAN
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 11 |
+
model = AutoModelForMaskedLM.from_pretrained(model_name)
|
| 12 |
+
model = model.cuda()
|
| 13 |
+
|
| 14 |
+
# load sequences from pa][ndas dataframe "data/new.csv" under "Sequence" column
|
| 15 |
+
import pandas as pd
|
| 16 |
+
df = pd.read_csv("data/new.csv", sep = "\t")
|
| 17 |
+
new_sequences = df["Sequence"]
|
| 18 |
+
|
| 19 |
+
# same for "data/price.csv"
|
| 20 |
+
df = pd.read_csv("data/price.csv", sep = "\t")
|
| 21 |
+
price_sequences = df["Sequence"]
|
| 22 |
+
|
| 23 |
+
# Calculate PPPL for all sequences
|
| 24 |
+
pppl_new = [calculate_pppl(model, tokenizer, seq, device) for seq in new_sequences]
|
| 25 |
+
pppl_price = [calculate_pppl(model, tokenizer, seq, device) for seq in price_sequences]
|
| 26 |
+
|
| 27 |
+
# Save the results
|
| 28 |
+
df["PPPL"] = pppl_price
|
| 29 |
+
df.to_csv("data/price_w_pppl.csv", sep = "\t", index = False)
|
| 30 |
+
|
| 31 |
+
df = pd.read_csv("data/new.csv", sep = "\t")
|
| 32 |
+
df["PPPL"] = pppl_new
|
| 33 |
+
|
| 34 |
+
df.to_csv("data/new_w_pppl.csv", sep = "\t", index = False)
|
clean_selection/get_clean_dists.ipynb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c7b40ac630e522634e58c21508a00602879325bd25938288f731573a379f4e3b
|
| 3 |
+
size 41395
|
clean_selection/process_clean_ec.ipynb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:699e8fd4cf4f956d420f2a6ed9ab3c9c38c5afa605d77add397b6638c189e6a8
|
| 3 |
+
size 10824
|