Spaces:
Runtime error
Runtime error
File size: 576 Bytes
8cf6d22 761b08f 8cf6d22 761b08f ec42e29 db65a6c 761b08f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import torch
import torch.nn
def load_dummy_model(DEBUG):
model = DummyModel()
if not DEBUG:
file_path = hf_hub_download("lfolle/DeepNAPSIModel", "dummy_model.pth",
use_auth_token=os.environ['DeepNAPSIModel'])
model.load_state_dict(torch.load(file_path))
return model
class DummyModel(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x:list):
return torch.softmax(torch.rand(len(x), 5), 1), 0
def __call__(self, x:list):
return self.forward(x)
|