Gated models and access tokens
Using gated models
Artifical Intelegence models are powerful and in the wrong hands can be dangerous. The models used by fave-asr are cost-free, but you need to accept additional terms of use.
To use these models: 1. On HuggingFace, create an account or log in 2. Accept the terms and conditions for the segmentation model 3. Accept the terms and conditions for the diarization model 4. Create an access token or copy your existing token
Keep track of your token and keep it safe (e.g. don’t accidentally upload it to GitHub). We suggest creating an environment variable for your token so that you don’t need to paste it into your files.
Creating an environment variable for your token
Storing your tokens as environment variables is a good way to avoid accidentally leaking them. Instead of typing the token into your code and deleting it before you commit, you can use os.environ["HF_TOKEN"]
to access it from Python.
Using environment variables makes your code more readable and easier to maintain. Random strings are hard to debug, and you might forget what the token is for. Using environment variables gives these tokens name like HF_TOKEN
which is makes it easier to tell what token is being used and if it’s the right one.
Linux and Mac
On Linux and Mac you can store your token in .bashrc
- Open
$HOME/.bashrc
in a text editor - At the end of that file, add the following
HF_TOKEN='<your token>' ; export HF_TOKEN
replacing<your token>
with your HuggingFace token - Add the changes to your current session using
source $HOME/.bashrc
Windows
On Windows, use the setx
command to create an environment variable.
setx HF_TOKEN <your token>
You need to restart the command line afterwards to make the environment variable available for use. If you try to use the variable in the same window you set the variable, you will run into problems.