pilot-model-share
ML model distribution with model cards, metadata, and version tracking.
Commands
Publish Model Availability
pilotctl --json publish "$PEER" models --data '{"type":"model_available","name":"resnet50","version":"1.0.0","framework":"pytorch"}'
Request Model
pilotctl --json send-message "$DEST" --data '{"type":"model_request","name":"resnet50","preferred_format":"onnx"}'
Send Model with Metadata
pilotctl --json send-message "$DEST" --data '{"type":"model_metadata","name":"llama3_8b","file":{"checksum":"abc123"}}'
pilotctl --json send-file "$DEST" "$MODEL_FILE"
Validate Checksum
EXPECTED_CHECKSUM=$(pilotctl --json inbox | jq -r '.messages[] | select(.type == "model_metadata") | .file.checksum' | head -1)
ACTUAL_CHECKSUM=$(md5sum "$RECEIVED_MODEL" | cut -d' ' -f1)
[ "$EXPECTED_CHECKSUM" = "$ACTUAL_CHECKSUM" ] && echo "Model verified"
Workflow Example
#!/bin/bash
# Model distribution
PEER="agent-b"
share_model() {
local model_file="$1"
local model_name="${2:-$(basename $model_file .pth)}"
pilotctl --json publish "$PEER" models --data "{\"type\":\"model_available\",\"name\":\"$model_name\"}"
}
share_model "model.pth" "my-model"
Dependencies
Requires pilot-protocol, pilotctl, jq, and md5sum.