[CI/Build] drop support for Python 3.8 EOL (#8464)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
@ -429,8 +429,8 @@ def benchmark():
|
||||
# print in tabular format
|
||||
print("batch size\teager mode\tfull cudagraph\tpiecewise cudagraph")
|
||||
for b in cudagraph_sizes:
|
||||
print((f"{b}\t{eager_time[b]:.3f}\t{full_cudagraph_time[b]:.3f}"
|
||||
f"\t{piecewise_cudagraph_time[b]:.3f}"))
|
||||
print(f"{b}\t{eager_time[b]:.3f}\t{full_cudagraph_time[b]:.3f}"
|
||||
f"\t{piecewise_cudagraph_time[b]:.3f}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
from collections import UserList
|
||||
from enum import Enum
|
||||
@ -52,7 +51,7 @@ PromptVideoInput = _PromptMultiModalInput[np.ndarray]
|
||||
|
||||
|
||||
def _read_prompts(filename: str) -> List[str]:
|
||||
with open(filename, "r") as f:
|
||||
with open(filename) as f:
|
||||
prompts = f.readlines()
|
||||
return prompts
|
||||
|
||||
@ -62,14 +61,8 @@ class _ImageAssetPrompts(TypedDict):
|
||||
cherry_blossom: str
|
||||
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
# UserList cannot be subscripted
|
||||
class _ImageAssetsBase(UserList):
|
||||
pass
|
||||
else:
|
||||
|
||||
class _ImageAssetsBase(UserList[ImageAsset]):
|
||||
pass
|
||||
class _ImageAssetsBase(UserList[ImageAsset]):
|
||||
pass
|
||||
|
||||
|
||||
class _ImageAssets(_ImageAssetsBase):
|
||||
@ -94,14 +87,8 @@ class _VideoAssetPrompts(TypedDict):
|
||||
sample_demo_1: str
|
||||
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
# UserList cannot be subscripted
|
||||
class _VideoAssetsBase(UserList):
|
||||
pass
|
||||
else:
|
||||
|
||||
class _VideoAssetsBase(UserList[VideoAsset]):
|
||||
pass
|
||||
class _VideoAssetsBase(UserList[VideoAsset]):
|
||||
pass
|
||||
|
||||
|
||||
class _VideoAssets(_VideoAssetsBase):
|
||||
@ -958,7 +945,7 @@ def dummy_opt_path():
|
||||
"*.msgpack"
|
||||
])
|
||||
assert os.path.exists(json_path)
|
||||
with open(json_path, "r") as f:
|
||||
with open(json_path) as f:
|
||||
config = json.load(f)
|
||||
config["architectures"] = ["MyOPTForCausalLM"]
|
||||
with open(json_path, "w") as f:
|
||||
@ -977,7 +964,7 @@ def dummy_llava_path():
|
||||
"*.msgpack"
|
||||
])
|
||||
assert os.path.exists(json_path)
|
||||
with open(json_path, "r") as f:
|
||||
with open(json_path) as f:
|
||||
config = json.load(f)
|
||||
config["architectures"] = ["MyLlava"]
|
||||
with open(json_path, "w") as f:
|
||||
@ -996,7 +983,7 @@ def dummy_gemma2_embedding_path():
|
||||
"*.msgpack"
|
||||
])
|
||||
assert os.path.exists(json_path)
|
||||
with open(json_path, "r") as f:
|
||||
with open(json_path) as f:
|
||||
config = json.load(f)
|
||||
config["architectures"] = ["MyGemma2Embedding"]
|
||||
with open(json_path, "w") as f:
|
||||
|
||||
@ -99,13 +99,11 @@ class TestPrefixCachingBlock:
|
||||
|
||||
token_ids = [random.randint(0, 50_000) for _ in range(num_tokens)]
|
||||
|
||||
first_chain, second_chain = [
|
||||
TestPrefixCachingBlock.create_chain(
|
||||
block_size=block_size,
|
||||
token_ids=token_ids,
|
||||
num_empty_trailing_blocks=num_empty_trailing_blocks)
|
||||
for _ in range(2)
|
||||
]
|
||||
first_chain, second_chain = (TestPrefixCachingBlock.create_chain(
|
||||
block_size=block_size,
|
||||
token_ids=token_ids,
|
||||
num_empty_trailing_blocks=num_empty_trailing_blocks)
|
||||
for _ in range(2))
|
||||
|
||||
for first_chain_block, second_chain_block in zip(
|
||||
first_chain, second_chain):
|
||||
|
||||
@ -510,7 +510,7 @@ def test_selective_scan_varlen(with_padding, is_variable_B, is_variable_C,
|
||||
for var in (u_ref, delta_ref, B_ref, C_ref, z_ref)
|
||||
]
|
||||
for i in range(len(seqlens[0])):
|
||||
u_s, delta_s, B_s, C_s, z_s = [v[i].unsqueeze(0) for v in splits]
|
||||
u_s, delta_s, B_s, C_s, z_s = (v[i].unsqueeze(0) for v in splits)
|
||||
if padded_state_indices[i] == PAD_SLOT_ID:
|
||||
continue
|
||||
out_ref_s, _ = selective_scan_ref(
|
||||
|
||||
@ -104,7 +104,7 @@ def test_input_mapper_valid_mm_data(input_mapper_for_qwen,
|
||||
# Sad path tests for the multimodal input processor and mapper, respectively
|
||||
@pytest.mark.parametrize("mm_data", [
|
||||
{
|
||||
"image": torch.rand((5))
|
||||
"image": torch.rand(5)
|
||||
},
|
||||
{
|
||||
"image": torch.rand((5, 5, 5, 5, 5))
|
||||
|
||||
@ -413,12 +413,10 @@ class _CorrectnessTestHelper:
|
||||
def generate_probs_for_test(
|
||||
self, draft_and_target_probs_equal: bool
|
||||
) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
||||
draft_probs, target_probs = [
|
||||
F.softmax(
|
||||
torch.rand(self.vocab_size, dtype=torch.float32),
|
||||
dim=-1,
|
||||
) for _ in range(2)
|
||||
]
|
||||
draft_probs, target_probs = (F.softmax(
|
||||
torch.rand(self.vocab_size, dtype=torch.float32),
|
||||
dim=-1,
|
||||
) for _ in range(2))
|
||||
|
||||
num_reference_probs = 100
|
||||
reference_probs = F.softmax(
|
||||
|
||||
@ -29,7 +29,7 @@ def test_trace_function_call():
|
||||
cur_dir = os.path.dirname(__file__)
|
||||
enable_trace_function_call(path, cur_dir)
|
||||
f1(1)
|
||||
with open(path, 'r') as f:
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
|
||||
assert "f1" in content
|
||||
|
||||
@ -93,10 +93,10 @@ def test_mistral_edge_case(tokenizer, truth):
|
||||
def skip_special_tokens(request, tokenizer_name) -> Generator[bool, Any, None]:
|
||||
if "mistral" in tokenizer_name:
|
||||
yield (
|
||||
bool(True) if request.param else
|
||||
True if request.param else
|
||||
pytest.skip("mistral doesn't support skip_special_tokens=False"))
|
||||
else:
|
||||
yield bool(True) if request.param else bool(False)
|
||||
yield bool(request.param)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("truth", TRUTH)
|
||||
|
||||
Reference in New Issue
Block a user