{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "f341fb11f7f5d77a4974ba8273c4cd55d67c21f0",
    "tool": "pyref",
    "version": "1.7.3"
  },
  "language": "python",
  "modules": [
    {
      "description": "# Contrastive Trainer API\n\nThis module provides a trainer for contrastive learning.\n\n**Classes**\n\n| Name | Description |\n| --- | --- |\n| `ContrastiveTrainer` | Trainer for contrastive learning |",
      "name": "contrastive",
      "path": "helia_edge.trainers.contrastive",
      "submodules": [],
      "summary": "Contrastive Trainer API",
      "symbols": [
        {
          "description": "Creates a self-supervised contrastive trainer for a model.",
          "examples": [],
          "id": "helia_edge.trainers.contrastive.ContrastiveTrainer",
          "kind": "class",
          "language": "python",
          "members": [
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.SAMPLES",
              "kind": "constant",
              "language": "python",
              "members": [],
              "name": "SAMPLES",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "SAMPLES = 'data'",
              "source": {
                "line": 20,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L20"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.LABELS",
              "kind": "constant",
              "language": "python",
              "members": [],
              "name": "LABELS",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "LABELS = 'labels'",
              "source": {
                "line": 21,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L21"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.AUG_SAMPLES_0",
              "kind": "constant",
              "language": "python",
              "members": [],
              "name": "AUG_SAMPLES_0",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "AUG_SAMPLES_0 = 'augmented_data_0'",
              "source": {
                "line": 22,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L22"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.AUG_SAMPLES_1",
              "kind": "constant",
              "language": "python",
              "members": [],
              "name": "AUG_SAMPLES_1",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "AUG_SAMPLES_1 = 'augmented_data_1'",
              "source": {
                "line": 23,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L23"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.augmenters",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "augmenters",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "augmenters: tuple[keras.Layer, keras.Layer]",
              "source": {
                "line": 26,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L26"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.encoder",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "encoder",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "encoder: keras.Model = encoder",
              "source": {
                "line": 66,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L66"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.projectors",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "projectors",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "projectors = projector if  else (projector, projector)",
              "source": {
                "line": 70,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L70"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.probe",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "probe",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "probe = probe",
              "source": {
                "line": 71,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L71"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.loss_metric",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "loss_metric",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "loss_metric = keras.metrics.Mean(name='loss')",
              "source": {
                "line": 73,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L73"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.encoder_metrics",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "encoder_metrics",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "encoder_metrics = []",
              "source": {
                "line": 74,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L74"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.probe_loss_metric",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "probe_loss_metric",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "probe_loss_metric = keras.metrics.Mean(name='probe_loss')",
              "source": {
                "line": 76,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L76"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.probe_metrics",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "probe_metrics",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "probe_metrics = []",
              "source": {
                "line": 77,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L77"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.metrics",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "metrics",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "metrics",
              "source": {
                "line": 128,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L128"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.compile",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "compile",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "compile(\n    encoder_optimizer: keras.Optimizer,\n    encoder_loss: keras.Loss,\n    encoder_metrics: list[keras.Metric] | None = None,\n    probe_optimizer: keras.Optimizer | None = None,\n    probe_loss: keras.Loss | None = None,\n    probe_metrics: list[keras.Metric] | None = None,\n    **kwargs={},\n)",
              "source": {
                "line": 79,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L79"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.fit",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "fit",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "fit(x=None, y=None, sample_weight=None, batch_size=None, validation_data=None, **kwargs={})",
              "source": {
                "line": 137,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L137"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.run_augmenters",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "run_augmenters",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "run_augmenters(x, y=None)",
              "source": {
                "line": 169,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L169"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.train_step",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "train_step",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "train_step(data)",
              "source": {
                "line": 282,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L282"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.test_step",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "test_step",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "test_step(data)",
              "source": {
                "line": 286,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L286"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.call",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "call",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "call(inputs)",
              "source": {
                "line": 290,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L290"
              },
              "summary": ""
            },
            {
              "description": "`staticmethod`",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.linear_probe",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "linear_probe",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "linear_probe(num_classes, **kwargs={})",
              "source": {
                "line": 293,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L293"
              },
              "summary": ""
            },
            {
              "description": "We only save the encoder model",
              "examples": [],
              "id": "helia_edge.trainers.contrastive.ContrastiveTrainer.save",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "save",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "save(filepath, overwrite=True, zipped=True, **kwargs={})",
              "source": {
                "line": 297,
                "path": "helia_edge/trainers/contrastive.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L297"
              },
              "summary": "We only save the encoder model"
            }
          ],
          "name": "ContrastiveTrainer",
          "params": [
            {
              "description": "The encoder model to be trained.",
              "name": "encoder",
              "type": "keras.Model"
            },
            {
              "description": "The projector model to be trained.",
              "name": "projector",
              "type": "keras.Model | tuple[keras.Model, keras.Model]"
            },
            {
              "default": "None",
              "description": "The augmenter to be used for data augmentation.",
              "name": "augmenter",
              "type": "keras.Layer | tuple[keras.Layer, keras.Layer] | None"
            },
            {
              "default": "None",
              "description": "The probe model to be trained. If None, no probe is used.",
              "name": "probe",
              "type": "keras.Layer | keras.Model | None"
            }
          ],
          "raises": [],
          "returns": [],
          "signature": "ContrastiveTrainer(\n    encoder: keras.Model,\n    projector: keras.Model | tuple[keras.Model, keras.Model],\n    augmenter: keras.Layer | tuple[keras.Layer, keras.Layer] | None = None,\n    probe: keras.Layer | keras.Model | None = None,\n)",
          "source": {
            "line": 18,
            "path": "helia_edge/trainers/contrastive.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/trainers/contrastive.py#L18"
          },
          "summary": ""
        }
      ]
    }
  ],
  "name": "helia_edge"
}
