Spaces:
Sleeping
Sleeping
File size: 643 Bytes
8cf6d22 70583d3 8cf6d22 70583d3 8cf6d22 761b08f 70583d3 761b08f 8cf6d22 70583d3 ec42e29 db65a6c 70583d3 761b08f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import torch
import os
import torch.nn
from huggingface_hub import hf_hub_download
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)
|