code: def delete_model(
      self, model_name: str, project_name: str = "mindsdb", version=None
  ):
      from mindsdb.interfaces.database.database import (
          DatabaseController,
      )
  
      project_record = db.Project.query.filter(
          (func.lower(db.Project.name) == func.lower(project_name))
          & (db.Project.company_id == ctx.company_id)
          & (db.Project.deleted_at == null())
      ).first()
      if project_record is None:
          raise Exception(f"Project '{project_name}' does not exists")
  
      database_controller = DatabaseController()
  
      project = database_controller.get_project(project_name)
  
      if version is None:
          # Delete latest version
          predictors_records = get_model_records(
              name=model_name,
              project_id=project.id,
              active=None,
          )
      else:
          predictors_records = get_model_records(
              name=model_name,
              project_id=project.id,
              version=version,
          )
      if len(predictors_records) == 0:
          raise EntityNotExistsError("Model does not exist", model_name)
  
      is_cloud = self.config.get("cloud", False)
      if is_cloud:
          for predictor_record in predictors_records:
              model_data = self.get_model_data(
                  predictor_record=predictor_record
              )
              if (
                  model_data.get("status") in ["generating", "training"]
                  and isinstance(model_data.get("created_at"), str)
                  is True
                  and (
                      dt.datetime.now()
                      - parse_datetime(model_data.get("created_at"))
                  )
                  < dt.timedelta(hours=1)
              ):
                  raise Exception(
                      "You are unable to delete models currently in progress, please wait before trying again"
                  )
  
      for predictor_record in predictors_records:
          if is_cloud:
              predictor_record.deleted_at = dt.datetime.now()
          else:
              db.session.delete(predictor_record)
      db.session.commit()
  
      # region delete storages
      if len(predictors_records) > 1:
          ctx_dump = ctx.dump()
          with ThreadPool(min(len(predictors_records), 100)) as pool:
              pool.starmap(
                  delete_model_storage,
                  [
                      (record.id, ctx_dump)
                      for record in predictors_records
                  ],
              )
      else:
          modelStorage = ModelStorage(predictors_records[0].id)
          modelStorage.delete()
  
imports: import sys
  import copy
  import datetime
  from copy import deepcopy
  from multiprocessing.pool import ThreadPool
  import pandas
  from dateutil.parser import parse
  from sqlalchemy import func, null
  import numpy
  import mindsdb.interfaces.storage.db
  from mindsdb.utilities.config import Config
  from mindsdb.interfaces.model.functions import get_model_record, get_model_records
  from mindsdb.interfaces.storage.json import get_json_storage
  from mindsdb.interfaces.storage.model_fs import ModelStorage
  from mindsdb.utilities.context import context
  from mindsdb.utilities.functions import resolve_model_identifier
  import mindsdb.utilities.profiler
  from mindsdb.utilities.exception import EntityExistsError, EntityNotExistsError
  from mindsdb.utilities import log
label_desc: Use image node_id 7 for calling the ModelController obj's underlying member method code with example usage: obj.delete_model(model_name, project_name, version) without return types