mirror of
https://github.com/xai-org/grok-1.git
synced 2024-12-28 04:20:33 +03:00
Enhanced Error Handling in load_tensors()
This commit is contained in:
parent
7050ed204b
commit
3fd4e7c4d7
@ -104,7 +104,21 @@ def load_tensors(shaped_arrays, directory, mesh_config, tensor_indices=None):
|
||||
else:
|
||||
fs.append(pool.submit(np.zeros, t.shape, dtype=t.dtype))
|
||||
wait(fs)
|
||||
return [f.result() for f in fs]
|
||||
|
||||
# return [f.result() for f in fs]
|
||||
"""
|
||||
Improve error reporting in load_tensors by catching exceptions within the futures-
|
||||
and logging detailed information about the failure.
|
||||
"""
|
||||
results = []
|
||||
for future in fs:
|
||||
try:
|
||||
result = future.result()
|
||||
results.append(result)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to load tensor: {e}")
|
||||
raise
|
||||
return results
|
||||
|
||||
|
||||
def path_tuple_to_string(path: tuple) -> str:
|
||||
|
Loading…
Reference in New Issue
Block a user