From 7fa48450111a0d6fd0cf9bf53ef041c58ddc3ee3 Mon Sep 17 00:00:00 2001 From: Charles Frye Date: Tue, 26 Mar 2024 17:25:25 +0000 Subject: [PATCH] placate mypy --- 10_integrations/cloud_bucket_mount_loras.py | 5 ++++- 10_integrations/s3_bucket_mount.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/10_integrations/cloud_bucket_mount_loras.py b/10_integrations/cloud_bucket_mount_loras.py index 5eee2d51e..dc613cb4c 100644 --- a/10_integrations/cloud_bucket_mount_loras.py +++ b/10_integrations/cloud_bucket_mount_loras.py @@ -23,6 +23,7 @@ import io import os from pathlib import Path +from typing import Optional from modal import ( CloudBucketMount, # the star of the show @@ -124,7 +125,7 @@ def search_loras(limit: int, max_model_size: int = 1024 * 1024 * 1024): # To speed things up, we will run this function in parallel using Modal's # [`map`](https://modal.com/docs/reference/modal.Function#map). @stub.function() -def download_lora(repository_id: str) -> str: +def download_lora(repository_id: str) -> Optional[str]: os.environ["HF_HUB_DISABLE_SYMLINKS_WARNING"] = "1" # CloudBucketMounts will report 0 bytes of available space leading to many @@ -149,6 +150,8 @@ def download_lora(repository_id: str) -> str: downloaded_lora = False if downloaded_lora: return repository_id + else: + return None # ## Inference with LoRAs diff --git a/10_integrations/s3_bucket_mount.py b/10_integrations/s3_bucket_mount.py index 4c7030410..3d9f57291 100644 --- a/10_integrations/s3_bucket_mount.py +++ b/10_integrations/s3_bucket_mount.py @@ -92,7 +92,7 @@ def download_data(year: int, month: int) -> str: ) }, ) -def aggregate_data(path: str) -> tuple[datetime, int]: +def aggregate_data(path: str) -> list[tuple[datetime, int]]: print(f"processing => {path}") # Parse file.