Skip to content

AttributeError: 'Logger' object has no attribute 'name' #40

Open
@HuynhNguyenPhuc

Description

@HuynhNguyenPhuc

I had run this code:

package = nav.torch.optimize(
      model=pre_optimized_model,
      dataloader=final_dataloader,
      target_formats=tuple(cfg.optimization.target_formats),
      custom_configs=custom_configs,
      optimization_profile=optimization_profile,
      verify_func=verify_func,
      workspace=workspace_path,
      verbose=False,
      debug=True,
  )

And I got this error:

Traceback (most recent call last):
  File "/home/jupyter/Model-Optimizer/example.py", line 41, in <module>
    output_path = optimize_model(wrapper_model, "dinov2_vitl14_reg", allow_overwrite=True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jupyter/Model-Optimizer/src/model_optimizer/run.py", line 100, in optimize_model
    package = nav.torch.optimize(
              ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/model-optimizer/lib/python3.11/site-packages/model_navigator/torch/__init__.py", line 159, in optimize
    package = optimize_pipeline(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/model-optimizer/lib/python3.11/site-packages/model_navigator/pipelines/wrappers/optimize.py", line 73, in optimize_pipeline
    context = pipeline_manager.run(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/model-optimizer/lib/python3.11/site-packages/model_navigator/pipelines/pipeline_manager.py", line 88, in run
    pipeline.run(workspace=workspace, config=config, context=context)
  File "/opt/conda/envs/model-optimizer/lib/python3.11/site-packages/model_navigator/pipelines/pipeline.py", line 68, in run
    command_output = self._execute_unit(
                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/model-optimizer/lib/python3.11/site-packages/model_navigator/pipelines/pipeline.py", line 105, in _execute_unit
    redirect_stdout_context = StdoutLogger(LOGGER)
                              ^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/model-optimizer/lib/python3.11/site-packages/model_navigator/core/logger.py", line 220, in __init__
    self.name = self.logger.name
                ^^^^^^^^^^^^^^^^
AttributeError: 'Logger' object has no attribute 'name'

It still works when I set debug = False.

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