Export LibreYOLO
Overview
Converts a LibreYOLO detection checkpoint to PyTorch, ONNX, or TensorRT, whichever formats you tick, and attaches each result to the model version the weights came from.
The model then carries its weights and every format it has been exported to, and the model page lists them for download. A format already exported from the same checkpoint with the same settings is reused instead of converted again.
Use it after Train LibreYOLO when a checkpoint needs a deployment format.
Prerequisites
How it works
Checks each ticked format against the exports already on the model version and skips the ones built from the same checkpoint with the same settings.
Downloads the version’s weights once, for however many formats are left to build, and checks them before anything reads them: safetensors are built into the network LibreYOLO defines for the version’s architecture, and a LibreYOLO .pt is read by LibreYOLO itself, which only happens with safe weights off.
Hands it to LibreYOLO per format. The PyTorch target stages the weights file itself, model.safetensors for a version trained here, which LibreYOLO("model.safetensors") loads. The ONNX graph is traced at a fixed input shape with batch size 1 with the settings below, and the TensorRT engine is built from that graph.
FAQ
When does the node reuse an export?
When the model version already carries an export of that format built from the same checkpoint at the same precision and NMS settings. Every ticked format is checked separately, so a run can build one format and reuse another. Rerunning with the same settings therefore builds nothing new, except an ONNX or TensorRT export made before the node recorded its graph layout (see below), which is rebuilt once.
Does exporting create a new model version?
No. An export is another file on the version it came from, and the Model output is the same reference as the input, so downstream nodes keep running the original weights.
Why tick several formats in one run instead of one node each?
One run downloads the checkpoint once and attaches every format to the same version. A TensorRT engine is built from an ONNX graph, so ticking ONNX as well (in full precision) costs one trace rather than two.
What does the exported graph contain?
By default the graph ends at the raw head output, in FP32: one row per anchor with the box coordinates and the score of every class. It holds no NMS, so whoever runs it must filter by score and suppress overlaps. With Embed NMS, the ONNX graph ends in suppression instead: the first output holds up to Max detections rows of x1, y1, x2, y2, score, class for the image, in pixels of the model input and padded with zero rows, with the score and IoU thresholds baked into the file; the raw head output follows as a second output. The NMS graph is for one image at a time. A TensorRT engine is always built from the graph without NMS, whatever Embed NMS says: TensorRT 10.9 and 10.13 both refuse the NMS graph of a YOLOv9 model (its TopK ranks all 8400 anchors, above the 3840 TensorRT allows), so the node files the engine as a plain one and logs a warning. LibreYOLO9E2E models return their final detections from the head and need no NMS, so the node exports them as they are, whatever Embed NMS says, and files the export as a plain one. The PyTorch file is the checkpoint and is not affected. Every ONNX and TensorRT file is filed with how to read it: box_format: xyxy, letterbox_pad (topleft for LibreYOLO’s checkpoints), nms, end_to_end (true for LibreYOLO9E2E) and multi_label. The Benchmark runtime node reads these, since the shapes alone look like an Ultralytics head.
What do the FP16 options change?
ONNX FP16 traces the graph with the model converted to half precision, and TensorRT FP16 builds the engine in half precision. Exports at different precision or NMS settings are kept side by side on the version, and each is reused only for the same settings.
Which checkpoint does the node export?
The weights the picked version points at, which for a training run are its best weights, model.safetensors. Their bytes decide how they load, not their name: with safe weights on, a pickle (.pt, .pth) is refused before it is read, and an ONNX model is already an export, so the run stops.
Why does TensorRT need a GPU?
TensorRT builds its engine on a CUDA GPU and has no CPU fallback. The node runs on GPU machine classes only and checks the GPU works before it downloads or converts anything, so a run on a broken GPU stops before any format is built. Every format in the run, ONNX included, is exported on that GPU. An engine build can take several minutes.
What does this node not support?
Dynamic batch sizes, INT8, and other LibreYOLO export formats. At least one format must be ticked, or the run stops.
Why wasn't the checkpoint found?
The version may have no weights of its own, as with a model copied from the catalog. Train from the catalog model first, then export the version that run produced.
Inputs
Detection model whose weights are exported, e.g. a version trained in this workspace. A model copied from the catalog stores no weights of its own to attach exports to, so train from it first. Key: MODEL.
Attach the weights file itself as a PyTorch export - model.safetensors for a version trained here, which LibreYOLO("model.safetensors") loads. Key: EXPORT_PYTORCH.
Trace the checkpoint to an ONNX graph. By default the graph ends at the raw head output, in FP32, see Embed NMS and ONNX FP16. Key: EXPORT_ONNX.
Build a TensorRT engine. It is cut from an intermediate ONNX graph, so ticking ONNX as well costs one trace rather than two. Key: EXPORT_TENSORRT.
Put non-maximum suppression inside the ONNX graph. Off (the default), the graph ends at the raw head output: one row of box coordinates and class scores per anchor, which the caller must filter and suppress. On, the graph’s first output holds up to Max detections rows of x1, y1, x2, y2, score, class per image, in pixels of the model input, already suppressed (padded with zero rows), and the raw head output follows as a second one. Has no effect on the PyTorch file, and none on LibreYOLO9E2E models, whose end-to-end head already returns filtered detections without NMS. A TensorRT engine is always built without NMS: TensorRT cannot build the NMS graph of a YOLOv9 model. Key: NMS.
Detections below this score are dropped inside the graph. Baked into the file, only used with Embed NMS. Lower it (e.g. 0.001) when the graph feeds an mAP evaluation. Minimum: 0.001. Maximum: 1. Step: 0.001. Key: NMS_CONF.
Two boxes of one class overlapping more than this count as the same object. Baked into the file, only used with Embed NMS. Minimum: 0.01. Maximum: 1. Step: 0.01. Key: NMS_IOU.
Most detections the NMS graph returns per image. Baked into the file, only used with Embed NMS. Minimum: 1. Key: MAX_DET.
Trace the ONNX graph in half precision (the model is converted before tracing, so inputs and outputs are float16 too). Needs the GPU the run already has. Run it with an FP16-capable provider such as CUDA. Key: ONNX_FP16.
Build the engine with half-precision layers. Faster and lighter on GPU memory, at a small cost in accuracy, the engine’s input and output tensors stay float32. Key: TRT_FP16.
Outputs
Format keys this run produced, comma separated. Read by the download widget. Hidden from the flow editor. Key: EXPORT_FORMATS.
The model that was exported, as <model id>@<version id> - the same reference this node was given. An export is another file on that version, not a version of its own, so this output wires on to anything the input accepts. Shown as an artifact. Key: MODEL.
Runtime
The image carries TensorRT, NVIDIA software under NVIDIA’s license.
Details
- Configured image:
ovalbee/node-libreyolo:0.0.17, shared with the train and predict nodes. - Upstream base: the OvalBee PyTorch CUDA 12.8 base image, with
libreyolo==1.6.0, ONNX and TensorRT installed on top. - Exact CUDA, PyTorch, NVIDIA driver, and GPU compatibility depends on the image digest deployed by the worker.
JSON config
Machine-readable node interface for automation and advanced usage.