DeepSpeed
DeepSpeed copied to clipboard
Incorrect variable name: `self.ev_values`
engine.py:2838-2846:
- The code incorrectly uses
self.ev_values[i][0] - In the context, only a local variable is defined:
ev_values = self.block_eigenvalue.values() - I found no definition or assignment of
self.ev_valuesanywhere in the same file (it appears out of nowhere in this scope)
Result: When the branch conditions are met (monitor.enabled + GA boundary + rank0 + eigenvalue condition), this line will throw AttributeError: 'DeepSpeedEngine' object has no attribute 'ev_values'. This causes the eigenvalue-related monitoring log writing to fail (and may even prevent a single monitor.write_events call from executing).
Additional hidden prerequisite issue:
dict.values() returns a dict_values view object in Python 3, which does not support indexing. The current code:
ev_values = self.block_eigenvalue.values()
for i in range(len(ev_values)):
...
len(ev_values)works ondict_values- But even if you fix
self.ev_valuestoev_values[i], it will still throw aTypeErrorbecausedict_valuesis not subscriptable
Fix required: Convert ev_values to an indexable sequence (e.g., list(self.block_eigenvalue.values())) to access values via index i correctly.