Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix import mmrazor error in mmcls test #467

Merged
merged 1 commit into from
May 13, 2022

Conversation

RunningLeon
Copy link
Collaborator

tests/test_codebase/test_mmcls/test_classification.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <mmdeploy.codebase.mmcls.deploy.classification.Classification object at 0x7f67c80f4150>, model_checkpoint = None
cfg_options = None, kwargs = {}

    def init_pytorch_model(self,
                           model_checkpoint: Optional[str] = None,
                           cfg_options: Optional[Dict] = None,
                           **kwargs) -> torch.nn.Module:
        """Initialize torch model.
    
        Args:
            model_checkpoint (str): The checkpoint file of torch model,
                Default: None.
            cfg_options (dict): Optional config key-pair parameters.
    
        Returns:
            nn.Module: An initialized torch model generated by OpenMMLab
                codebases.
        """
        if self.from_mmrazor:
>           from mmrazor.apis import init_mmcls_model as init_model
E           ModuleNotFoundError: No module named 'mmrazor'

mmdeploy/codebase/mmcls/deploy/classification.py:99: ModuleNotFoundError

Motivation

Fix import mmrazor error in mmcls test.

Modification

Skip test if mmrazor is not installed.

BC-breaking (Optional)

None

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

Copy link
Member

@grimoire grimoire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RunningLeon RunningLeon merged commit 6eb83a9 into open-mmlab:dev-v0.5.0 May 13, 2022
lvhan028 pushed a commit to lvhan028/mmdeploy that referenced this pull request Jun 3, 2022
lvhan028 pushed a commit to lvhan028/mmdeploy that referenced this pull request Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants