[lint] Update lint (#16)

* update lint

* update readme

* update ruff lint
This commit is contained in:
Lufang Chen
2025-09-11 13:18:33 +08:00
committed by GitHub
parent a89dce95aa
commit e9332a283d
28 changed files with 2406 additions and 1074 deletions
+16 -11
View File
@@ -10,10 +10,14 @@ batch_size = 1
seq_length = 50
torch.manual_seed(0)
fake_input_ids = torch.randint(0, len(model.processor.tokenizer), (batch_size, seq_length), dtype=torch.long)
fake_input_ids = torch.randint(
0, len(model.processor.tokenizer), (batch_size, seq_length), dtype=torch.long
)
fake_attention_mask = torch.ones((batch_size, seq_length), dtype=torch.long)
fake_moe_token_types = torch.zeros((batch_size, seq_length), dtype=torch.long)
fake_position_ids = torch.arange(seq_length, dtype=torch.long).unsqueeze(0).expand(batch_size, -1)
fake_position_ids = (
torch.arange(seq_length, dtype=torch.long).unsqueeze(0).expand(batch_size, -1)
)
fake_proprioception = torch.randn((batch_size, 1, 20), dtype=torch.float32)
fake_agent_pos_mask = torch.ones((batch_size, 1, 20), dtype=torch.float32)
fake_dof_mask = torch.ones((batch_size, 32, 20), dtype=torch.float32)
@@ -44,37 +48,38 @@ try:
agent_pos_mask=fake_agent_pos_mask,
dof_mask=fake_dof_mask,
dataset_names=fake_dataset_names,
mode="validate"
mode="validate",
)
print("✅ Fake inference test successful!")
print(f"Output logits shape: {outputs.logits.shape}")
print(f"Output logits dtype: {outputs.logits.dtype}")
print(f"Output logits device: {outputs.logits.device}")
# Check if output is reasonable
if outputs.logits.shape == (batch_size, seq_length, model.config.vocab_size):
print("✅ Output shape correct")
else:
print("❌ Output shape incorrect")
if not torch.isnan(outputs.logits).any():
print("✅ Output contains no NaN values")
else:
print("❌ Output contains NaN values")
if not torch.isinf(outputs.logits).any():
print("✅ Output contains no infinity values")
else:
print("❌ Output contains infinity values")
print(f"Output logits statistics:")
print("Output logits statistics:")
print(f" Min value: {outputs.logits.min().item():.4f}")
print(f" Max value: {outputs.logits.max().item():.4f}")
print(f" Mean: {outputs.logits.mean().item():.4f}")
print(f" Standard deviation: {outputs.logits.std().item():.4f}")
except Exception as e:
print(f"❌ Fake inference test failed: {e}")
import traceback
traceback.print_exc()
traceback.print_exc()