Working Docker Image for Unsloth

I’ve been struggling to get unsloth working on the spark, does anyone have a working docker image or a google dockerfile

I find both Nvidia’s and Unsloth’s DGX guidance is not building correctly

We recently updated our Unsloth playbook to be more accurate for the DGX Spark, please try it out Unsloth on DGX Spark | DGX Spark

I ordered the SPARK because I was expecting the out of the box ease of use for AI, despite the obvious limitations of the hardware. I then struggled for 3 days trying to get unsloth working. Unsuccessful on bare metal or within the unsloth Docker image. This will be my last attempt.

Have you seen this thread? https://forums.developer.nvidia.com/t/errors-in-dgx-unsloth-playbook-fixed-via-unmerged-pr/350456

Here’s working one.

The issues that I have encountered so far in DGX Spark with Python apps are really the fact that it has dual ARM64 CPUs + NVidia GB10 GPU + Unified Shared Memory + CUDA 13.0: all bleeding edge. Therefore almost all AI/ML libraries are not updated yet and you just have to hash thru these dependency conflict. And often you might have to compile with specific options and variables or even changes codes.

Yes, there have been firmware, old Linux kernel, BIOS issues too. So make sure you have update that was pushed last two days. If your kernel doesn’t match mine, do the update via DGX Dashboard or use update command below before doing anything else.

$ uname -a
Linux dgxspark01 6.14.0-1013-nvidia #13-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 29 06:01:19 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux

To bring DGX Spark up to date using command vs DGX Spark Dashboard.

sudo apt update
sudo apt dist-upgrade
sudo fwupdmgr refresh --force
sudo fwupdmgr get-updates
sudo fwupdmgr upgrade
sudo reboot

Note I am using pytorch:25.10-py3:

docker run --gpus all --ulimit memlock=-1 -it --ulimit stack=67108864 --entrypoint /usr/bin/bash --rm nvcr.io/nvidia/pytorch:25.10-py3

Inside container

1. Check GPU

nvcc --version
nvidia-smi

2. You need to use PyTorch with CUDA 13.0 support

pip install --pre torch torchvision torchaudio \
    --index-url https://download.pytorch.org/whl/nightly/cu130

3. There is a dependency conflict often caused by mixing “Nightly” PyTorch with “Stable” versions of transformers and torchao.

Specifically, the installation of transformers detects that torchao is present and tries to import a specific prototype module (safetensors_utils) that has been moved or removed in the latest torchao Nightly builds.

The Fix: Remove the conflicting library - torchao

Since torchao is an optional optimization backend and not strictly required for Unsloth (which relies on bitsandbytes and its own kernels), the fastest way to unblock yourself is to uninstall it.

pip uninstall torchao -y

# Also note I am using ~= allowing any patches.
pip install transformers peft \
    "datasets~=4.3.0" "trl~=0.19.1" \
    unsloth unsloth_zoo hf_transfer

# Run the test script
curl -O https://raw.githubusercontent.com/NVIDIA/dgx-spark-playbooks/refs/heads/main/nvidia/unsloth/assets/test_unsloth.py
python test_unsloth.py

Output - You get some warning but works.

root@99d3cd54a67a:/workspace# python test_unsloth.py
🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.
...    
  queued_call()
Unsloth: Your Flash Attention 2 installation seems to be broken?
A possible explanation is you have a new CUDA version which isn't
yet compatible with FA2? Please file a ticket to Unsloth or FA2.
We shall now use Xformers instead, which does not have any performance hits!
We found this negligible impact by benchmarking on 1x A100.
🦥 Unsloth Zoo will now patch everything to make training faster!
unified_chip2.jsonl: 100%|█████████████████████████████████████████████████████████████████████████████| 95.6M/95.6M [00:01<00:00, 71.5MB/s]
Generating train split: 210289 examples [00:00, 1950767.23 examples/s]
==((====))==  Unsloth 2025.11.3: Fast Gemma3 patching. Transformers: 4.57.1.
   \\   /|    NVIDIA GB10. Num GPUs = 1. Max memory: 119.698 GB. Platform: Linux.
