Because we copy file-by-file, the dependency resolution will sometimes find files that are imported by model files but whose functionality is never used (e.g. custom serialization code or training helpers). Use this function to mock this functionality out without having to modify the original code. Args: include (Union[List[str], str]): A string e.g. ``"my_package.my_subpackage"``, or list of strings for the names of the modules to be mocked out. Strings can also be a glob-style pattern string that may match multiple modules. Any required dependencies that match this pattern string will be mocked out automatically. Examples : ``'torch.**'`` -- matches ``torch`` and all submodules of torch, e.g. ``'torch.nn'`` and ``'torch.nn.functional'`` ``'torch.*'`` -- matches ``'torch.nn'`` or ``'torch.functional'``, but not ``'torch.nn.functional'`` exclude (Union[List[str], str]): An optional pattern that excludes some patterns that match the include string. e.g. ``include='torch.**', exclude='torch.foo'`` will mock all torch packages except ``'torch.foo'``, Default: is ``[]``. allow_empty (bool): An optional flag that specifies whether the mock implementation(s) specified by this call to the :meth:`mock` method must be matched to some module during packaging. If a mock is added with ``allow_empty=False``, and :meth:`close` is called (either explicitly or via ``__exit__``) and the mock has not been matched to a module used by the package being exported, an exception is thrown. If ``allow_empty=True``, no such exception is thrown. r