tuned_lens.load_artifacts#

Load lens artifacts from the hub or locally storage.

Functions

# empty test needed in case the module has no example usage.
# otherwise, testsetup throws an error
pass
tuned_lens.load_artifacts.available_lens_artifacts(repo_id, repo_type, revision='main', config_file='config.json', ckpt_file='params.pt', subfolder='lens')#

Get the available lens artifacts from the hub.

Return type:

set[str]

tuned_lens.load_artifacts.load_lens_artifacts(resource_id, repo_id=None, repo_type=None, revision='main', config_file='config.json', ckpt_file='params.pt', subfolder='lens', cache_dir=None)#

First checks for lens resource locally then tries to download it from the hub.

Parameters:
  • resource_id – The id of the lens resource.

  • repo_id – The repository to download the lens from. Defaults to ‘AlignmentResearch/tuned-lens’. However, this default can be overridden by setting the TUNED_LENS_REPO_ID environment variable.

  • repo_type – The type of repository to download the lens from. Defaults to ‘space’. However, this default can be overridden by setting the TUNED_LENS_REPO_TYPE environment variable.

  • config_file – The name of the config file in the folder contain the lens.

  • ckpt_file – The name of the checkpoint file in the folder contain the lens.

  • revision – The revision of the lens to download.

  • subfolder – The subfolder of the repository to download the lens from.

  • cache_dir – The directory to cache the lens in.

Return type:

tuple[Path, Path]

Returns:

  • The path to the config.json file

  • The path to the params.pt file

Raises:

ValueError – if the lens resource could not be found.