mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-16 22:52:25 +00:00
[misc] update pre-commit and run all files (#4752)
* [misc] update pre-commit * [misc] run pre-commit * [misc] remove useless configuration files * [misc] ignore cuda for clang-format
This commit is contained in:
@@ -5,6 +5,7 @@ import torch
|
||||
|
||||
try:
|
||||
from timm.models.vision_transformer import vit_large_patch16_384 as vit
|
||||
|
||||
MODELS = [vit]
|
||||
HAS_REPO = True
|
||||
except:
|
||||
@@ -19,7 +20,7 @@ from colossalai.testing import clear_cache_before_run, parameterize, spawn
|
||||
|
||||
def get_data() -> Tuple[List, List]:
|
||||
data = torch.rand(1, 3, 384, 384)
|
||||
meta_args = {'x': data}
|
||||
meta_args = {"x": data}
|
||||
return data, meta_args
|
||||
|
||||
|
||||
|
@@ -75,9 +75,9 @@ def assert_codegen_run(
|
||||
max_mem_ori = torch.cuda.max_memory_allocated() / 1024**2
|
||||
print("origin mem: %.2fMB, autochunk mem: %.2fMB" % (max_mem_ori - now_mem_ori, max_mem_gm - now_mem_gm))
|
||||
|
||||
assert torch.allclose(out_gm, out_model,
|
||||
atol=1e-3), "fx_out doesn't comply with original output, diff is %.2e" % torch.mean(
|
||||
torch.abs(out_gm - out_model))
|
||||
assert torch.allclose(
|
||||
out_gm, out_model, atol=1e-3
|
||||
), "fx_out doesn't comply with original output, diff is %.2e" % torch.mean(torch.abs(out_gm - out_model))
|
||||
|
||||
return chunks
|
||||
|
||||
@@ -121,7 +121,7 @@ def run_test(
|
||||
if get_chunk_target is not None:
|
||||
chunk_found = [i["region"] for i in chunks]
|
||||
chunk_target = get_chunk_target()[max_memory]
|
||||
assert (chunk_found == chunk_target), "found regions %s doesn't equal target regions %s" % (
|
||||
assert chunk_found == chunk_target, "found regions %s doesn't equal target regions %s" % (
|
||||
str(chunk_found),
|
||||
str(chunk_target),
|
||||
)
|
||||
|
Reference in New Issue
Block a user