You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from ignite.metrics import Metric
ImportError: cannot import name 'Metric' from partially initialized module 'ignite.metrics' (most likely due to a circular import)
/ignite/metrics/init.py)
I solved that by
def create_supervised_evaluator(
model: torch.nn.Module,
# metrics: Optional[Dict[str, Metric]] = None, #############this is the problem,i modify i by delete Optional[Dict[str, Metric]].
metrics = None,
device: Optional[Union[str, torch.device]] = None,
non_blocking: bool = False,
prepare_batch: Callable = _prepare_batch,
model_transform: Callable[[Any], Any] = lambda output: output,
output_transform: Callable[[Any, Any, Any], Any] = lambda x, y, y_pred: (y_pred, y),
amp_mode: Optional[str] = None,
model_fn: Callable[[torch.nn.Module, Any], Any] = lambda model, x: model(x),
) -> Engine:
Does have other ways to solve that?I dont want to modify source file.
The text was updated successfully, but these errors were encountered:
from ignite.metrics import Metric
ImportError: cannot import name 'Metric' from partially initialized module 'ignite.metrics' (most likely due to a circular import)
/ignite/metrics/init.py)
I solved that by
def create_supervised_evaluator(
model: torch.nn.Module,
# metrics: Optional[Dict[str, Metric]] = None, #############this is the problem,i modify i by delete Optional[Dict[str, Metric]].
metrics = None,
device: Optional[Union[str, torch.device]] = None,
non_blocking: bool = False,
prepare_batch: Callable = _prepare_batch,
model_transform: Callable[[Any], Any] = lambda output: output,
output_transform: Callable[[Any, Any, Any], Any] = lambda x, y, y_pred: (y_pred, y),
amp_mode: Optional[str] = None,
model_fn: Callable[[torch.nn.Module, Any], Any] = lambda model, x: model(x),
) -> Engine:
Does have other ways to solve that?I dont want to modify source file.
The text was updated successfully, but these errors were encountered: