Enhance reproducibility in Ulysses attention tests by replacing current_omni_platform.seed_everything with torch's manual_seed and adding support for CUDA devices. Introduce get_supported_tasks method in AsyncOmni class to dynamically determine available tasks based on stage capabilities.
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
This commit is contained in:
1 parent
4d8a76e721
commit
2da9d28f1b
2 files changed
+15
-2
No files matched your search
@@ -329,7 +329,9 @@ def ulysses_attention_on_test_model(
|
||||
"""Run Ulysses attention test on a test model and save results for comparison."""
|
||||
# Use fixed seed for reproducibility across baseline and SP runs
|
||||
RANDOM_SEED = 42
|
||||
current_omni_platform.seed_everything(RANDOM_SEED)
|
||||
torch.manual_seed(RANDOM_SEED)
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.manual_seed_all(RANDOM_SEED)
|
||||
|
||||
mode_str = "Baseline (no SP)" if is_baseline else f"SP (ulysses={ulysses_degree}, ring={ring_degree})"
|
||||
print(f"\n[{mode_str}] Rank {local_rank}/{world_size} - Random seed set to {RANDOM_SEED}")
|
||||
@@ -414,7 +416,8 @@ def ulysses_attention_on_test_model(
|
||||
# Generate and save full input data with fixed seed
|
||||
# Reinitialize RNG to ensure reproducibility
|
||||
torch.manual_seed(42)
|
||||
current_omni_platform.seed_everything(42)
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.manual_seed_all(42)
|
||||
full_hidden_states = torch.randn(
|
||||
(batch_size, seq_len, hidden_size),
|
||||
dtype=dtype,
|
||||
|
||||
@@ -658,6 +658,16 @@ class AsyncOmni(OmniBase):
|
||||
stage.submit(abort_task)
|
||||
return None
|
||||
|
||||
async def get_supported_tasks(self) -> set[str]:
|
||||
tasks: set[str] = set()
|
||||
has_comprehension = any(stage.is_comprehension for stage in self.stage_list)
|
||||
if has_comprehension:
|
||||
tasks.add("generate")
|
||||
for stage in self.stage_list:
|
||||
if getattr(stage, "final_output_type", None) == "audio":
|
||||
tasks.add("speech")
|
||||
return tasks if tasks else {"generate"}
|
||||
|
||||
async def get_vllm_config(self) -> VllmConfig:
|
||||
for stage in self.stage_list:
|
||||
if stage.is_comprehension:
|
||||
|
||||
Reference in new issue
Block a user