(cls, path)
| 45 | |
| 46 | @classmethod |
| 47 | def load(cls, path): |
| 48 | artifacts = np.load(path, allow_pickle=True)[()] |
| 49 | codes = torch.from_numpy(artifacts["codes"].astype(int)) |
| 50 | if artifacts["metadata"].get("dac_version", None) not in SUPPORTED_VERSIONS: |
| 51 | raise RuntimeError( |
| 52 | f"Given file {path} can't be loaded with this version of descript-audio-codec." |
| 53 | ) |
| 54 | return cls(codes=codes, **artifacts["metadata"]) |
| 55 | |
| 56 | |
| 57 | class CodecMixin: |
no outgoing calls