Configuration and environment variables
Read this page to learn where the SDK reads the server address and keys, and to check how that configuration is filled in for workspaces and training jobs. The environment variables that change SDK behavior are collected here too.
The SDK is included in workspaces and in the training job environment. From a PC outside the server, use SSH (VS Code Remote-SSH and the like) to work in a workspace with the SDK, or use the REST API.
Config file lookup order
Section titled “Config file lookup order”On import qgon, the SDK looks in this order and uses the first file it finds.
- The file that the environment variable
QGON_CONFIGpoints to ~/.qgon/qgon.conf/etc/qgon/qgon.conf
Inside a workspace, the server presets the config file location to ~/.qgon/qgon.conf for terminals, the IDE and notebooks, so this file is used even if you change QGON_CONFIG.
Without a config file, the SDK cannot connect to the server. In that case qgon info reports that there is no configuration and exits with code 2.
File format
Section titled “File format”api { web_server: http://<server address>:<web port> api_server: http://<server address>:<web port>/api files_server: http://<server address>:<web port>/files credentials { "access_key" = "…", "secret_key" = "…" }}| Field | Meaning |
|---|---|
web_server |
The qgon app address |
api_server |
Where the SDK records experiments. The SDK also replaces the trailing /api with /qgon-api to call the queue paths (qgon.queue) |
files_server |
Where models, artifacts and checkpoints are uploaded and downloaded |
credentials |
The key the SDK uses. Everything the SDK does runs with the permissions of this key's owner |
The file holds a secret key, so keep it readable only by you (mode 600). The file a workspace creates for you is set that way from the start.
Where your code runs
Section titled “Where your code runs”Inside a workspace
Section titled “Inside a workspace”- Run Set up access once on the workspace screen. Your workspace key is created and written to
~/.qgon/qgon.conf. There is nothing to configure by hand. api_serverandfiles_serverare in-server addresses (http://qdix-gateway:82/api,http://qdix-gateway:82/files), andweb_serveris the app address.- A workspace key works only inside that workspace and becomes invalid as soon as you are removed as a member.
- Even for an admin account, actions taken with a workspace key are judged by member rules. Admin actions such as moving a job to the top or bottom of the queue or approving urgent requests are done in the qgon app.
- A workspace key cannot call test APIs or endpoints. Use a personal key or an endpoint key (test serving, endpoints).
Set up access and SSH connections are covered in Connect to the server.
Inside a training job
Section titled “Inside a training job”- The server injects the connection settings into training jobs sent to a queue. Your code only needs to call
qgon.init(). No config file is needed. - A job runs with the permissions of the person who created it. A job created or changed with a workspace key runs with member permissions, even if it belongs to an admin account.
- Models and checkpoints are uploaded to the qgon file server.
Outside the server
Section titled “Outside the server”- To use the SDK from a PC, connect to a workspace over SSH and use it there (Connect to the server).
- Programs on a PC call the server through the REST API. Get a token with an API key created in Settings › API credentials.
Check the current configuration
Section titled “Check the current configuration”qgon info reads only the configuration, without asking the server, and prints the SDK version, the config file in use, each address and the default queue. In a workspace terminal it looks roughly like this.
$ qgon infoqgon 0.3.29 (…)config : /qgon/home/<user id>/.qgon/qgon.confapi : http://qdix-gateway:82/apiweb : http://<server address>:<web port>files : http://qdix-gateway:82/filesqueue : gpu (qgon run --queue 기본값)Environment variables
Section titled “Environment variables”Values you can change
Section titled “Values you can change”| Variable | Default | What it does |
|---|---|---|
QGON_CONFIG |
none | Config file path. Not used inside a workspace |
QGON_QUEUE |
gpu |
Default queue for qgon run --remote, HPO trials, pipeline steps and qgon queue |
QGON_PROJECT |
Default |
Default project for qgon run and qgon.submit() |
QGON_WORKSPACE |
set by the workspace | The current workspace name. When you give only a version, as in qgon run --env 3, the environment of this workspace is used |
QGON_DATA_ROOT |
/qgon-data |
Folder where mounted dataset versions are found |
QGON_CHECKPOINT_DIR |
.qgon-checkpoints in the current folder |
Folder for local copies of checkpoints |
QGON_AUTO_PROGRESS |
1 |
With 0, the progress callback is not attached to the Hugging Face Trainer automatically |
QGON_YIELD |
1 |
With 0, watching for GPU yield requests is turned off |
QGON_YIELD_POLL_S |
15 |
Interval for checking yield requests (seconds) |
QGON_RUN_MAX_FILE_MB |
10 |
Cap per file (MB) for code uploaded with qgon run --remote. Larger files are left out |
QGON_RUN_MAX_TOTAL_MB |
200 |
Cap on the total uploaded code (MB). Going over stops with an error |
QGON_RUN_MAX_FILES |
10000 |
Cap on the number of uploaded files. Going over stops with an error |
Data too large to upload with your code goes in a dataset. List folders you do not want to upload in .qgonignore in the code folder.
Values the SDK sets
Section titled “Values the SDK sets”In a run started with resume, calling qgon.init() makes the SDK report the checkpoint it received through these variables. Code that does not use qgon.resume_point() can still resume with these values.
| Variable | Value |
|---|---|
QGON_RESUME_PATH |
Path of the downloaded checkpoint file |
QGON_RESUME_CHECKPOINT |
Checkpoint id |
QGON_RESUME_EPOCH |
Epoch recorded in the checkpoint (when present) |
QGON_RESUME_STEP |
Step recorded in the checkpoint (when present) |
QGON_RESUME_ERROR |
Why the checkpoint could not be received |
If the code uses neither these values nor qgon.resume_point(), the run trains again from the start. Restoring the optimizer, epoch and random state is up to your code.
Some values, such as variables starting with QGON_SERVE_, are injected by the server into test servings and fine-tuning jobs. They are only used inside the server, so do not change them.