diff --git a/client/.eslinrc.json b/client/.eslintrc.json similarity index 100% rename from client/.eslinrc.json rename to client/.eslintrc.json diff --git a/client/src/pages/Conversation/Conversation.tsx b/client/src/pages/Conversation/Conversation.tsx index 4c7711a0..fdddda0b 100644 --- a/client/src/pages/Conversation/Conversation.tsx +++ b/client/src/pages/Conversation/Conversation.tsx @@ -44,14 +44,11 @@ const buildURL = ({ textSeed: number; audioSeed: number; }) => { - const newWorkerAddr = useMemo(() => { - if (workerAddr == "same" || workerAddr == "") { - const newWorkerAddr = window.location.hostname + ":" + window.location.port; - console.log("Overriding workerAddr to", newWorkerAddr); - return newWorkerAddr; - } - return workerAddr; - }, [workerAddr]); + let newWorkerAddr = workerAddr; + if (workerAddr === "same" || workerAddr === "") { + newWorkerAddr = window.location.hostname + ":" + window.location.port; + console.log("Overriding workerAddr to", newWorkerAddr); + } const wsProtocol = (window.location.protocol === 'https:') ? 'wss' : 'ws'; const url = new URL(`${wsProtocol}://${newWorkerAddr}/api/chat`); if(workerAuthId) { diff --git a/client/src/pages/Conversation/hooks/useSocket.ts b/client/src/pages/Conversation/hooks/useSocket.ts index 8e7d43fb..3408afc0 100644 --- a/client/src/pages/Conversation/hooks/useSocket.ts +++ b/client/src/pages/Conversation/hooks/useSocket.ts @@ -33,12 +33,7 @@ export const useSocket = ({ const onDisconnect = useCallback((event: CloseEvent) => { const closedSocket = event.target as WebSocket; - console.log("disconnected"); - setSocketStatus("disconnected"); - if (onDisconnectProp) { - onDisconnectProp(); - } - // ONLY clear socketRef.current if it's the one that closed + // Only act on the current socket; ignore stale connections if (socketRef.current === closedSocket) { console.log("disconnected (current socket)"); socketRef.current = null; diff --git a/client/src/pages/Queue/Queue.tsx b/client/src/pages/Queue/Queue.tsx index 7d0d44bb..b6a4236c 100644 --- a/client/src/pages/Queue/Queue.tsx +++ b/client/src/pages/Queue/Queue.tsx @@ -141,7 +141,7 @@ export const Queue:FC = () => { if(env.VITE_ENV === "development") { eruda.init(); } - () => { + return () => { if(env.VITE_ENV === "development") { eruda.destroy(); } diff --git a/moshi/moshi/models/loaders.py b/moshi/moshi/models/loaders.py index d38dcc3b..c2351db5 100644 --- a/moshi/moshi/models/loaders.py +++ b/moshi/moshi/models/loaders.py @@ -220,7 +220,7 @@ def get_moshi_lm( for name, tensor in list(state_dict.items()): if "depformer" in name and "self_attn" in name and name in model_sd: if tensor.shape != model_sd[name].shape: - print("Expanding %s", name) + print(f"Expanding {name}") missing = ( tensor if copy_missing_weights @@ -241,14 +241,14 @@ def get_moshi_lm( if needle in name: src = name.replace(needle, f"{rep}.{old}.") if src in state_dict: - print("Replacing %s <- %s", name, src) + print(f"Replacing {name} <- {src}") state_dict[name] = state_dict[src] replaced = True break if replaced: break if not replaced: - print("Missing %s", name) + print(f"Missing {name}") # Assign weights to target device dev = torch.device(device) if isinstance(device, str) else device diff --git a/moshi/moshi/server.py b/moshi/moshi/server.py index 771f491d..f5af23c9 100644 --- a/moshi/moshi/server.py +++ b/moshi/moshi/server.py @@ -426,7 +426,9 @@ def main(): # Download config.json to increment download counter # No worries about double-counting since config.json will be cached the second time - hf_hub_download(args.hf_repo, "config.json") + # Increment HF download counter (analytics only, skip in offline mode) + if not os.environ.get("HF_HUB_OFFLINE"): + hf_hub_download(args.hf_repo, "config.json") logger.info("loading mimi") if args.mimi_weight is None: diff --git a/moshi/pyproject.toml b/moshi/pyproject.toml index ead71e9c..a61259f0 100644 --- a/moshi/pyproject.toml +++ b/moshi/pyproject.toml @@ -10,8 +10,8 @@ dependencies = [ "sentencepiece == 0.2", "sounddevice == 0.5", "sphn >= 0.1.4, < 0.2", - "torch >= 2.2.0, < 2.5", - "aiohttp>=3.10.5, <3.11", + "torch >= 2.2.0", + "aiohttp>=3.10.5", ] authors = [{name="Rajarshi Roy", email="rajarshir@nvidia.com"}] maintainers = [{name="Rajarshi Roy", email="rajarshir@nvidia.com"}]