root
update v1.5-beta
f9e2d84
raw
history blame
438 Bytes
import torch
from third_party.stable_audio_tools.stable_audio_tools.models.autoencoders import create_autoencoder_from_config
import json
def get_model(model_config, path):
with open(model_config) as f:
model_config = json.load(f)
state_dict = torch.load(path, map_location='cpu')
model = create_autoencoder_from_config(model_config)
model.load_state_dict(state_dict['state_dict'], strict=False)
return model