HaonanGuo / Remote-Sensing-ChatGPT

Chat with RS-ChatGPT and get the remote sensing interpretation results and the response!
215 stars 26 forks source link

Missing file './checkpoints/Res34_AID_best.pth' #2

Closed philosadelphos closed 9 months ago

philosadelphos commented 9 months ago

Hi HaonanGo Thank you so much for sharing your work. I'm bit rookie on this openai running scripts. So forgive me if I may be spamming around here. Not my intent. I was trying to run your code by executing python rs_chatgpt.py 'my opeanai key' as suggeste to me by chatGPT. But the errors I got led me to change (accordding chatgpt help) in file rs_chatgpt.pt the line 593 from: bot = RSChatGPT(gpt_name=args.gpt_name,load_dict=load_dict,openai_key=args.openai_key) to bot = RSChatGPT(gpt_name=args.gpt_name, load_dict=load_dict, openai_key=getattr(args, 'openai-key'))

and it run something with a subsequent error:

Initializing ImageCaptioning to cuda:0 preprocessor_config.json: 100%|████████████████████████████████████████████| 287/287 [00:00<00:00, 1.00MB/s] tokenizer_config.json: 100%|███████████████████████████████████████████████| 506/506 [00:00<00:00, 1.97MB/s] vocab.txt: 100%|█████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 1.85MB/s] tokenizer.json: 100%|████████████████████████████████████████████████████| 711k/711k [00:00<00:00, 1.90MB/s] special_tokens_map.json: 100%|██████████████████████████████████████████████| 125/125 [00:00<00:00, 529kB/s] config.json: 100%|█████████████████████████████████████████████████████| 4.56k/4.56k [00:00<00:00, 14.7MB/s] pytorch_model.bin: 100%|█████████████████████████████████████████████████| 990M/990M [01:26<00:00, 11.4MB/s] Initializing SceneClassification /home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.

