Skip to content

[bug]: concept lib name isn't correctly replaced with repo name when saving PNG metadata #1599

@JPPhoto

Description

@JPPhoto

Is there an existing issue for this?

  • I have searched the existing issues

OS

Linux

GPU

cuda

VRAM

12GB

What happened?

This report illustrates three separate issues for @damian0815 and @lstein to look at.

  1. When requesting a concept with spaces (prohibited), InvokeAI crashes. See this snippet:
│ /home/jovyan/work/InvokeAI/ldm/invoke/concepts_lib.py:101 in get_concept_file                    │
│                                                                                                  │
│    98 │                                                                                          │
│    99 │   def get_concept_file(self, concept_name:str, file_name:str='learned_embeds.bin' , lo   │
│   100 │   │   if not self.concept_is_downloaded(concept_name) and not local_only:                │
│ ❱ 101 │   │   │   self.download_concept(concept_name)                                            │
│   102 │   │   path = os.path.join(self._concept_path(concept_name), file_name)                   │
│   103 │   │   return path if os.path.exists(path) else None                                      │
│   104                                                                                            │
│                                                                                                  │
│ /home/jovyan/work/InvokeAI/ldm/invoke/concepts_lib.py:131 in download_concept                    │
│                                                                                                  │
│   128 │   │   print(f'>> Downloading {repo_id}...',end='')                                       │
│   129 │   │   try:                                                                               │
│   130 │   │   │   for file in ('README.md','learned_embeds.bin','token_identifier.txt','type_o   │
│ ❱ 131 │   │   │   │   url = hf_hub_url(repo_id, file)                                            │
│   132 │   │   │   │   request.urlretrieve(url, os.path.join(dest,file),reporthook=tally_downlo   │
│   133 │   │   except ul_error.HTTPError as e:                                                    │
│   134 │   │   │   if e.code==404:                                                                │
│                                                                                                  │
│ /home/jovyan/.conda/envs/invokeai/lib/python3.9/site-packages/huggingface_hub/utils/_validators. │
│ py:114 in _inner_fn                                                                              │
│                                                                                                  │
│   111 │   │   │   kwargs.items(),  # Kwargs values                                               │
│   112 │   │   ):                                                                                 │
│   113 │   │   │   if arg_name == "repo_id":                                                      │
│ ❱ 114 │   │   │   │   validate_repo_id(arg_value)                                                │
│   115 │   │   │                                                                                  │
│   116 │   │   │   elif arg_name == "token" and arg_value is not None:                            │
│   117 │   │   │   │   has_token = True                                                           │
│                                                                                                  │
│ /home/jovyan/.conda/envs/invokeai/lib/python3.9/site-packages/huggingface_hub/utils/_validators. │
│ py:172 in validate_repo_id                                                                       │
│                                                                                                  │
│   169 │   │   )                                                                                  │
│   170 │                                                                                          │
│   171 │   if not REPO_ID_REGEX.match(repo_id):                                                   │
│ ❱ 172 │   │   raise HFValidationError(                                                           │
│   173 │   │   │   "Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are"      │
│   174 │   │   │   " forbidden, '-' and '.' cannot start or end the name, max length is 96:"      │
│   175 │   │   │   f" '{repo_id}'."                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
  1. The erroneous concept name is exposed and may be passed through directly as an HTTP request (per a conversation with @damian0815).
  2. The metadata from a successful use of the concept has the "pretty name" rather than the name-separated-by-hyphens, meaning that using !fetch at a later point will not work properly. (That's how I encountered these issues.)

Screenshots

No response

Additional context

No response

Contact Details

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions