diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..e915c3a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +recursive-include ultralytics *.yaml +recursive-include ultralytics *.txt +recursive-include ultralytics *.json diff --git a/requirements.txt b/requirements.txt index b40e8ff..576db96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,9 +11,10 @@ tqdm>=4.64.0 pandas>=1.1.4 seaborn>=0.11.0 - +psutil == 7.1.3 gradio==3.35.2 # Ultralytics----------------------------------- # ultralytics == 8.0.120 + diff --git a/setup.py b/setup.py index 70c4bbb..752aa78 100644 --- a/setup.py +++ b/setup.py @@ -12,10 +12,16 @@ name="fastsam", version="0.1.1", install_requires=REQUIREMENTS, - packages=["fastsam", "fastsam_tools"], - package_dir= { - "fastsam": "fastsam", - "fastsam_tools": "utils", - }, - url="https://github.com/CASIA-IVA-Lab/FastSAM" + packages=find_packages( + where='.', + include=[ + 'fastsam', # include only top-level fastsam + 'utils', # include only top-level utils + 'ultralytics*', # include ultralytics and all its subpackages + ], + ), + url="https://github.com/CASIA-IVA-Lab/FastSAM", + include_package_data=True, + package_data={'ultralytics': ['**/*.yaml', '**/*.txt', '**/*.json']} + ) diff --git a/ultralytics/nn/tasks.py b/ultralytics/nn/tasks.py index 3c2ba06..debcc80 100644 --- a/ultralytics/nn/tasks.py +++ b/ultralytics/nn/tasks.py @@ -515,7 +515,7 @@ def torch_safe_load(weight): check_suffix(file=weight, suffix='.pt') file = attempt_download_asset(weight) # search online if missing locally try: - return torch.load(file, map_location='cpu'), file # load + return torch.load(file, map_location='cpu', weights_only=False), file # load except ModuleNotFoundError as e: # e.name is missing module name if e.name == 'models': raise TypeError( @@ -530,7 +530,7 @@ def torch_safe_load(weight): f"run a command with an official YOLOv8 model, i.e. 'yolo predict model=yolov8n.pt'") check_requirements(e.name) # install missing module - return torch.load(file, map_location='cpu'), file # load + return torch.load(file, map_location='cpu', weights_only=False), file # load def attempt_load_weights(weights, device=None, inplace=True, fuse=False):