Logging text#

You have several options for logging text to a Neptune object.

Free-form text#

Small piece of text#

You can assign a single string to a field:

# Log single string
run["aux/text"] = "Text I keep track of, like query or tokenized word"


or iteratively log a series of short text entries (max 1000 characters) with the log() method:

# Log series of strings to the same field
for epoch in range(epochs_nr):
token = str(...)
run["train/tokens"].log(token)


Long piece of text#

If your string is long, it may be handier to upload as a text file instead.

• Option A) Log the text as a file by utilizing the from_content() method of the Python API:

from neptune.new.types import File

run["large_text_as_file"].upload(File.from_content(variable_with_my_text))

• Option B) Manually save your text as a file on disk, then upload that:

run["large_text_file"].upload("my_text.txt")


Description of the run or model#

Pass some text to the description argument at initialization:

# Adding a description to a run
run = neptune.init_run(
description="NN trained on Fashion-MNIST with high LR and low dropout",
)

# Adding a description to a model
model = neptune.init_model(
key="FOREST",
description="Random forest classification model",
)

# Adding a description to a model version
model_version = neptune.init_model_version(
model="CLS-FOREST",
description="Model version fine-tuned on new data",
)


This stores the tags in the sys/description field.

You can also edit the description field directly:

1. In the left pane of the run or model view, select Details.
2. Edit the Description field.
3. Save your changes.
run["sys/description"] = "Neural net trained on Fashion-MNIST"


Tip

You can use emoji in any string (except StringSeries fields):

run = init_run(name="Special run ⭐️")