O^O/ \_/ \    Torch: 2.10.0.dev20251120+cu130. CUDA: 12.1. CUDA Toolkit: 13.0. Triton: 3.5.1
\        /    Bfloat16 = TRUE. FA [Xformers = None. FA2 = False]
 "-____-"     Free license: http://github.com/unslothai/unsloth
Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!
Unsloth: Gemma3 does not support SDPA - switching to fast eager.
model.safetensors: 100%|████████████████████████████████████████████████████████████████████████████████| 4.56G/4.56G [00:28<00:00, 159MB/s]
...
Unsloth: Making `base_model.model.model.vision_tower.vision_model` require gradients
Unsloth: Tokenizing ["text"] (num_proc=24): 100%|█████████████████████████████████████████| 210289/210289 [00:09<00:00, 23092.04 examples/s]
The model is already on multiple devices. Skipping the move to device specified in `args`.
==((====))==  Unsloth - 2x faster free finetuning | Num GPUs used = 1
   \\   /|    Num examples = 210,289 | Num Epochs = 1 | Total steps = 60
O^O/ \_/ \    Batch size per device = 2 | Gradient accumulation steps = 4
\        /    Data Parallel GPUs = 1 | Total batch size (2 x 4 x 1) = 8
 "-____-"     Trainable parameters = 32,788,480 of 4,332,867,952 (0.76% trained)
{'loss': 3.3948, 'grad_norm': 2.96000599861145, 'learning_rate': 0.0, 'epoch': 0.0}                                                         
  2%|█▋                   
...
{'train_runtime': 90.8195, 'train_samples_per_second': 5.285, 'train_steps_per_second': 0.661, 'train_loss': 1.9319602966308593, 'epoch': 0.0}
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 60/60 [01:30<00:00,  1.51s/it]
root@99d3cd54a67a:/workspace# 

BTW, Compared to some other ones, this one was fairly easy one to figure out… relatively speaking that is. Trust your AI friend. I asked the new Gemini 3 pro - released two days ago… Gotta use a bleeding edge AI to solve bleeding edge problems ;-)

I know I, we all probably, was hoping, by now, I will be running my own an army of AI agents with my own models trained by me on my own DGX Spark not only solving all these issues all by itself, but also ready to take over the world… but we, me and my minions, are not there yet.

In fact, I need few more of these little beasts to even train a basic model. Anyone sick of your little beasts? I will happily adopt them if you like. I got plenty of stale registers, LM555s, Z80s, and even i8080 to keep them happy for a while ;-)

It worked for me from the start, and I’ve been here from day 1. Can you share some information of what you have tried so far and which errors you’re running through specifically. Broad statements don’t help a lot and don’t aggregate any value in technical forums.

@aniculescu It would be great if @NVidia team can go thru these playbooks themselves, and validate and update them. Almost none of them works as is: at least ones that really matter to AI/ML engineers. Sure, I like broken things because I learn far more from fixing broken things than just working things, but when none of tries works, it is really good to have “WORKING” references to refer to. For us, these playbooks are exactely that.

I understand the frustration, we intend for these playbook to be the kind of base reference you describe that will work for everyone. As software and firmware changes occur some of this info can become quickly outdated. We are always trying to keep our playbooks up to date but some tools like Unsloth are external to NVIDIA so some of these changes get missed.

@nvidia maybe it would be nice if users can write playbooks too.
Or have a Tutorial Section in the Forum.

I myself are currently struggle to get some tools on the spark.
Got Docker, Portainer, and n8n but can not reach the Container in the Webbrowser using the ip and port within my LAN

Hi @martinB78, I think that’s kind of the purpose of that Projects section in the GB10 Forum was supposed to represent. I saw some folks also trying to fix the playbooks from the github repo, but they’re no accepting external PR’s right now, I think it’s because the NVIDIA team uses gitlab internally and they have some automation to generate the playbooks and publish them to this repo. Right now they’re still trying to make sure the environment is stable and since this is a highly visible and completely new product, they decided to take a safe route on this. There’s a lot of great contributions happening in the Forums, and I think we should continue making progress here. Let’s take it with a little grace, we have all been there before. :D

@aniculescu Maybe NVIDIA should create a new section (or re-pupose the Projects one) for DGX Spark community playbooks/ Community notes on playbooks where the community can keep them updated and create new ones.

I have tried to run the above but i am getting nan values for the losses during the training which doesn’t seem to be correct