Skip to content

Commit

Permalink
update docstring and fair loader behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuan Tran committed Dec 10, 2023
1 parent f39a046 commit 21d0c9e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ other content generation tasks.
:maxdepth: 1

reference/data
reference/asset
reference/all

.. toctree::
Expand Down
20 changes: 20 additions & 0 deletions doc/reference/asset.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
fairseq2.asset
=============
.. body
.. currentmodule:: fairseq2.asset

``fairseq2.asset`` provides API to load the different model using the "model cards" from different "stores".

A model card is a .YAML file that contains information about a model and instructs a
:pc:class:`fairseq2.models.utils.generic_loaders.ModelLoader` on how to load the model into the memory.
A store is a place where all the model cards are stored. By default, fairseq2 will look up the following stores:

* System asset store: Cards that are shared by all users. By default, the system store is `/etc/fairseq2/assets`,
but this can be changed via the environment variable `FAIRSEQ2_ASSET_DIR`
* User asset store: Cards that are only available to the user. By default, the user store is
`~/.config/fairseq2/assets`, but this can be changed via the environment variable `FAIRSEQ2_USER_ASSET_DIR`
* (Internal only) Meta asset store: For Meta employees' convenience, we set up a central store that contains
model cards with e.g intermediate checkpoints, extra internal information etc. This store is registered automatically
when one logs into the Fair cluster. If you wish not to use this central store, set the environment variable
`NO_FAIR_CARD=ON`
4 changes: 4 additions & 0 deletions src/fairseq2/assets/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ def _load_faircluster() -> None:
if "FAIR_ENV_CLUSTER" not in os.environ:
return

# Disable the central Fair model store i.e. for debugging
if os.getenv("NO_FAIR_CARD", None):
return

asset_store.env_resolvers.append(lambda: "faircluster")

# This directory is meant to store cluster-wide asset cards.
Expand Down

0 comments on commit 21d0c9e

Please sign in to comment.