MCPcopy
hub / github.com/ray-project/ray / download_model_from_s3

Function download_model_from_s3

python/ray/llm/tests/conftest.py:19–41  ·  view source on GitHub ↗

Download the model checkpoint and tokenizer from S3 for testing The reason to download the model from S3 is to avoid downloading the model from HuggingFace hub during testing, which is flaky because of the rate limit and HF hub downtime. Args: remote_url: The remote URL

(
    remote_url: str, file_list: List[str]
)

Source from the content-addressed store, hash-verified

17
18
19def download_model_from_s3(
20 remote_url: str, file_list: List[str]
21) -> Generator[str, None, None]:
22 """
23 Download the model checkpoint and tokenizer from S3 for testing
24 The reason to download the model from S3 is to avoid downloading the model
25 from HuggingFace hub during testing, which is flaky because of the rate
26 limit and HF hub downtime.
27
28 Args:
29 remote_url: The remote URL to download the model from.
30 file_list: The list of files to download.
31
32 Yields:
33 str: The path to the downloaded model checkpoint and tokenizer.
34 """
35 with tempfile.TemporaryDirectory(prefix="ray-llm-test-model") as checkpoint_dir:
36 print(f"Downloading model from {remote_url} to {checkpoint_dir}", flush=True)
37 for file_name in file_list:
38 response = requests.get(remote_url + file_name)
39 with open(os.path.join(checkpoint_dir, file_name), "wb") as fp:
40 fp.write(response.content)
41 yield os.path.abspath(checkpoint_dir)
42
43
44@pytest.fixture(scope="session")

Callers 8

model_opt_125mFunction · 0.85
model_llava_354mFunction · 0.85
model_smolvlm_256mFunction · 0.85
model_llama_3_2_216MFunction · 0.85
model_pixtral_12bFunction · 0.85
model_qwen_2_5_omni_3bFunction · 0.85

Calls 5

printFunction · 0.85
openFunction · 0.85
getMethod · 0.65
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…