Traceback (most recent call last): File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 594, in bot = RSChatGPT(gpt_name=args.gpt_name, load_dict=load_dict, openai_key=getattr(args, 'openai-key')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 506, in init self.models[class_name] = globals()class_name ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 209, in init trained = torch.load('./checkpoints/Res34_AID_best.pth') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 986, in load with _open_file_like(f, 'rb') as opened_file: ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 435, in _open_file_like return _open_file(name_or_buffer, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 416, in init super().init(open(name, mode)) ^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/Res34_AID_best.pth'

Then I thought it might be related to not tunning interface.py code, where I also had to change a similar line of code to parse my openai key: bot = RSChatGPT(load_dict=load_dict, openai_key=getattr(args, 'openai-key'))

and same type of error related to missing file: FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/Res34_AID_best.pth'

what I'm doing wrong, using the initial code as it is it didn't work, i got:

Traceback (most recent call last): File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/interface.py", line 600, in bot = RSChatGPT(load_dict=load_dict,openai_key=args.openai_key) ^^^^^^^^^^^^^^^ AttributeError: 'Namespace' object has no attribute 'openai_key'. Did you mean: 'openai-key'?

BOUTAYEBAnasse commented 9 months ago

hello, i have the same issue : FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/Res34_AID_best.pth'

gulabpatel commented 9 months ago

@BOUTAYEBAnasse , you need to create checkpoints folder and upload all the weights there, it would work

philosadelphos commented 9 months ago

Hi there, @gulabpatel thank you for replying. My current working directory:

/home/ibslab/PEDRO/Remote-Sensing-ChatGPT

And I've created the folder as you mentioned:

/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/checkpoints

But still I recieve the following error mentioning the missing file Res34_AID_best.pth (which may be related to opeaai key parsing or opeanai key per itself (is it needed a paid openai account? or a free openai account is enough?):

If I use the standard code for openai parsing, this is the error:

Traceback (most recent call last): File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 599, in bot = RSChatGPT(gpt_name=args.gpt_name,load_dict=load_dict,openai_key=args.openai_key) ^^^^^^^^^^^^^^^ AttributeError: 'Namespace' object has no attribute 'openai_key'. Did you mean: 'openai-key'?

If I correct the parsing from openai_key=args.openai_keyto openai_key=getattr(args, 'openai-key') as mentioned in opening statement, I get:

Initializing RSChatGPT, load_dict={'ImageCaptioning': 'cuda:0', 'SceneClassification': 'cuda:0', 'ObjectDetection': 'cuda:0', 'LandUseSegmentation': 'cuda:0', 'InstanceSegmentation': 'cuda:0', 'Image2Canny': 'cpu'} Initializing ImageCaptioning to cuda:0 Initializing SceneClassification /home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. warnings.warn( /home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None. warnings.warn(msg) Traceback (most recent call last): File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 600, in bot = RSChatGPT(gpt_name=args.gpt_name, load_dict=load_dict, openai_key=getattr(args, 'openai-key')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 512, in init self.models[class_name] = globals()class_name ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 215, in init trained = torch.load('./checkpoints/Res34_AID_best.pth') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 986, in load with _open_file_like(f, 'rb') as opened_file: ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 435, in _open_file_like return _open_file(name_or_buffer, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 416, in init super().init(open(name, mode)) ^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/Res34_AID_best.pth'

HaonanGuo commented 9 months ago

Hi HaonanGo Thank you so much for sharing your work. I'm bit rookie on this openai running scripts. So forgive me if I may be spamming around here. Not my intent. I was trying to run your code by executing python rs_chatgpt.py 'my opeanai key' as suggeste to me by chatGPT. But the errors I got led me to change (accordding chatgpt help) in file rs_chatgpt.pt the line 593 from: bot = RSChatGPT(gpt_name=args.gpt_name,load_dict=load_dict,openai_key=args.openai_key) to bot = RSChatGPT(gpt_name=args.gpt_name, load_dict=load_dict, openai_key=getattr(args, 'openai-key'))

and it run something with a subsequent error:

Initializing ImageCaptioning to cuda:0 preprocessor_config.json: 100%|████████████████████████████████████████████| 287/287 [00:00<00:00, 1.00MB/s] tokenizer_config.json: 100%|███████████████████████████████████████████████| 506/506 [00:00<00:00, 1.97MB/s] vocab.txt: 100%|█████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 1.85MB/s] tokenizer.json: 100%|████████████████████████████████████████████████████| 711k/711k [00:00<00:00, 1.90MB/s] special_tokens_map.json: 100%|██████████████████████████████████████████████| 125/125 [00:00<00:00, 529kB/s] config.json: 100%|█████████████████████████████████████████████████████| 4.56k/4.56k [00:00<00:00, 14.7MB/s] pytorch_model.bin: 100%|█████████████████████████████████████████████████| 990M/990M [01:26<00:00, 11.4MB/s] Initializing SceneClassification /home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. Traceback (most recent call last): File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 594, in bot = RSChatGPT(gpt_name=args.gpt_name, load_dict=load_dict, openai_key=getattr(args, 'openai-key')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 506, in init self.models[class_name] = globals()class_name ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/rs_chatgpt.py", line 209, in init trained = torch.load('./checkpoints/Res34_AID_best.pth') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 986, in load with _open_file_like(f, 'rb') as opened_file: ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 435, in _open_file_like return _open_file(name_or_buffer, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibslab/miniconda3/envs/RSChatGPT/lib/python3.11/site-packages/torch/serialization.py", line 416, in init super().init(open(name, mode)) ^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/Res34_AID_best.pth'

Then I thought it might be related to not tunning interface.py code, where I also had to change a similar line of code to parse my openai key: bot = RSChatGPT(load_dict=load_dict, openai_key=getattr(args, 'openai-key'))

and same type of error related to missing file: FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/Res34_AID_best.pth'

what I'm doing wrong, using the initial code as it is it didn't work, i got:

Traceback (most recent call last): File "/home/ibslab/PEDRO/Remote-Sensing-ChatGPT/interface.py", line 600, in bot = RSChatGPT(load_dict=load_dict,openai_key=args.openai_key) ^^^^^^^^^^^^^^^ AttributeError: 'Namespace' object has no attribute 'openai_key'. Did you mean: 'openai-key'?

Thanks for your attention to RS CHatGPT.We are sorry for the inconvenience brought by the unclear guidance. A checkpoints folder is necessary. We have thoroughly updated the whole project to increase readability. Looking forward to you further advice!