code: def _load_model(model_file: str):
      if os.path.isdir(model_file):
          path = Path(model_file)
          module_file = path / "module.py"
          with open(module_file, "r") as f:
              module_str = f.read()
          exec(module_str, globals())
          model = eval("NebullvmFxModule")()
          model.load_state_dict(torch.load(path / "state_dict.pt"))
      else:
          model = torch.load(model_file)
      return model
  
imports: import json
  import logging
  import os.path
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Tuple, List, Any, Dict
  import torch
  from sparseml.onnx.optim import ModelAnalyzer, pruning_loss_sens_magnitude
  from sparseml.pytorch.optim import ScheduledModifierManager
  from sparseml.pytorch.sparsification import EpochRangeModifier, GMPruningModifier
  from sparseml.pytorch.utils import ModuleExporter
  from sparsify.blueprints.utils import default_epochs_distribution, PruningModelEvaluator, default_pruning_settings
  from sparsify.schemas import ProjectModelAnalysisSchema
  from torch.nn import CrossEntropyLoss, MSELoss
  from torch.optim import SGD
  from tqdm.auto import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: _load_model(model_file) and returns: model