Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to load adapter from source 'ah'... #6

Open
sunyuhan19981208 opened this issue Jul 5, 2023 · 1 comment
Open

Attempting to load adapter from source 'ah'... #6

sunyuhan19981208 opened this issue Jul 5, 2023 · 1 comment

Comments

@sunyuhan19981208
Copy link

sunyuhan19981208 commented Jul 5, 2023

While running script exps/composition_for_multitasking/lora_prompt_run_glue.sh, an error will raise like this, it there really a source named ah or just a bug?

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/sunyuhan/syh/sunyuhan/zju/PEM_composition/examples/pytorch/summarization/prompt_run_glue.p │
│ y:865 in <module>                                                                                │
│                                                                                                  │
│   862                                                                                            │
│   863                                                                                            │
│   864 if __name__ == "__main__":                                                                 │
│ ❱ 865 │   main()                                                                                 │
│   866                                                                                            │
│                                                                                                  │
│ /home/sunyuhan/syh/sunyuhan/zju/PEM_composition/examples/pytorch/summarization/prompt_run_glue.p │
│ y:520 in main                                                                                    │
│                                                                                                  │
│   517 │   │   │   if adapter_args.load_adapter:                                                  │
│   518 │   │   │   │   import pdb;pdb.set_trace()                                                 │
│   519 │   │   │   │   model.load_adapter(                                                        │
│ ❱ 520 │   │   │   │   │   adapter_args.load_adapter,                                             │
│   521 │   │   │   │   │   config=adapter_config,                                                 │
│   522 │   │   │   │   │   load_as=task_name,                                                     │
│   523 │   │   │   │   )                                                                          │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/model_mixin.py:1070 in         │
│ load_adapter                                                                                     │
│                                                                                                  │
│   1067 │   │   num_labels = kwargs.pop("num_labels", None)                                       │
│   1068 │   │   if num_labels is not None:                                                        │
│   1069 │   │   │   id2label = {i: "LABEL_" + str(i) for i in range(num_labels)}                  │
│ ❱ 1070 │   │   return super().load_adapter(                                                      │
│   1071 │   │   │   adapter_name_or_path,                                                         │
│   1072 │   │   │   config=config,                                                                │
│   1073 │   │   │   version=version,                                                              │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/model_mixin.py:653 in          │
│ load_adapter                                                                                     │
│                                                                                                  │
│    650 │   │   │   str: The name with which the adapter was added to the model.                  │
│    651 │   │   """                                                                               │
│    652 │   │   loader = AdapterLoader(self)                                                      │
│ ❱  653 │   │   load_dir, load_name = loader.load(                                                │
│    654 │   │   │   adapter_name_or_path,                                                         │
│    655 │   │   │   config,                                                                       │
│    656 │   │   │   version,                                                                      │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/loading.py:426 in load         │
│                                                                                                  │
│   423 │   │   requested_config = AdapterConfigBase.load(config) if config else None              │
│   424 │   │   # Resolve the weights to be loaded based on the given identifier and the current   │
│   425 │   │   model_name = self.model.model_name or model_name                                   │
│ ❱ 426 │   │   resolved_folder = resolve_adapter_path(                                            │
│   427 │   │   │   adapter_name_or_path,                                                          │
│   428 │   │   │   model_name,                                                                    │
│   429 │   │   │   adapter_config=requested_config,                                               │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/utils.py:488 in                │
│ resolve_adapter_path                                                                             │
│                                                                                                  │
│   485 │   elif source is None:                                                                   │
│   486 │   │   try:                                                                               │
│   487 │   │   │   logger.info("Attempting to load adapter from source 'ah'...")                  │
│ ❱ 488 │   │   │   return pull_from_hub(                                                          │
│   489 │   │   │   │   adapter_name_or_path, model_name, adapter_config=adapter_config, version   │
│   490 │   │   │   )                                                                              │
│   491 │   │   except EnvironmentError as ex:                                                     │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/utils.py:398 in pull_from_hub  │
│                                                                                                  │
│   395 │   if adapter_config:                                                                     │
│   396 │   │   adapter_config = resolve_adapter_config(adapter_config)                            │
│   397 │   # search the correct entry in the index                                                │
│ ❱ 398 │   hub_entry_url = find_in_index(specifier, model_name, adapter_config=adapter_config,    │
│   399 │   if not hub_entry_url:                                                                  │
│   400 │   │   raise EnvironmentError("No adapter with name '{}' was found in the adapter index   │
│   401 │   hub_entry = http_get_json(hub_entry_url)                                               │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/utils.py:303 in find_in_index  │
│                                                                                                  │
│   300 │   │   return ADAPTER_HUB_ADAPTER_ENTRY_JSON.format(match.group(1), match.group(2))       │
│   301 │                                                                                          │
│   302 │   if not index_file:                                                                     │
│ ❱ 303 │   │   index_file = download_cached(ADAPTER_HUB_INDEX_FILE.format(model_name))            │
│   304 │   if not index_file:                                                                     │
│   305 │   │   raise EnvironmentError("Unable to load adapter hub index file. The file might be   │
│   306 │   with open(index_file, "r") as f:                                                       │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/adapters/utils.py:168 in                │
│ download_cached                                                                                  │
│                                                                                                  │
│   165 │   │   cache_dir = str(cache_dir)                                                         │
│   166 │                                                                                          │
│   167 │   if is_remote_url(url):                                                                 │
│ ❱ 168 │   │   output_path = get_from_cache(url, cache_dir=cache_dir, **kwargs)                   │
│   169 │   else:                                                                                  │
│   170 │   │   raise ValueError("Unable to parse '{}' as a URL".format(url))                      │
│   171                                                                                            │
│                                                                                                  │
│ /opt/miniconda3/lib/python3.8/site-packages/transformers/utils/hub.py:562 in get_from_cache      │
│                                                                                                  │
│    559 │   │   │   │   │   │   " to False."                                                      │
│    560 │   │   │   │   │   )                                                                     │
│    561 │   │   │   │   else:                                                                     │
│ ❱  562 │   │   │   │   │   raise ValueError(                                                     │
│    563 │   │   │   │   │   │   "Connection error, and we cannot find the requested files in the  │
│    564 │   │   │   │   │   │   " Please try again or make sure your Internet connection is on."  │
│    565 │   │   │   │   │   )                                                                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.
@sunyuhan19981208
Copy link
Author

And here is the debug log, I set trace at examples/pytorch/summarization/prompt_run_glue.py: 518:

> /home/sunyuhan/syh/sunyuhan/zju/PEM_composition/examples/pytorch/summarization/prompt_run_glue.py(519)main()
-> model.load_adapter(
(Pdb) p adapter_args.load_adapter
'merged_adapters/prompt_glue_lora/initialization_42_lora_rte/glue'
(Pdb) p adapter_config
LoRAConfig(architecture='lora', selfattn_lora=True, intermediate_lora=False, output_lora=False, r=8, alpha=8, dropout=0.0, attn_matrices=['q', 'v'], composition_mode='add', init_weights='lora', use_gating=False)
(Pdb) p task_name
'glue'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant