Create a Model FileSet#
Create a FileSet containing your base model checkpoint before creating a Model Entity.
Prerequisites#
Obtained the base URL of your NeMo Platform.
For HuggingFace models: Created a secret with your HF token. Refer to Manage Secrets.
Set the
NMP_BASE_URLenvironment variable.
export NMP_BASE_URL="https://your-nemo-platform-url"
From HuggingFace Hub#
The most common method is downloading directly from HuggingFace:
import os
from nemo_platform import NeMoPlatform
from nemo_platform._exceptions import ConflictError
from nemo_platform.types.files import HuggingfaceStorageConfigParam
client = NeMoPlatform(
base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
workspace="default",
)
HF_REPO_ID = "meta-llama/Llama-3.2-1B-Instruct"
MODEL_NAME = "llama-3-2-1b"
HF_SECRET_NAME = "my-hf-token"
# First, create a secret for your HF token (if not already created)
try:
hf_secret = client.secrets.create(
name=HF_SECRET_NAME,
workspace="default",
data="hf_your_token_here" # Replace with your actual HuggingFace token
)
print(f"Created secret: {HF_SECRET_NAME}")
except ConflictError:
print(f"Secret '{HF_SECRET_NAME}' already exists, continuing...")
hf_secret = client.secrets.retrieve(name=HF_SECRET_NAME, workspace="default")
# Create FileSet from HuggingFace
try:
fileset = client.files.filesets.create(
workspace="default",
name=MODEL_NAME,
description="Llama 3.2 1B Instruct from HuggingFace",
storage=HuggingfaceStorageConfigParam(
type="huggingface",
repo_id=HF_REPO_ID,
repo_type="model",
token_secret=hf_secret.name
)
)
print(f"Created FileSet: {fileset.name}")
except ConflictError:
print(f"FileSet '{MODEL_NAME}' already exists, retrieving...")
fileset = client.files.filesets.retrieve(workspace="default", name=MODEL_NAME)
print(f"FileSet ready: {fileset.name}")
Tip
For gated models (like Llama), you need to:
Accept the model license on HuggingFace
Create a HuggingFace token with read access
Store the token as a secret in the platform
From NGC#
For models from NVIDIA NGC:
import os
from nemo_platform import NeMoPlatform
from nemo_platform._exceptions import ConflictError
from nemo_platform.types.files import NGCStorageConfigParam
client = NeMoPlatform(
base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
workspace="default",
)
# Create FileSet from NGC
try:
fileset = client.files.filesets.create(
workspace="default",
name="nemotron-mini-4b",
description="Nemotron Mini 4B from NGC",
storage=NGCStorageConfigParam(
type="ngc",
org="nvidia",
team="nemo",
resource="nemotron-mini-4b-instruct", # NGC resource name
version="1.0",
api_key_secret="my-ngc-key" # Secret containing NGC API key
)
)
print(f"Created FileSet: {fileset.name}")
except ConflictError:
print("FileSet already exists, retrieving...")
fileset = client.files.filesets.retrieve(workspace="default", name="nemotron-mini-4b")
Check FileSet Status#
Files are downloaded in the background after you create a FileSet. Check the status:
# List files in the FileSet
files = client.files.list(
workspace="default",
fileset="llama-3-2-1b",
)
print(f"Files in FileSet ({len(files)} total):")
for f in files[:10]: # Show first 10
print(f" - {f.path} ({f.size:,} bytes)")
Example Response
{
"data": [
{
"file_ref": "/v2/workspaces/default/filesets/llama-3-2-1b/-/config.json",
"path": "config.json",
"size": 1234,
"cache_status": null
},
{
"file_ref": "/v2/workspaces/default/filesets/llama-3-2-1b/-/model.safetensors",
"path": "model.safetensors",
"size": 2400000000,
"cache_status": null
},
{
"file_ref": "/v2/workspaces/default/filesets/llama-3-2-1b/-/tokenizer.json",
"path": "tokenizer.json",
"size": 9085657,
"cache_status": null
},
{
"file_ref": "/v2/workspaces/default/filesets/llama-3-2-1b/-/tokenizer_config.json",
"path": "tokenizer_config.json",
"size": 901,
"cache_status": null
}
]
}
Next Steps#
Proceed to create a Model Entity.