Open sepplu opened 1 year ago
不懂编程,是影视行业从业者,对这个模型实现的功能很感兴趣,希望工作中能用上这个模型,请高手指导
Thanks for your interest. We haven't tested it on Mac. We recommend you use an NVIDIA device for testing this model. Please check our latest commit, we move the checkpoint stored in the CPU.
me too
You can set --device mps and revise app.py file change args.device = "mps" not "cuda:3"
You can set --device mps and revise app.py file change args.device = "mps" not "cuda:3"
I did as you suggested, but it did not work. Could you please share more info? Thanks a lot
I've tried, but encountered a problem with mmcv
, and after following their installation guide in which they recommend to download torch==1.13
I've tried to run app.py
in here but there was a torch problem. So I've reverted to run it on a linux
based machine...
I've managed to make it work for Mac!
Stuff I've added:
(on the same terminal window before running python.py)
export PYTORCH_ENABLE_MPS_FALLBACK=1
In tracker/config/config.yaml
I've changed:
...
num_prototypes: 16
top_k: 16
...
In app.py
:
...
args.device = "mps"
...
运行情况:(supple) sepplu@seppdeMac-Studio Track-Anything % python3 app.py --device cpu Defaulting to user installation because normal site-packages is not writeable Looking in links: https://download.openmmlab.com/mmcv/dist/cpu/torch2.0.0/index.html Requirement already satisfied: mmcv in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (2.0.0) Requirement already satisfied: addict in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (2.4.0) Requirement already satisfied: mmengine>=0.2.0 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (0.7.3) Requirement already satisfied: numpy in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (1.24.3) Requirement already satisfied: packaging in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (23.1) Requirement already satisfied: Pillow in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (9.5.0) Requirement already satisfied: pyyaml in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (6.0) Requirement already satisfied: yapf in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmcv) (0.33.0) Requirement already satisfied: matplotlib in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmengine>=0.2.0->mmcv) (3.7.1) Requirement already satisfied: rich in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmengine>=0.2.0->mmcv) (13.3.5) Requirement already satisfied: termcolor in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmengine>=0.2.0->mmcv) (2.3.0) Requirement already satisfied: opencv-python>=3 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from mmengine>=0.2.0->mmcv) (4.7.0.72) Requirement already satisfied: tomli>=2.0.1 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from yapf->mmcv) (2.0.1) Requirement already satisfied: contourpy>=1.0.1 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (1.0.7) Requirement already satisfied: cycler>=0.10 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (4.39.3) Requirement already satisfied: kiwisolver>=1.0.1 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (1.4.4) Requirement already satisfied: pyparsing>=2.3.1 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (3.0.9) Requirement already satisfied: python-dateutil>=2.7 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (2.8.2) Requirement already satisfied: importlib-resources>=3.2.0 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from matplotlib->mmengine>=0.2.0->mmcv) (5.12.0) Requirement already satisfied: markdown-it-py<3.0.0,>=2.2.0 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from rich->mmengine>=0.2.0->mmcv) (2.2.0) Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from rich->mmengine>=0.2.0->mmcv) (2.15.1) Requirement already satisfied: zipp>=3.1.0 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from importlib-resources>=3.2.0->matplotlib->mmengine>=0.2.0->mmcv) (3.15.0) Requirement already satisfied: mdurl~=0.1 in /Users/sepplu/Library/Python/3.9/lib/python/site-packages (from markdown-it-py<3.0.0,>=2.2.0->rich->mmengine>=0.2.0->mmcv) (0.1.2) Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->mmengine>=0.2.0->mmcv) (1.15.0) Initializing BaseSegmenter to cpu Traceback (most recent call last): File "/Users/sepplu/Track-Anything/app.py", line 383, in
model = TrackingAnything(SAM_checkpoint, xmem_checkpoint, e2fgvi_checkpoint,args)
File "/Users/sepplu/Track-Anything/track_anything.py", line 19, in init
self.xmem = BaseTracker(self.xmem_checkpoint, device=args.device)
File "/Users/sepplu/Track-Anything/tracker/base_tracker.py", line 32, in init
network = XMem(config, xmem_checkpoint).to(device).eval()
File "/Users/sepplu/Track-Anything/tracker/model/network.py", line 24, in init
model_weights = self.init_hyperparameters(config, model_path, map_location)
File "/Users/sepplu/Track-Anything/tracker/model/network.py", line 145, in init_hyperparameters
model_weights = torch.load(model_path, map_location=map_location)
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 809, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 1172, in _load
result = unpickler.load()
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 1142, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 1116, in load_tensor
wrap_storage=restore_location(storage, location),
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 217, in default_restore_location
result = fn(storage, location)
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 182, in _cuda_deserialize
device = validate_cuda_device(location)
File "/Users/sepplu/miniconda3/envs/supple/lib/python3.10/site-packages/torch/serialization.py", line 166, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on a CUDA '
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.