Import and Fine-Tune Private Hugging Face Models
Use this tutorial to learn how to import a private Hugging Face model into NeMo Customizer, fine-tune it with LoRA, and deploy it for inference.
Prerequisites
New to using NeMo Helix?
All platform resources—models, datasets, and more—must belong to a workspace. Workspaces provide organizational and authorization boundaries for your work. Within a workspace, you can optionally use projects to group related resources.
If you’re new to the platform, start with the Setup guide to learn how to deploy and evaluate models, and optimize agents using the platform end-to-end.
If you’re already familiar with workspaces and how to upload datasets to the platform, you can proceed directly with this tutorial.
The CLI and Python SDK examples in this tutorial use the deployment and workspace in your current CLI context. To connect to a local or remote deployment, see Connect with CLI Contexts.
For more information, see Workspaces and Projects.
Tutorial-Specific Prerequisites
- Completed the Quickstart to install and deploy NeMo Helix locally.
- Installed the Python SDK and any tutorial packages you need in your environment.
- A Hugging Face token with access to the private or gated model repository.
- A private or gated Hugging Face model with a compatible architecture. The job settings in this tutorial assume a small dense model (about 2B parameters) on one GPU; for larger or MoE models, start from a reference recipe.
- Sufficient GPU memory for the model and LoRA training job.
This tutorial uses the typed NeMo Helix clients: client.files, client.models, and the Customization resource’s customization.automodel.jobs.
Known Issues
Conv1D Model Architecture Limitation: Models that use Conv1D layers are not compatible with NeMo Customizer AutoModel LoRA.
Error signature: AttributeError: 'Conv1D' object has no attribute 'config'
Affected models include:
microsoft/DialoGPT-*seriesopenai-gptmodels- Some older
gpt2variants - Other models with Conv1D-based architectures
Root cause: These models use Conv1D layers that lack the linear layers expected by NeMo’s LoRA transformation utilities.
Solution: Use modern transformer architectures instead:
- Nemotron models
- Other architectures listed in the Model Catalog
For a complete list of tested models, see the Model Catalog.
Quick Start
1. Initialize the SDK
The SDK connects to the deployment in your current CLI context. To connect to another deployment, refer to Connect with CLI Contexts. Export your Hugging Face token:
These examples use the default workspace. If your current CLI context uses a different workspace, run nemo config set --workspace default first. To check, run nemo config view.
2. Store the Hugging Face Token
Private and gated Hugging Face repositories require a token. Store it as a NeMo Helix secret and reference that secret from the Hugging Face fileset.
3. Create a Model FileSet and Model Entity
Create a Hugging Face-backed fileset for the private model, then register a Model Entity that points to that fileset. Model files are downloaded by the platform when training or deployment needs them.
4. Prepare and Upload Training Data
Create chat-format JSONL files and upload them to a fileset. The file service, not a dataset-specific SDK resource, is the current entry point for training data.
5. Start a LoRA Customization Job
Submit a LoRA job to the Automodel backend. Reference the model and dataset filesets using workspace/name.
6. Track Training Progress
Poll job status until training reaches a terminal state.
7. Deploy the Base Model With LoRA Enabled
Create a deployment for the base model with LoRA support enabled. The LoRA adapter from training is served by the same deployment.
8. Test the Deployed Model
Call the inference gateway through the SDK. Use the base model name to test the original model and the output adapter name to test the LoRA-adapted model.
Python SDK
cURL
Next Steps
Learn how to check customization job metrics to monitor training progress and performance for your fine-tuned model.