Skip to content

Self-hosting

NDIF is open source. A lab can run the same server on its own GPUs, and nnsight talks to it the way it talks to api.ndif.us. The server's code and its documentation are in the ndif repository.

Point nnsight at your server

For one trace or session, pass the server's address as remote:

with model.trace("The Eiffel Tower is in the city of", remote="http://my-server:5001"):
    token = model.lm_head.output[0, -1].argmax(-1).save()

For a whole process, set the environment variable:

export NDIF_HOST=http://my-server:5001

To make it the default on this machine:

from nnsight import CONFIG

CONFIG.API.HOST = "http://my-server:5001"
CONFIG.save()

What differs on your own server

Everything in this section describes the public service. On a server you run, these are yours to set:

  • Which models are loaded, and whether a request may load a new one.
  • Whether API keys are checked, and which keys have trusted access.
  • The time limit per job and the runtime allowance per account.
  • Whether blocks can reach the network.

nnsight.compare("http://my-server:5001") lists that server's packages beside yours.