Batch Tansform and API token for private model

Hi.

I used the notebook lab2_batch_transform.ipynb of @philschmid to launch batch for inferences.

The model I used in in private mode in the HF model hub. I do not see in the following code from the notebook which argument to use in order to pass the API_TOKEN:

from sagemaker.huggingface.model import HuggingFaceModel

# Hub Model configuration. <https://huggingface.co/models>
hub = {
    'HF_MODEL_ID':model_checkpoint,
    'HF_TASK':'text2text-generation'   
}

Who knows the answer? Thanks.

1 Like

I just found the answer in github at Environment variables: HF_API_TOKEN

from sagemaker.huggingface.model import HuggingFaceModel

# Hub Model configuration. <https://huggingface.co/models>
hub = {
    'HF_MODEL_ID':model_checkpoint,
    'HF_TASK':'text2text-generation',
    'HF_API_TOKEN':API_TOKEN
}
1 Like