您可以使用 mlflow.client.MlflowClient.delete_traces
方法,根據特定準則刪除痕跡。 此方法可讓您依 實驗標識碼、 時間戳上限或 要求標識碼來刪除追蹤。
小提示
刪除痕跡是無法復原的過程。 請確定 API 內 delete_traces
提供的設定符合刪除的預期範圍。
import time
# Get the current timestamp in milliseconds
current_time = int(time.time() * 1000)
# Delete traces older than a specific timestamp
deleted_count = client.delete_traces(
experiment_id="1", max_timestamp_millis=current_time, max_traces=10
)
後續步驟
- 透過 SDK 查詢追蹤 - 在刪除之前搜尋追蹤資料,以確認您的條件
- 追蹤資料模型 - 瞭解刪除追蹤時會移除哪些數據
- 建置評估數據集 - 將重要的資料保存為數據集,以便在刪除之前保留它們。