From f7488b6fb140f31293fe6399e1e4f73113028147 Mon Sep 17 00:00:00 2001 From: Mei Chen Date: Mon, 26 Jan 2026 20:20:45 -0500 Subject: [PATCH] Fix device placement when loading voice prompt embeddings Add map_location to torch.load() to ensure embeddings load directly onto the model's device instead of defaulting to CPU. --- moshi/moshi/models/lm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moshi/moshi/models/lm.py b/moshi/moshi/models/lm.py index a64d736..ee8d867 100644 --- a/moshi/moshi/models/lm.py +++ b/moshi/moshi/models/lm.py @@ -976,7 +976,7 @@ def load_voice_prompt(self, voice_prompt: str): def load_voice_prompt_embeddings(self, path: str): self.voice_prompt = path - state = torch.load(path) + state = torch.load(path, map_location=self.lm_model.device) self.voice_prompt_audio = None self.voice_prompt_embeddings = state["embeddings"].to(self.lm_model.device)