change to class method
Browse files- modeling_adaptor.py +3 -3
modeling_adaptor.py
CHANGED
|
@@ -89,12 +89,12 @@ class MixtureOfAdaptors(nn.Module):
|
|
| 89 |
)
|
| 90 |
return adaptor_cache
|
| 91 |
|
| 92 |
-
@
|
| 93 |
-
def load(input_path):
|
| 94 |
with open(os.path.join(input_path, "config.json")) as fIn:
|
| 95 |
config = json.load(fIn)
|
| 96 |
|
| 97 |
-
adaptor =
|
| 98 |
adaptor.load_state_dict(
|
| 99 |
torch.load(
|
| 100 |
os.path.join(input_path, "adaptor.pth"), weights_only=True
|
|
|
|
| 89 |
)
|
| 90 |
return adaptor_cache
|
| 91 |
|
| 92 |
+
@classmethod
|
| 93 |
+
def load(cls, input_path):
|
| 94 |
with open(os.path.join(input_path, "config.json")) as fIn:
|
| 95 |
config = json.load(fIn)
|
| 96 |
|
| 97 |
+
adaptor = cls(**config)
|
| 98 |
adaptor.load_state_dict(
|
| 99 |
torch.load(
|
| 100 |
os.path.join(input_path, "adaptor.pth"), weights_only=True
|