Upload model
Browse files- README.md +3 -0
- modeling_genbio.py +5 -1
README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
# Load model for inference
|
2 |
```python
|
3 |
import torch
|
|
|
1 |
+
---
|
2 |
+
{}
|
3 |
+
---
|
4 |
# Load model for inference
|
5 |
```python
|
6 |
import torch
|
modeling_genbio.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from lightning.pytorch import LightningModule
|
2 |
from lightning.pytorch.core.saving import _load_state
|
3 |
from transformers import PreTrainedModel, PretrainedConfig
|
@@ -31,7 +33,9 @@ class GenBioModel(PreTrainedModel):
|
|
31 |
# TODO: _load_state is a private function and it throws a warning for an
|
32 |
# empty state_dict. We need a fucntion to intialize our model; this
|
33 |
# is the only choice we have for now.
|
34 |
-
|
|
|
|
|
35 |
|
36 |
@classmethod
|
37 |
def from_genbio_model(cls, model: LightningModule):
|
|
|
1 |
+
import warnings
|
2 |
+
|
3 |
from lightning.pytorch import LightningModule
|
4 |
from lightning.pytorch.core.saving import _load_state
|
5 |
from transformers import PreTrainedModel, PretrainedConfig
|
|
|
33 |
# TODO: _load_state is a private function and it throws a warning for an
|
34 |
# empty state_dict. We need a fucntion to intialize our model; this
|
35 |
# is the only choice we have for now.
|
36 |
+
with warnings.catch_warnings():
|
37 |
+
warnings.filterwarnings("ignore", "Found keys that are*")
|
38 |
+
self.genbio_model = _load_state(genbio_cls, checkpoint, strict_loading=False)
|
39 |
|
40 |
@classmethod
|
41 |
def from_genbio_model(cls, model: LightningModule):
|