Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

AttributeError: 'NoneType' object has no attribute 'stream_id' #134

Description

@neomi-tenenbaum-huawei

on file general/hooks/forward.py on FlexPrepare init (~line 64)

self.use_streams = torch.cuda.is_available() and policy.overlap
self.streams = {}
self.streams["prev_layer"] = torch.cuda.Stream() if self.use_streams else None
self.streams["next_layer"] = torch.cuda.Stream() if self.use_streams else None
self.streams["prev_batch"] = torch.cuda.Stream() if self.use_streams else None
self.streams["next_batch"] = torch.cuda.Stream() if self.use_streams else None
self.stream_names = list(self.streams.keys())

    for name, stream in self.streams.items():
            logger.info(f"{name}: id-{stream.stream_id}")

if 'stream' is None (self.use_streams is False), I will get the error: AttributeError: 'NoneType' object has no attribute 'stream_id'

you have to change the code to:
for name, stream in self.streams.items():
if stream:
logger.info(f"{name}: id-{stream.stream_id}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions