OFA-Sys / ONE-PEACE

A general representation model across vision, audio, language modalities. Paper: ONE-PEACE: Exploring One General Representation Model Toward Unlimited Modalities
Apache License 2.0
935 stars 57 forks source link

Regarding segmentation task #24

Closed alekhyaparimala closed 1 year ago

alekhyaparimala commented 1 year ago

Hi@simonJJJ I'm trying to inference the segmentation task of pretrained model using one-peace-vision.pkl with command python test.py /home/Documents/ONE-PEACE/one_peace_vision/seg/configs/ade20k/mask2former_onepeace_adapter_g_896_40k_ade20k_ss.py "/home/Downloads/one-peace-vision.pkl" --show I encountered the below error. What could be the correct way to inference ?

Traceback (most recent call last): File "/home/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 351, in main() File "/home/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 243, in main checkpoint = load_checkpoint(model, args.checkpoint, map_location='cpu') File "/home/.local/lib/python3.9/site-packages/mmcv/runner/checkpoint.py", line 581, in load_checkpoint checkpoint = _load_checkpoint(filename, map_location, logger) File "/home/.local/lib/python3.9/site-packages/mmcv/runner/checkpoint.py", line 520, in _load_checkpoint return CheckpointLoader.load_checkpoint(filename, map_location, logger) File "/home/.local/lib/python3.9/site-packages/mmcv/runner/checkpoint.py", line 285, in load_checkpoint return checkpoint_loader(filename, map_location) File "/home/.local/lib/python3.9/site-packages/mmcv/runner/checkpoint.py", line 302, in load_from_local checkpoint = torch.load(filename, map_location=map_location) File "/home/.local/lib/python3.9/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "/home/.local/lib/python3.9/site-packages/torch/serialization.py", line 1035, in _legacy_load raise RuntimeError("Invalid magic number; corrupt file?") RuntimeError: Invalid magic number; corrupt file?

I also checked with

python test.py --cfg-options model.pretrained="/home/Downloads/one-peace-vision.pkl" /home/Documents/ONE-PEACE/one_peace_vision/seg/configs/ade20k/mask2former_onepeace_adapter_g_896_40k_ade20k_ss.py --show

but getting error as Traceback (most recent call last): File "/home/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 351, in main() File "/home/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 123, in main args = parse_args() File "/home/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 105, in parse_args args = parser.parse_args() File "/home/.conda/envs/onepeace/lib/python3.9/argparse.py", line 1825, in parse_args args, argv = self.parse_known_args(args, namespace) File "/home/.conda/envs/onepeace/lib/python3.9/argparse.py", line 1858, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/home/.conda/envs/onepeace/lib/python3.9/argparse.py", line 2067, in _parse_known_args start_index = consume_optional(start_index) File "/home/.conda/envs/onepeace/lib/python3.9/argparse.py", line 2007, in consume_optional take_action(action, args, option_string) File "/home/.conda/envs/onepeace/lib/python3.9/argparse.py", line 1935, in take_action action(self, namespace, argument_values, option_string) File "/home/.local/lib/python3.9/site-packages/mmcv/utils/config.py", line 711, in call key, val = kv.split('=', maxsplit=1) ValueError: not enough values to unpack (expected 2, got 1)

simonJJJ commented 1 year ago

Hi @alekhyaparimala, you should use this checkpoint for inference. And one-peace-vision.pkl is for fine-tuning.

alekhyaparimala commented 1 year ago

Hi @alekhyaparimala, you should use this checkpoint for inference. And one-peace-vision.pkl is for fine-tuning.

Thanks, but when I used this checkpoint file, i'm getting error as /home/T7724A1/Documents/ONE-PEACE/one_peace_vision/seg/test.py:299: UserWarning: SyncBN is only supported with DDP. To be compatible with DP, we convert SyncBN to BN. Please use dist_train.sh which can avoid this error. warnings.warn( Traceback (most recent call last): File "/home/T7724A1/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 358, in main() File "/home/T7724A1/Documents/ONE-PEACE/one_peace_vision/seg/test.py", line 309, in main model = build_dp(model, cfg.device, device_ids=cfg.gpu_ids) File "/home/T7724A1/.local/lib/python3.9/site-packages/mmseg/utils/util_distribution.py", line 28, in build_dp model = model.cuda() File "/home/T7724A1/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 905, in cuda return self._apply(lambda t: t.cuda(device)) File "/home/T7724A1/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) File "/home/T7724A1/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) File "/home/T7724A1/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 797, in _apply module._apply(fn) [Previous line repeated 1 more time] File "/home/T7724A1/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 844, in _apply self._buffers[key] = fn(buf) File "/home/T7724A1/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 905, in return self._apply(lambda t: t.cuda(device)) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 76.00 MiB (GPU 0; 3.81 GiB total capacity; 2.99 GiB already allocated; 30.88 MiB free; 3.03 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF I checked with clearing the cuda cache, still same issue

simonJJJ commented 1 year ago

@alekhyaparimala Your GPU memory seems lower than the inference requirement. I suggest using alibaba cloud GPU service or google colab for inference.

alekhyaparimala commented 1 year ago

@alekhyaparimala Your GPU memory seems lower than the inference requirement. I suggest using alibaba cloud GPU service or google colab for inference.

Sure, can I use cpu instead?

simonJJJ commented 1 year ago

@alekhyaparimala Sorry, we do not support cpu inference now.