Upload pipeline.py with huggingface_hub
Browse files- pipeline.py +14 -0
pipeline.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
|
4 |
+
class CRISPRTransformerPipeline(DiffusionPipeline):
|
5 |
+
def __init__(self, CRISPR_transformer_model):
|
6 |
+
super().__init__()
|
7 |
+
|
8 |
+
self.register_modules(CRISPR_transformer_model=CRISPR_transformer_model)
|
9 |
+
|
10 |
+
@torch.no_grad()
|
11 |
+
def __call__(self, batch):
|
12 |
+
return {
|
13 |
+
"logit": self.CRISPR_transformer_model(batch["refcode"].to(self.CRISPR_transformer_model.device))["logit"]
|
14 |
+
}
|