[diffusion] improve: skip loading vision module for text encoders (#16304)
This commit is contained in:
@@ -90,7 +90,7 @@ def collect_test_items(files, filter_expr=None):
|
||||
cmd.extend(["-k", filter_expr])
|
||||
cmd.extend(files)
|
||||
|
||||
logger.info(f"Collecting tests with command: {' '.join(cmd)}")
|
||||
print(f"Collecting tests with command: {' '.join(cmd)}")
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
|
||||
# Check for collection errors
|
||||
@@ -114,7 +114,7 @@ def collect_test_items(files, filter_expr=None):
|
||||
raise RuntimeError(error_msg)
|
||||
|
||||
if result.returncode == 5:
|
||||
logger.info(
|
||||
print(
|
||||
"No tests were collected (exit code 5). This may be expected with filters."
|
||||
)
|
||||
|
||||
@@ -130,7 +130,7 @@ def collect_test_items(files, filter_expr=None):
|
||||
if "::" in test_id:
|
||||
test_items.append(test_id)
|
||||
|
||||
logger.info(f"Collected {len(test_items)} test items")
|
||||
print(f"Collected {len(test_items)} test items")
|
||||
return test_items
|
||||
|
||||
|
||||
@@ -145,20 +145,21 @@ def run_pytest(files, filter_expr=None):
|
||||
if filter_expr:
|
||||
base_cmd.extend(["-k", filter_expr])
|
||||
|
||||
max_retries = 4
|
||||
max_retries = 6
|
||||
# retry if the perf assertion failed, for {max_retries} times
|
||||
for i in range(max_retries + 1):
|
||||
cmd = list(base_cmd)
|
||||
if i > 0:
|
||||
cmd.append("--last-failed")
|
||||
cmd.extend(files)
|
||||
else:
|
||||
cmd.extend(files)
|
||||
|
||||
if i > 0:
|
||||
logger.info(
|
||||
print(
|
||||
f"Performance assertion failed. Retrying ({i}/{max_retries}) with --last-failed..."
|
||||
)
|
||||
|
||||
logger.info(f"Running command: {' '.join(cmd)}")
|
||||
print(f"Running command: {' '.join(cmd)}")
|
||||
|
||||
process = subprocess.Popen(
|
||||
cmd,
|
||||
@@ -185,7 +186,7 @@ def run_pytest(files, filter_expr=None):
|
||||
# Exit code 5 means no tests were collected/selected - treat as success
|
||||
# when using filters, since some partitions may have all tests filtered out
|
||||
if returncode == 5:
|
||||
logger.info(
|
||||
print(
|
||||
"No tests collected (exit code 5). This is expected when filters "
|
||||
"deselect all tests in a partition. Treating as success."
|
||||
)
|
||||
@@ -210,7 +211,7 @@ def run_pytest(files, filter_expr=None):
|
||||
if not (is_perf_assertion or is_flaky_ci_assertion or is_oom_error):
|
||||
return returncode
|
||||
|
||||
logger.info(f"Max retry exceeded")
|
||||
print(f"Max retry exceeded")
|
||||
return returncode
|
||||
|
||||
|
||||
@@ -261,12 +262,13 @@ def main():
|
||||
print(f"Selected {len(suite_files_abs)} files:")
|
||||
for f in suite_files_abs:
|
||||
print(f" - {os.path.basename(f)}")
|
||||
print(f"Running {len(my_items)} items in this shard: {', '.join(my_items)}")
|
||||
|
||||
if not my_items:
|
||||
print("No items assigned to this partition. Exiting success.")
|
||||
sys.exit(0)
|
||||
|
||||
print(f"Running {len(my_items)} items in this shard: {', '.join(my_items)}")
|
||||
|
||||
# 4. execute with the specific test items
|
||||
exit_code = run_pytest(my_items)
|
||||
sys.exit(exit_code)
|
||||
|
||||
Reference in New Issue
Block a user