Keras 3 API 文档 / 回调 API / RemoteMonitor

RemoteMonitor

[源]

RemoteMonitor

keras.callbacks.RemoteMonitor(
    root="http://localhost:9000",
    path="/publish/epoch/end/",
    field="data",
    headers=None,
    send_as_json=False,
)

用于向服务器流式传输事件的回调类。

需要安装 requests 库。默认情况下,事件会发送到 root + '/publish/epoch/end/'。使用 HTTP POST 请求,其中 data 参数是事件数据的 JSON 编码字典。如果 send_as_json=True,请求的内容类型将是 "application/json"。否则,序列化的 JSON 将在表单中发送。

参数

  • root: 字符串;目标服务器的根 URL。
  • path: 字符串;事件将发送到的、相对于 root 的路径。
  • field: 字符串;数据将存储在其中的 JSON 字段。仅当负载在表单中发送时(即当 send_as_json=False 时)才使用此字段。
  • headers: 字典;可选的自定义 HTTP 头部。
  • send_as_json: 布尔值;请求是否应以 "application/json" 形式发送。