ocean-data-factory-sweden / kso

Notebooks to upload/download marine footage, connect to a citizen science project, train machine learning models and publish marine biological observations.
GNU General Public License v3.0
4 stars 12 forks source link

Alvis Notebook 8 issue with connecting to wandb, probably also present in the rest #368

Closed Bergylta closed 4 months ago

Bergylta commented 4 months ago

πŸ› Bug

Seems to be a issue with initiating the mlp

To Reproduce (REQUIRED)

Input:

# Initialise mlp
mlp = MLProjectProcessor(pp)

Output:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[13], line 2
      1 # Initialise mlp
----> 2 mlp = MLProjectProcessor(pp)

File /usr/src/app/kso-dev/kso_utils/project.py:1277, in MLProjectProcessor.__init__(self, project_process, config_path, weights_path, output_path, classes, test)
   1274 self.modules = g_utils.import_modules([])
   1275 self.modules.update(g_utils.import_modules(["yolo_utils"], utils=True))
   1276 self.modules.update(
-> 1277     g_utils.import_modules(
   1278         ["wandb", "yaml", "ultralytics"],
   1279         utils=False,
   1280     )
   1281 )
   1282 # Import model models for backwards compatibility
   1283 if self.registry == "wandb":

File /usr/src/app/kso-dev/kso_utils/general.py:60, in import_modules(module_names, utils, models)
     58     if models:
     59         module_name = model_presets[i]
---> 60     modules[module_name] = importlib.import_module(module_full)
     61 except ModuleNotFoundError:
     62     logging.error(f"Module {module_name} could not be imported.")

File /usr/lib/python3.8/importlib/__init__.py:127, in import_module(name, package)
    125             break
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1014, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:991, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:975, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:671, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:848, in exec_module(self, module)

File <frozen importlib._bootstrap>:219, in _call_with_frames_removed(f, *args, **kwds)

File /usr/local/lib/python3.8/dist-packages/ultralytics/__init__.py:5
      1 # Ultralytics YOLO πŸš€, AGPL-3.0 license
      3 __version__ = '8.0.200'
----> 5 from ultralytics.models import RTDETR, SAM, YOLO
      6 from ultralytics.models.fastsam import FastSAM
      7 from ultralytics.models.nas import NAS

File /usr/local/lib/python3.8/dist-packages/ultralytics/models/__init__.py:3
      1 # Ultralytics YOLO πŸš€, AGPL-3.0 license
----> 3 from .rtdetr import RTDETR
      4 from .sam import SAM
      5 from .yolo import YOLO

File /usr/local/lib/python3.8/dist-packages/ultralytics/models/rtdetr/__init__.py:3
      1 # Ultralytics YOLO πŸš€, AGPL-3.0 license
----> 3 from .model import RTDETR
      4 from .predict import RTDETRPredictor
      5 from .val import RTDETRValidator

File /usr/local/lib/python3.8/dist-packages/ultralytics/models/rtdetr/model.py:10
      1 # Ultralytics YOLO πŸš€, AGPL-3.0 license
      2 """
      3 Interface for Baidu's RT-DETR, a Vision Transformer-based real-time object detector. RT-DETR offers real-time
      4 performance and high accuracy, excelling in accelerated backends like CUDA with TensorRT. It features an efficient
   (...)
      7 For more information on RT-DETR, visit: https://arxiv.org/pdf/2304.08069.pdf
      8 """
---> 10 from ultralytics.engine.model import Model
     11 from ultralytics.nn.tasks import RTDETRDetectionModel
     13 from .predict import RTDETRPredictor

File /usr/local/lib/python3.8/dist-packages/ultralytics/engine/model.py:8
      5 from pathlib import Path
      6 from typing import Union
----> 8 from ultralytics.cfg import TASK2DATA, get_cfg, get_save_dir
      9 from ultralytics.hub.utils import HUB_WEB_ROOT
     10 from ultralytics.nn.tasks import attempt_load_one_weight, guess_model_task, nn, yaml_model_load

File /usr/local/lib/python3.8/dist-packages/ultralytics/cfg/__init__.py:10
      7 from types import SimpleNamespace
      8 from typing import Dict, List, Union
---> 10 from ultralytics.utils import (ASSETS, DEFAULT_CFG, DEFAULT_CFG_DICT, DEFAULT_CFG_PATH, LOGGER, RANK, ROOT, RUNS_DIR,
     11                                SETTINGS, SETTINGS_YAML, TESTS_RUNNING, IterableSimpleNamespace, __version__, checks,
     12                                colorstr, deprecation_warn, yaml_load, yaml_print)
     14 # Define valid tasks and modes
     15 MODES = 'train', 'val', 'predict', 'export', 'track', 'benchmark'

File /usr/local/lib/python3.8/dist-packages/ultralytics/utils/__init__.py:21
     19 import matplotlib.pyplot as plt
     20 import numpy as np
---> 21 import torch
     22 import yaml
     23 from tqdm import tqdm as tqdm_original

File /usr/local/lib/python3.8/dist-packages/torch/__init__.py:234
    223 else:
    224     # Easy way.  You want this most of the time, because it will prevent
    225     # C++ symbols from libtorch clobbering C++ symbols from other
   (...)
    231     #
    232     # See Note [Global dependencies]
    233     if USE_GLOBAL_DEPS:
--> 234         _load_global_deps()
    235     from torch._C import *  # noqa: F403
    237 # Appease the type checker; ordinarily this binding is inserted by the
    238 # torch._C module initialization code in C

File /usr/local/lib/python3.8/dist-packages/torch/__init__.py:193, in _load_global_deps()
    191 is_cuda_lib_err = [lib for lib in cuda_libs.values() if(lib.split('.')[0] in err.args[0])]
    192 if not is_cuda_lib_err:
--> 193     raise err
    194 for lib_folder, lib_name in cuda_libs.items():
    195     _preload_cuda_deps(lib_folder, lib_name)

File /usr/local/lib/python3.8/dist-packages/torch/__init__.py:174, in _load_global_deps()
    171 lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
    173 try:
--> 174     ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
    175 except OSError as err:
    176     # Can only happen for wheel with cuda libs as PYPI deps
    177     # As PyTorch is not purelib, but nvidia-*-cu12 is
    178     cuda_libs: Dict[str, str] = {
    179         'cublas': 'libcublas.so.*[0-9]',
    180         'cudnn': 'libcudnn.so.*[0-9]',
   (...)
    189         'nvtx': 'libnvToolsExt.so.*[0-9]',
    190     }

File /usr/lib/python3.8/ctypes/__init__.py:373, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    370 self._FuncPtr = _FuncPtr
    372 if handle is None:
--> 373     self._handle = _dlopen(self._name, mode)
    374 else:
    375     self._handle = handle

OSError: /usr/local/lib/python3.8/dist-packages/torch/lib/libtorch_global_deps.dylib: cannot open shared object file: No such file or directory

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

jannesgg commented 4 months ago

Solved. Issue was leftover from other fix.