Create a Model FileSet

View as Markdown

Create a FileSet containing your base model checkpoint before creating a Model Entity.

Prerequisites

  • Obtained the base URL of your NeMo Platform.
  • For gated or private HuggingFace models: Created a secret with your HF token. Refer to Manage Secrets.
  • Set the NMP_BASE_URL environment variable.
$export NMP_BASE_URL="https://your-nemo-platform-url"

From HuggingFace Hub

The most common method is downloading directly from HuggingFace. The example below uses Qwen/Qwen3-1.7B, a public model that requires no token:

1import os
2from nemo_platform import ConflictError, NeMoPlatform
3from nemo_platform.types.files import HuggingfaceStorageConfigParam
4
5client = NeMoPlatform(
6 base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
7 workspace="default",
8)
9
10HF_REPO_ID = "Qwen/Qwen3-1.7B"
11MODEL_NAME = "qwen3-1.7b"
12
13# Create FileSet from HuggingFace
14try:
15 fileset = client.files.filesets.create(
16 workspace="default",
17 name=MODEL_NAME,
18 description="Qwen3 1.7B from HuggingFace",
19 purpose="model",
20 storage=HuggingfaceStorageConfigParam(
21 type="huggingface",
22 repo_id=HF_REPO_ID,
23 repo_type="model",
24 ),
25 )
26 print(f"Created FileSet: {fileset.name}")
27except ConflictError:
28 print(f"FileSet '{MODEL_NAME}' already exists, retrieving...")
29 fileset = client.files.filesets.retrieve(workspace="default", name=MODEL_NAME)
30
31print(f"FileSet ready: {fileset.name}")

Gated models (such as Llama) require a HuggingFace token. To use one:

  1. Accept the model license on the HuggingFace model page.
  2. Create a HuggingFace token with read access.
  3. Store the token as a secret in the platform (see Manage Secrets), then pass it as token_secret in the storage config:
1storage=HuggingfaceStorageConfigParam(
2 type="huggingface",
3 repo_id="meta-llama/Llama-3.2-1B-Instruct",
4 repo_type="model",
5 token_secret="my-hf-token",
6)

From NGC

For models from NVIDIA NGC:

1import os
2from nemo_platform import ConflictError, NeMoPlatform
3from nemo_platform.types.files import NGCStorageConfigParam
4
5client = NeMoPlatform(
6 base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
7 workspace="default",
8)
9
10MODEL_NAME = "nemotron-mini-4b"
11NGC_RESOURCE = "nemotron-mini-4b-instruct"
12NGC_ORG = "nvidia"
13NGC_TEAM = "nemo"
14NGC_VERSION = "1.0"
15NGC_API_KEY_SECRET = "my-ngc-key"
16NGC_API_KEY = os.environ.get("NGC_API_KEY")
17if not NGC_API_KEY:
18 raise RuntimeError("Set NGC_API_KEY before creating the NGC secret.")
19
20# First, create a secret for your NGC API key (if not already created)
21try:
22 ngc_secret = client.secrets.create(
23 name=NGC_API_KEY_SECRET,
24 workspace="default",
25 value=NGC_API_KEY,
26 )
27 print(f"Created secret: {NGC_API_KEY_SECRET}")
28except ConflictError:
29 print(f"Secret '{NGC_API_KEY_SECRET}' already exists, continuing...")
30 ngc_secret = client.secrets.retrieve(name=NGC_API_KEY_SECRET, workspace="default")
31
32# Create FileSet from NGC
33try:
34 fileset = client.files.filesets.create(
35 workspace="default",
36 name=MODEL_NAME,
37 description="Nemotron Mini 4B from NGC",
38 purpose="model",
39 storage=NGCStorageConfigParam(
40 type="ngc",
41 org=NGC_ORG,
42 team=NGC_TEAM,
43 resource=NGC_RESOURCE, # NGC resource name
44 version=NGC_VERSION,
45 api_key_secret=ngc_secret.name,
46 ),
47 )
48 print(f"Created FileSet: {fileset.name}")
49except ConflictError:
50 print("FileSet already exists, retrieving...")
51 fileset = client.files.filesets.retrieve(workspace="default", name=MODEL_NAME)

Check FileSet Status

Files are downloaded in the background after you create a FileSet. Check the status:

1# List files in the FileSet
2files = client.files.list(
3 workspace="default",
4 fileset="qwen3-1.7b",
5)
6
7print(f"Files in FileSet ({len(files)} total):")
8for f in files[:10]: # Show first 10
9 print(f" - {f.path} ({f.size:,} bytes)")
1{
2 "data": [
3 {
4 "file_ref": "/v2/workspaces/default/filesets/qwen3-1.7b/-/config.json",
5 "path": "config.json",
6 "size": 1234,
7 "cache_status": null
8 },
9 {
10 "file_ref": "/v2/workspaces/default/filesets/qwen3-1.7b/-/model.safetensors",
11 "path": "model.safetensors",
12 "size": 2400000000,
13 "cache_status": null
14 },
15 {
16 "file_ref": "/v2/workspaces/default/filesets/qwen3-1.7b/-/tokenizer.json",
17 "path": "tokenizer.json",
18 "size": 9085657,
19 "cache_status": null
20 },
21 {
22 "file_ref": "/v2/workspaces/default/filesets/qwen3-1.7b/-/tokenizer_config.json",
23 "path": "tokenizer_config.json",
24 "size": 901,
25 "cache_status": null
26 }
27 ]
28}

Next Steps

Proceed to create a Model Entity.