MiniGPT-4 icon indicating copy to clipboard operation
MiniGPT-4 copied to clipboard

error when launching demo.py

Open Linuxuser1234 opened this issue 2 years ago • 12 comments

trying to run minigpt-4 demo.py but when i run >python demo.py --cfg-path eval_configs/minigpt4_eval.yaml --gpu-id 0 i get this error (minigpt4) C:\Users\---\MiniGPT-4>python demo.py --cfg-path eval_configs/minigpt4_eval.yaml --gpu-id 0 Initializing Chat Loading VIT 100%|█████████████████████████████████████████████████████████████████████████████| 1.89G/1.89G [02:10<00:00, 15.5MB/s] Loading VIT Done Loading Q-Former 100%|███████████████████████████████████████████████████████████████████████████████| 413M/413M [00:31<00:00, 13.8MB/s] Loading Q-Former Done Loading LLAMA Traceback (most recent call last): File "C:\Users\----\MiniGPT-4\demo.py", line 60, in <module> model = model_cls.from_config(model_config).to('cuda:{}'.format(args.gpu_id)) File "C:\Users\---\MiniGPT-4\minigpt4\models\mini_gpt4.py", line 243, in from_config model = cls( File "C:\Users\---\MiniGPT-4\minigpt4\models\mini_gpt4.py", line 86, in __init__ self.llama_tokenizer = LlamaTokenizer.from_pretrained(llama_model, use_fast=False) File "D:\Anaconda\envs\minigpt4\lib\site-packages\transformers\tokenization_utils_base.py", line 1770, in from_pretrained resolved_vocab_files[file_id] = cached_file( File "D:\Anaconda\envs\minigpt4\lib\site-packages\transformers\utils\hub.py", line 409, in cached_file resolved_file = hf_hub_download( File "D:\Anaconda\envs\minigpt4\lib\site-packages\huggingface_hub\utils\_validators.py", line 112, in _inner_fn validate_repo_id(arg_value) File "D:\Anaconda\envs\minigpt4\lib\site-packages\huggingface_hub\utils\_validators.py", line 160, in validate_repo_id raise HFValidationError( huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/path/to/vicuna/weights/'. Use repo_type argument if needed.

Linuxuser1234 avatar Apr 20 '23 18:04 Linuxuser1234

Hello! It looks like you don't set the vicuna weight. You can set it following the instruction in Readme. Thanks!

TsuTikgiau avatar Apr 20 '23 19:04 TsuTikgiau

Sorry to bother you, I have encountered the same problem as you and have set up various files according to the process. May I ask if your problem has been resolved now

LLLYF avatar Apr 21 '23 08:04 LLLYF

I did everything listed on the page I think? Maybe I didn't set up the weights...

I don't think I'm even as far as this. L:\minigpt\MiniGPT-4>python demo.py --cfg-path eval_configs/minigpt4_eval.yaml --gpu-id 0 Traceback (most recent call last): File "L:\minigpt\MiniGPT-4\demo.py", line 10, in from minigpt4.common.config import Config File "L:\minigpt\MiniGPT-4\minigpt4_init_.py", line 11, in from omegaconf import OmegaConf ModuleNotFoundError: No module named 'omegaconf'

Do I need to set the path different or something...

chimera15 avatar Apr 21 '23 09:04 chimera15

我认为我做了页面上列出的所有内容?也许我没有设置重量...

我认为我什至没有这么远。 L:\minigpt\MiniGPT-4>python demo.py --cfg-path eval_configs/minigpt4_eval.yaml --gpu-id 0 回溯(最近最后一次调用):文件 “L:\minigpt\MiniGPT-4\demo.py”,第 10 行,来自 minigpt4.common.config 导入配置文件“L:\minigpt\MiniGPT-4\minigpt4__init__.py”,第 11 行,来自 omegaconf import OmegaConf ModuleNotFoundError:没有名为“omegaconf”的模块

我需要设置不同的路径吗?

When I met these problems just like "NO Module name...", I just used pip install the module which it needed.

LLLYF avatar Apr 21 '23 09:04 LLLYF

Hmm,

pip install git+https://github.com/lm-sys/[email protected] ?

i think i did that...is there another one I have to do?

Maybe I did it in a different directory. Nope, I ran it in the same directory I'm trying to launch from...just got a lot of "requirements met"....

Oh so you mean pip install omegaconf?

chimera15 avatar Apr 21 '23 09:04 chimera15

Hmm,

pip install git+https://github.com/lm-sys/[email protected] ?

i think i did that...is there another one I have to do?

emm, I just excute pip install xxx when this kind of bug appeared, It means that add the module. Don't afraid of this, if anything run error, just uninstall them.

LLLYF avatar Apr 21 '23 09:04 LLLYF

Ok I did that...now I'm at. python demo.py --cfg-path eval_configs/minigpt4_eval.yaml --gpu-id 0 Initializing Chat ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ L:\minigpt\MiniGPT-4\demo.py:55 in │ │ │ │ 52 │ │ 53 print('Initializing Chat') │ │ 54 args = parse_args() │ │ ❱ 55 cfg = Config(args) │ │ 56 │ │ 57 model_config = cfg.model_cfg │ │ 58 model_config.device_8bit = args.gpu_id │ │ │ │ L:\minigpt\MiniGPT-4\minigpt4\common\config.py:30 in init │ │ │ │ 27 │ │ config = OmegaConf.load(self.args.cfg_path) │ │ 28 │ │ │ │ 29 │ │ runner_config = self.build_runner_config(config) │ │ ❱ 30 │ │ model_config = self.build_model_config(config, **user_config) │ │ 31 │ │ dataset_config = self.build_dataset_config(config) │ │ 32 │ │ │ │ 33 │ │ # Validate the user-provided runner configuration │ │ │ │ L:\minigpt\MiniGPT-4\minigpt4\common\config.py:77 in build_model_config │ │ │ │ 74 │ │ # hierarchy override, customized config > default config │ │ 75 │ │ model_config = OmegaConf.merge( │ │ 76 │ │ │ model_config, │ │ ❱ 77 │ │ │ OmegaConf.load(model_config_path), │ │ 78 │ │ │ {"model": config["model"]}, │ │ 79 │ │ ) │ │ 80 │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\omegaconf\omegaconf.py: │ │ 190 in load │ │ │ │ 187 │ │ │ │ 188 │ │ if isinstance(file_, (str, pathlib.Path)): │ │ 189 │ │ │ with io.open(os.path.abspath(file_), "r", encoding="utf-8") as f: │ │ ❱ 190 │ │ │ │ obj = yaml.load(f, Loader=get_yaml_loader()) │ │ 191 │ │ elif getattr(file_, "read", None): │ │ 192 │ │ │ obj = yaml.load(file_, Loader=get_yaml_loader()) │ │ 193 │ │ else: │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml_init_.py:81 in │ │ load │ │ │ │ 78 │ """ │ │ 79 │ loader = Loader(stream) │ │ 80 │ try: │ │ ❱ 81 │ │ return loader.get_single_data() │ │ 82 │ finally: │ │ 83 │ │ loader.dispose() │ │ 84 │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\constructor.py:49 │ │ in get_single_data │ │ │ │ 46 │ │ │ 47 │ def get_single_data(self): │ │ 48 │ │ # Ensure that the stream contains a single document and construct it. │ │ ❱ 49 │ │ node = self.get_single_node() │ │ 50 │ │ if node is not None: │ │ 51 │ │ │ return self.construct_document(node) │ │ 52 │ │ return None │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:36 in │ │ get_single_node │ │ │ │ 33 │ │ # Compose a document if the stream is not empty. │ │ 34 │ │ document = None │ │ 35 │ │ if not self.check_event(StreamEndEvent): │ │ ❱ 36 │ │ │ document = self.compose_document() │ │ 37 │ │ │ │ 38 │ │ # Ensure that the stream contains no more documents. │ │ 39 │ │ if not self.check_event(StreamEndEvent): │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:55 in │ │ compose_document │ │ │ │ 52 │ │ self.get_event() │ │ 53 │ │ │ │ 54 │ │ # Compose the root node. │ │ ❱ 55 │ │ node = self.compose_node(None, None) │ │ 56 │ │ │ │ 57 │ │ # Drop the DOCUMENT-END event. │ │ 58 │ │ self.get_event() │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:84 in │ │ compose_node │ │ │ │ 81 │ │ elif self.check_event(SequenceStartEvent): │ │ 82 │ │ │ node = self.compose_sequence_node(anchor) │ │ 83 │ │ elif self.check_event(MappingStartEvent): │ │ ❱ 84 │ │ │ node = self.compose_mapping_node(anchor) │ │ 85 │ │ self.ascend_resolver() │ │ 86 │ │ return node │ │ 87 │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:133 in │ │ compose_mapping_node │ │ │ │ 130 │ │ │ #if item_key in node.value: │ │ 131 │ │ │ # raise ComposerError("while composing a mapping", start_event.start_mark │ │ 132 │ │ │ # "found duplicate key", key_event.start_mark) │ │ ❱ 133 │ │ │ item_value = self.compose_node(node, item_key) │ │ 134 │ │ │ #node.value[item_key] = item_value │ │ 135 │ │ │ node.value.append((item_key, item_value)) │ │ 136 │ │ end_event = self.get_event() │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:84 in │ │ compose_node │ │ │ │ 81 │ │ elif self.check_event(SequenceStartEvent): │ │ 82 │ │ │ node = self.compose_sequence_node(anchor) │ │ 83 │ │ elif self.check_event(MappingStartEvent): │ │ ❱ 84 │ │ │ node = self.compose_mapping_node(anchor) │ │ 85 │ │ self.ascend_resolver() │ │ 86 │ │ return node │ │ 87 │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:133 in │ │ compose_mapping_node │ │ │ │ 130 │ │ │ #if item_key in node.value: │ │ 131 │ │ │ # raise ComposerError("while composing a mapping", start_event.start_mark │ │ 132 │ │ │ # "found duplicate key", key_event.start_mark) │ │ ❱ 133 │ │ │ item_value = self.compose_node(node, item_key) │ │ 134 │ │ │ #node.value[item_key] = item_value │ │ 135 │ │ │ node.value.append((item_key, item_value)) │ │ 136 │ │ end_event = self.get_event() │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\composer.py:64 in │ │ compose_node │ │ │ │ 61 │ │ return node │ │ 62 │ │ │ 63 │ def compose_node(self, parent, index): │ │ ❱ 64 │ │ if self.check_event(AliasEvent): │ │ 65 │ │ │ event = self.get_event() │ │ 66 │ │ │ anchor = event.anchor │ │ 67 │ │ │ if anchor not in self.anchors: │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\parser.py:98 in │ │ check_event │ │ │ │ 95 │ │ # Check the type of the next event. │ │ 96 │ │ if self.current_event is None: │ │ 97 │ │ │ if self.state: │ │ ❱ 98 │ │ │ │ self.current_event = self.state() │ │ 99 │ │ if self.current_event is not None: │ │ 100 │ │ │ if not choices: │ │ 101 │ │ │ │ return True │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\parser.py:449 in │ │ parse_block_mapping_value │ │ │ │ 446 │ def parse_block_mapping_value(self): │ │ 447 │ │ if self.check_token(ValueToken): │ │ 448 │ │ │ token = self.get_token() │ │ ❱ 449 │ │ │ if not self.check_token(KeyToken, ValueToken, BlockEndToken): │ │ 450 │ │ │ │ self.states.append(self.parse_block_mapping_key) │ │ 451 │ │ │ │ return self.parse_block_node_or_indentless_sequence() │ │ 452 │ │ │ else: │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\scanner.py:116 in │ │ check_token │ │ │ │ 113 │ def check_token(self, *choices): │ │ 114 │ │ # Check if the next token is one of the given types. │ │ 115 │ │ while self.need_more_tokens(): │ │ ❱ 116 │ │ │ self.fetch_more_tokens() │ │ 117 │ │ if self.tokens: │ │ 118 │ │ │ if not choices: │ │ 119 │ │ │ │ return True │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\scanner.py:251 in │ │ fetch_more_tokens │ │ │ │ 248 │ │ │ │ 249 │ │ # Is it a double quoted scalar? │ │ 250 │ │ if ch == '"': │ │ ❱ 251 │ │ │ return self.fetch_double() │ │ 252 │ │ │ │ 253 │ │ # It must be a plain scalar then. │ │ 254 │ │ if self.check_plain(): │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\scanner.py:655 in │ │ fetch_double │ │ │ │ 652 │ │ self.fetch_flow_scalar(style=''') │ │ 653 │ │ │ 654 │ def fetch_double(self): │ │ ❱ 655 │ │ self.fetch_flow_scalar(style='"') │ │ 656 │ │ │ 657 │ def fetch_flow_scalar(self, style): │ │ 658 │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\scanner.py:666 in │ │ fetch_flow_scalar │ │ │ │ 663 │ │ self.allow_simple_key = False │ │ 664 │ │ │ │ 665 │ │ # Scan and add SCALAR. │ │ ❱ 666 │ │ self.tokens.append(self.scan_flow_scalar(style)) │ │ 667 │ │ │ 668 │ def fetch_plain(self): │ │ 669 │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\scanner.py:1149 in │ │ scan_flow_scalar │ │ │ │ 1146 │ │ start_mark = self.get_mark() │ │ 1147 │ │ quote = self.peek() │ │ 1148 │ │ self.forward() │ │ ❱ 1149 │ │ chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) │ │ 1150 │ │ while self.peek() != quote: │ │ 1151 │ │ │ chunks.extend(self.scan_flow_scalar_spaces(double, start_mark)) │ │ 1152 │ │ │ chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) │ │ │ │ C:\Users\lrdce\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\scanner.py:1223 in │ │ scan_flow_scalar_non_spaces │ │ │ │ 1220 │ │ │ │ │ self.scan_line_break() │ │ 1221 │ │ │ │ │ chunks.extend(self.scan_flow_scalar_breaks(double, start_mark)) │ │ 1222 │ │ │ │ else: │ │ ❱ 1223 │ │ │ │ │ raise ScannerError("while scanning a double-quoted scalar", start_ma │ │ 1224 │ │ │ │ │ │ │ "found unknown escape character %r" % ch, self.get_mark()) │ │ 1225 │ │ │ else: │ │ 1226 │ │ │ │ return chunks │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ScannerError: while scanning a double-quoted scalar in "L:\minigpt\MiniGPT-4\minigpt4\configs\models\minigpt4.yaml", line 16, column 16 found unknown escape character 'm' in "L:\minigpt\MiniGPT-4\minigpt4\configs\models\minigpt4.yaml", line 16, column 20

chimera15 avatar Apr 21 '23 09:04 chimera15

This is the problem I just met, ctrl and click the address into this file, change the address like :L:/minigpt/MiniGPT-4/minigpt4/configs/models/minigpt4.yaml. Anyway, may be this path you should check twice.

LLLYF avatar Apr 21 '23 10:04 LLLYF

I was watching a video that said it won't work on windows...is that true? is that the issue we're facing? It seems like others have gotten it to work though?

What do you mean I should check the path twice? Edit minigpt4.yaml with its own path?

I have it set to the model location..? L:\minigpt\MiniGPT-4\vicuna-13b-delta-v0

chimera15 avatar Apr 21 '23 10:04 chimera15

I think,,, we can.

I was watching a video that said it won't work on windows...is that true? is that the issue we're facing? It seems like others have gotten it to work though?

I think we can make it work. Nothing! My fault. this just right.

LLLYF avatar Apr 21 '23 10:04 LLLYF

I think,,, we can.

I was watching a video that said it won't work on windows...is that true? is that the issue we're facing? It seems like others have gotten it to work though?

I think we can make it work. Nothing! My fault. this just right.

if you success, could you please help me solve some problem? In #97

LLLYF avatar Apr 21 '23 10:04 LLLYF

在16行只需要输入vicuna-7b-delta-v1.1即可

JamyM0819 avatar May 05 '23 08:05 JamyM0819