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