class_docstr: Visual representations obtained from Wikidata and encoded with a vision encoder.
  
  If no image could be found for a certain Wikidata ID, a plain (trainable) embedding will be used instead.
  
  Example usage::
  
  .. code-block:: python
  
      from pykeen.datasets import get_dataset
      from pykeen.models import ERModel
      from pykeen.nn import WikidataVisualRepresentation
      from pykeen.pipeline import pipeline
  
      dataset = get_dataset(dataset="codexsmall")
      entity_representations = WikidataVisualRepresentation.from_dataset(dataset=dataset)
  
      result = pipeline(
          dataset=dataset,
          model=ERModel,
          model_kwargs=dict(
              interaction="distmult",
              entity_representations=entity_representations,
              relation_representation_kwargs=dict(
                  shape=entity_representations.shape,
              ),
          ),
      )
  
  ---
  name: Wikidata Visual
docstr: Initialize the representation.
  
  :param wikidata_ids:
      the Wikidata IDs
  :param max_id:
      the total number of IDs. If provided, must match the length of `wikidata_ids`
  :param image_kwargs:
      keyword-based parameters passed to :meth:`WikidataCache.get_image_paths`
  :param kwargs:
      additional keyword-based parameters passed to :meth:`VisualRepresentation.__init__`
  
  :raises ValueError:
      if the max_id does not match the number of Wikidata IDs
docstr_tok: ["Initialize","the","representation",".",":","param","wikidata_ids",":","the","Wikidata","IDs",":","param","max_id",":","the","total","number","of","IDs",".","If","provided",",","must","match","the","length","of","`","wikidata_ids","`",":","param","image_kwargs",":","keyword-based","parameters","passed","to",":","meth",":","`","WikidataCache.get_image_paths","`",":","param","kwargs",":","additional","keyword-based","parameters","passed","to",":","meth",":","`","VisualRepresentation.__init__","`",":","raises","ValueError",":","if","the","max_id","does","not","match","the","number","of","Wikidata","IDs"]
code: def __init__(
      self,
      wikidata_ids: Sequence[str],
      max_id: Optional[int] = None,
      image_kwargs: OptionalKwargs = None,
      **kwargs,
  ):
      """
      Initialize the representation.
  
      :param wikidata_ids:
          the Wikidata IDs
      :param max_id:
          the total number of IDs. If provided, must match the length of `wikidata_ids`
      :param image_kwargs:
          keyword-based parameters passed to :meth:`WikidataCache.get_image_paths`
      :param kwargs:
          additional keyword-based parameters passed to :meth:`VisualRepresentation.__init__`
  
      :raises ValueError:
          if the max_id does not match the number of Wikidata IDs
      """
      max_id = max_id or len(wikidata_ids)
      if len(wikidata_ids) != max_id:
          raise ValueError(
              f"Inconsistent max_id={max_id} vs. len(wikidata_ids)={len(wikidata_ids)}"
          )
      images = WikidataCache().get_image_paths(
          wikidata_ids, **(image_kwargs or {})
      )
      base_ids = [
          i for i, path in enumerate(images) if path is not None
      ]
      images = [path for path in images if path is not None]
      super().__init__(
          max_id=max_id,
          base_ids=base_ids,
          base=VisualRepresentation,
          base_kwargs=dict(images=images, **kwargs),
      )
  
imports: import functools
  import pathlib
  from typing import Any, Callable, Optional, Sequence, Union
  import torch
  import torch.nn
  import torch.utils.data
  from class_resolver import OptionalKwargs
  from docdata import parse_docdata
  from .representation import BackfillRepresentation, Representation
  from .utils import ShapeError, WikidataCache
  from ..datasets import Dataset
  from ..triples import TriplesFactory
  from ..typing import OneOrSequence
label_desc: Use image node_id 1 to create a new WikidataVisualRepresentation object from inherited base classes: BackfillRepresentation with example: obj = WikidataVisualRepresentation(wikidata_ids, max_id, image_kwargs)