Prerequisites for downloading and uploading Model artifacts in air-gapped environment
Before downloading or uploading Models, ensure you have the following tools and configurations installed on the host that is connected to the air-gapped environment. This might be your bastion host. Install only the tools that you need for your Model source and storage.
-
Required tools:
- Hugging Face CLI (Hugging Face Models):
pip install -U "huggingface_hub[cli]<1.0"The script uses the huggingface-cli command, which huggingface_hub 1.0 and later does not include.
- AWS CLI: (uploads to Amazon S3 and S3-compatible storage):
pip install awscli==1.35.0 - PyYAML:
pip install pyyaml - rclone (Mistral models): Install from https://rclone.org/install/.
-
NVIDIA NGC CLI: Install from https://org.ngc.nvidia.com/setup/installers/cli for NVIDIA NGC catalog Models. Make sure you configure the NVIDIA NGC client with the credentials provided by Cloudera.
- Azure CLI (uploads to Azure Blob Storage):
pip install azure-cli - Python: Make sure the Python version is 3.10.12 or higher and lower than version 3.11.
- Python requests package (Hugging Face models):
pip install requests
- Hugging Face CLI (Hugging Face Models):
-
Configuration details:
Configure the NGC client with credentials provided by Cloudera during onboarding. Contact Cloudera support or raise a ticket to get the credentials. Use the following commands to add your key and organization to your
~/.bashrcfile.echo 'export NGC_CLI_API_KEY=<key>' >> ~/.bashrc echo 'export NGC_API_KEY=<key>' >> ~/.bashrc echo 'export NGC_CLI_ORG=<org>' >> ~/.bashrcIf the system has
~/.bash_profile, follow the above steps, but replacebashrcwithbash_profile. - Allowed URLs list
For air-gapped installations using a non-transparent proxy, you must add the following URLs to your firewall allowlist to ensure the Model Hub functions correctly and to maintain access to the latest model catalogs.
Hugging Face
- * huggingface.co
- cdn-lfs.huggingface.co*
- *cdn-lfs-us-1\.huggingface\.co
- *cdn-lfs-eu-1\.huggingface\.co
- *cdn-lfs-us-1\.hf\.co
- *cdn-lfs-eu-1\.hf\.co
- *cdn-lfs\.hf\.co
- *cas-bridge.xethub.hf.co http_access allow hf_xet
- *transfer.xethub.hf.co http_access allow hf_tr
- *cas-server.xethub.hf.co http_access allow hf_cas
- *.cloudfront.net (CDN)
Nvidia NGC Catalog
- api.ngc.nvidia.com
- xfiles.ngc.nvidia.com
- prod.otel.kaizen.nvidia.com (NVIDIA open telemetry)
- api.ngc.nvidia.com
- files.ngc.nvidia.com
- To download Mistral models, allow outbound HTTPS access to Amazon S3, where the Mistral bucket is hosted.
-
Download the script
Use the
import_to_airgap.pyscript to download model repositories from Hugging Face, NVIDIA NGC, or Mistral, and upload them to your cloud storage. You can download the script from the following GitHub location:The script supports the following download parameters:
Table 1. Download parameters Parameter short form Parameter long form Value Description -do--downloadActivates download mode. -rt--repo-typehf, ngc, or mistralRepository type: use hffor Hugging Face, usengcfor NVIDIA NGC catalog, usemistralfor Mistral models.-t--token<token>Hugging Face API token: required for accessing private or gated models that need authentication. Upload to Azure Blob Storage (-c azure): the SAS token. For more information about Hugging Face tokens, see:https://huggingface.co/docs/hub/en/security-tokens.
-p--path<directory>Local path: the directory where the script saves the downloaded files. Default: ./modelsin the current working directory.-ri--repo-id<ID>Repository ID: The model's ID from either Hugging Face or NVIDIA NGC. For Mistral models, the name of the main weights directory, for example mistral-medium-3-5-0.
You can obtain theriargument for Hugging Face as follows:- Open up the Hugging Face page at: https://huggingface.co/.
-
Search for the required model.
The page of the model displays.
- Click the
icon next to the name of the model, and copy the
model ID, that is the riargument to be used.
-ns--ngc-spec<file name>lNGC specification file: required when downloading NGC models. This file is provided by Cloudera. --license-key-env<variable name>Mistral models: name of the environment variable that contains the Mistral license key. Required for Mistral downloads. --draft-weights-path<directory>Mistral models: draft weights directory in the Mistral bucket, for example weights/mistral-draft-0.6b-2504. Required for Mistral downloads. --main-weights-path<directory>Mistral models: main weights directory in the Mistral bucket. Optional. Default: weights/<repository ID>. --list-bucket-weightsMistral models: Lists the model directories available under your Mistral license. No files are downloaded. -vEnables detailed logging. The script supports the following upload parameters:
Table 2. Upload parameters Parameter short form Parameter long form Value Description -s--src<directory>Upload: Directory containing the downloaded files, specified using the -poption.-d--dst<path>Upload: Destination path in object storage, for example
s3://<bucket>/<path>. For Mistral models, use theremote_object_storage_pathconfigured for Cloudera AI Registry.-c--cloudaws, pvc, or azureUpload: Storage type. The default is
aws. Usepvcfor S3-compatible storage that uses a custom endpoint.-e--endpoint<URL>Upload: Endpoint URL for S3-compatible storage. Used with the
-c pvcoption.-ca--ca-bundle<file path>Upload: CA bundle file used to validate the endpoint certificate for S3-compatible storage. Used with the
-c pvcoption.-i--insecureUpload: disables SSL verification. Used with -c pvc. Not recommended. -ac--account<name>Upload: Azure storage account. Used with -c azure. Specify the SAS token with -t. -cn--container<name>Upload: Azure container name. Used with -c azure. Cloudera provides an NGC specification file that matches your Cloudera AI Registry version. To obtain the file for Cloudera AI Registry, contact Cloudera Support. Use the
-nsparameter to pass the file to the script.
