Skip to content

Client reference

Dream Labs client: record a robot body, fine-tune Dream-1 on a dataset, and call the result for actions.

The public namespace is dream.DreamClient, the error types, the one warning type (dream.DreamSlowNetworkWarning, when the round trips to the model stay slow) and dream.__version__, plus three submodules DreamClient is a front over: dream.datasets (embodiments and datasets on the data service), dream.fine_tuning (fine-tuning jobs on the data service) and dream.models (the checkpoints an account may run, on the platform). DreamClient is the one object every caller uses: it carries the key, forwards to those modules, and runs the model: policy() chooses it, set_observation() hands it every camera tick, and get_action() asks it for the next chunk. The two errors only the dataset upload raises, DreamDatasetError and DreamUploadError, are imported from dream.errors.

dream.LiveViewClient (dream.live) shows the robot on the platform’s Live View page: stream() its observations and status, get_prompt() the task a viewer sent, and register a callback for the EventChange a viewer makes.

dream.DebugView (dream.debug_view) shows what the model sees on a page on this computer: the frames, the state, the chunk, the timing and any refusal of every get_action(), each a dream.RoundTrip that DreamClient.on_round_trip() also hands to your own code.

dream.__version__ is the version of the installed library, read from its package metadata when dream is imported. A library installed from PyPI reports its release, such as "0.0.6"; one built by the Dream Labs platform also carries the commit it was built from, as in "0.0.6+g<commit>" (PyPI takes no such suffix). Quote it in a bug report.

Example

import dream

client = dream.DreamClient()  # the key comes from ~/.dreamlabs/credentials
client.add_embodiment("metal-arm", config)
dataset = client.upload_dataset("~/data/towels", "towels-v1", "<your-username>/metal-arm")
# ... poll client.get_dataset_status(dataset.id) until its status is "processed" ...
job = client.finetune(dataset.name, "towels")
# ... poll client.get_finetuning_status(job["id"]) until job["fine_tuned_model"] is set ...
client.policy({"checkpoint": job["fine_tuned_model"]})
while running:
    client.set_observation(frames, observation)  # every camera tick
    if due:
        chunk = client.get_action()
  • DreamClient: One client for embodiments, datasets, fine-tuning, models and inference, with the key bound once.
  • DebugView: Serves the page of a client’s round trips on 127.0.0.1, from now until close() or the program’s exit.
  • EventChange: What a viewer did from the Live View page; the argument of every registered callback.
  • LiveViewClient: Shows one robot on the platform’s Live View page: its cameras, status and arms, and the buttons viewers press.
  • RoundTrip: One get_action(): what the model was sent and what came back; DreamClient.on_round_trip() hands it over.
  • Embodiment: A robot body as the service records it; pass its name to upload_dataset().
  • Report: What the local checks found: ok and the counts, or the one line that refused the dataset.
  • Dataset: One of your datasets on the service; keep its id to follow its status.
  • Model: One checkpoint your account may run; pass its id to DreamClient.policy() as checkpoint.
  • DreamError: Base of every error the client raises; also raised as itself when a client is used wrongly.
  • DreamConfigError: Something the caller passed or configured is wrong; the message says what, and the same call fails again.
  • DreamBadRequest: The model refused the request as malformed (DA-4000); never retryable, the request must change.
  • DreamObservationError: An observation that cannot be sent; raised before anything is sent, with the key named in the message.
  • DreamActionError: The model’s reply is not an action the client can return; nothing is returned, and the message names the key.
  • DreamTimeout: The model did not answer within timeout_ms (15000 ms unless the config sets it).
  • DreamProtocolError: No answer the client could read: the host could not be reached, or what answered is not the Dream API.
  • DreamServerError: A refusal, carried with the answer’s code and reason; whether to call again is retryable.
  • DreamAuthError: The API key was refused; never retryable: check the key, or the account, before calling again.
  • DreamSessionExpired: The model replaced the session in the middle of an episode (DA-0001 with a reason other than new).
  • DreamSlowNetworkWarning: A Python warning, not an error: the inference client’s recent round trips are slow, and the robot’s motion may be less smooth.
  • DreamDatasetError: The local checks refused the dataset, and nothing was sent; str(error) is the one line to fix.
  • DreamUploadError: An upload that did not finish; str(error) is the one line, and running the upload again retries it.
  • dream.datasets: Embodiments and datasets on the Dream Labs data service: describe a robot body, check a dataset locally, upload it.
  • dream.fine_tuning: Fine-tuning jobs on the Dream Labs data service: train Dream-1 on an uploaded dataset, then run the result.
  • dream.models: Models on the Dream Labs platform: the checkpoints your account may run.
  • dream.errors: The errors the dream client raises.
  • dream.live: Live View for any control loop: the robot’s cameras, status and arms on the platform, and the page’s buttons.

What each status code of the inference gateway means, and what the client raises for it: Error codes.

dream.__version__: str = '1.0.47'

The version of the client this reference was generated from.