Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try s3 crt #519

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
try to see if it works with crt?
noyoshi committed Jun 20, 2024
commit fb1a532b13116e60d4ea9b8a920705bea2a99cd2
9 changes: 7 additions & 2 deletions server/lorax_server/utils/sources/s3.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@
from datetime import timedelta
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Optional, Tuple

from boto3.s3.transfer import S3Transfer
from awscrt.s3 import S3Client
import boto3
from botocore.config import Config
from botocore.exceptions import ClientError
@@ -114,8 +115,12 @@ def download_file(filename, files):
local_file_path.parent.mkdir(parents=True, exist_ok=True)
model_id_path = Path(model_id)
bucket_file_name = model_id_path / filename

transfer = S3Transfer(S3Client(region="us-west-2", throughput_target_gbps=50))
transfer.download_file(bucket.name, str(bucket_file_name), str(local_file_path))

logger.info(f"Downloading file {bucket_file_name} to {local_file_path}")
bucket.download_file(str(bucket_file_name), str(local_file_path))
# bucket.download_file(str(bucket_file_name), str(local_file_path))
# TODO: add support for revision
logger.info(f"Downloaded {local_file_path} in {timedelta(seconds=int(time.time() - start_time))}.")
if not local_file_path.is_file():