from safetensors import safe_open from safetensors.torch import save_file tensors = {} with safe_open('audio_text_embeddings.safetensors', framework="pt", device=0) as f: for k in f.keys(): tensors[k] = f.get_tensor(k) text_embed = tensors["text_embed"].detach().cpu() tensors = { "text_embed": text_embed, } save_file(tensors, "/root/autodl-tmp/audio_text_embeddings_ cpu.safetensors")