From 130e418800a452936973f4d8c95f7352d409b5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 10 Apr 2024 17:32:44 -0700 Subject: [PATCH] moondream: allow passing use_cpu --- examples/foundational/12-describe-video.py | 1 + src/dailyai/services/moondream_ai_service.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/foundational/12-describe-video.py b/examples/foundational/12-describe-video.py index 8e20d6533..62e116020 100644 --- a/examples/foundational/12-describe-video.py +++ b/examples/foundational/12-describe-video.py @@ -61,6 +61,7 @@ async def main(room_url: str, token): vision_aggregator = VisionImageFrameAggregator() + # If you run into weird description, try with use_cpu=True moondream = MoondreamService() tts = ElevenLabsTTSService( diff --git a/src/dailyai/services/moondream_ai_service.py b/src/dailyai/services/moondream_ai_service.py index 07ff9e534..2b9835404 100644 --- a/src/dailyai/services/moondream_ai_service.py +++ b/src/dailyai/services/moondream_ai_service.py @@ -25,11 +25,11 @@ def __init__( self, model_id="vikhyatk/moondream2", revision="2024-04-02", - device=None + use_cpu=False ): super().__init__() - if not device: + if not use_cpu: device, dtype = detect_device() else: device = torch.device("cpu")