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_values anywhere 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 on dict_values
- But even if you fix
self.ev_values to ev_values[i], it will still throw a TypeError because dict_values is 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.
engine.py:2838-2846:self.ev_values[i][0]ev_values = self.block_eigenvalue.values()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 throwAttributeError: 'DeepSpeedEngine' object has no attribute 'ev_values'. This causes the eigenvalue-related monitoring log writing to fail (and may even prevent a singlemonitor.write_eventscall from executing).Additional hidden prerequisite issue:
dict.values()returns adict_valuesview object in Python 3, which does not support indexing. The current code:len(ev_values)works ondict_valuesself.ev_valuestoev_values[i], it will still throw aTypeErrorbecausedict_valuesis not subscriptableFix required: Convert
ev_valuesto an indexable sequence (e.g.,list(self.block_eigenvalue.values())) to access values via indexicorrectly.