visual-chatgpt icon indicating copy to clipboard operation
visual-chatgpt copied to clipboard

RuntimeError: Error when calling Cognitive Face API

Open HeshamFS opened this issue 3 years ago • 6 comments

I am getting an error(s) durin Runtime:

1- eprint(line:60) :: Error when calling Cognitive Face API:message: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.

2- ModuleNotFoundError: No module named 'ldm.util'; 'ldm' is not a package

I did follow the instructions and install all the requirments.

The output of the RuntimeError is:

(visgpt) d:\visual-chatgpt>python visual_chatgpt.py [2023-03-09 15:02:06] visual_chatgpt.py - - - - - - - - - - - - - - - - - - - - - eprint(line:60) :: Error when calling Cognitive Face API: status_code: 401 code: 401 message: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.

[2023-03-09 15:02:06] visual_chatgpt.py - - - - - - - - - - - - - - - - - - - - - eprint(line:60) :: img_url:https://raw.githubusercontent.com/Microsoft/Cognitive-Face-Windows/master/Data/detection1.jpg [2023-03-09 15:02:06] visual_chatgpt.py - - - - - - - - - - - - - - - - - - - - - eprint(line:60) :: Error when calling Cognitive Face API: status_code: 401 code: 401 message: Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.

[2023-03-09 15:02:06] visual_chatgpt.py - - - - - - - - - - - - - - - - - - - - - eprint(line:60) :: img_url:/data1/mingmingzhao/label/data_sets_teacher_1w/47017613_1510574400_out-video-jzc70f41fa6f7145b4b66738f81f082b65_f_1510574403268_t_1510575931221.flv_0001.jpg [] ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ d:\visual-chatgpt\visual_chatgpt.py:26 in │ │ │ │ 23 import einops │ │ 24 from pytorch_lightning import seed_everything │ │ 25 import random │ │ ❱ 26 from ldm.util import instantiate_from_config │ │ 27 from ControlNet.cldm.model import create_model, load_state_dict │ │ 28 from ControlNet.cldm.ddim_hacked import DDIMSampler │ │ 29 from ControlNet.annotator.canny import CannyDetector │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ModuleNotFoundError: No module named 'ldm.util'; 'ldm' is not a package

HeshamFS avatar Mar 09 '23 14:03 HeshamFS

Hi, have you followed our download.sh and requirement.txt to implement our code?

ZetangForward avatar Mar 09 '23 14:03 ZetangForward

Yes I did follow the readme steps

HeshamFS avatar Mar 09 '23 14:03 HeshamFS

Yes I did follow the readme steps

In your download.sh, making sure you have run the following code:

git clone https://github.com/lllyasviel/ControlNet.git
ln -s ControlNet/ldm ./ldm

You can :

  1. First check whether there existing ControlNet/ldm under the ControlNet folder;
  2. Make sure your code execution path is correct that ./ldm and visual_chatgpt.py should at the same level under the same directory.

ZetangForward avatar Mar 09 '23 15:03 ZetangForward

Yes it works now, But my "NVIDIA RTX A4000 Laptop GPU" is not compatible with the current PyTorch installation.

Can I overcome this?

HeshamFS avatar Mar 09 '23 16:03 HeshamFS

According to requirements.txt:

torch==1.12.1 torchvision==0.13.1

See: https://pytorch.org/get-started/previous-versions/

e.g.: conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch

Also, albeit a different issue, this repo does NOT like to find a mmcv-full / mmcv in the environment; it wants to use the module from the repo, which only happens if there is no mmvc-full / mmvc present (drop / uninstall that, if somehow present - might be a good idea to try this for anything you may find, albeit your previous issue was just a folder (or init_py) not present. It took me ages to figure out until I realize that "module.something.whatever" just basically means looking in a folder called /module/something/whatever.py, lol,so I'm just gonna add this here).

b2zer avatar Mar 09 '23 20:03 b2zer

Yes I did follow the readme steps

In your download.sh, making sure you have run the following code:

git clone https://github.com/lllyasviel/ControlNet.git
ln -s ControlNet/ldm ./ldm

You can :

  1. First check whether there existing ControlNet/ldm under the ControlNet folder;
  2. Make sure your code execution path is correct that ./ldm and visual_chatgpt.py should at the same level under the same directory.

Hi, I tried this but I'm still having the same error. Any idea why is that happening? Thanks

videscar avatar Mar 10 '23 09:03 videscar

Please try the updated version to see whether it helps.

chenfei-wu avatar Mar 14 '23 03:03 chenfei-wu