# pipe\_model

## Function: pipe\_model

```python
pipe_model(
    name: str = "InputYourModelName",
    config: Optional[dict] = None,
    **kwargs
) -> Union[BarlowTwins, BYOL, MoCo, SimCLR, SimSiam, VICReg]
```

### Description

The `pipe_model` function provides a convenient way to instantiate different types of models used in the Self-Supervised Learning (SSL) setting. It supports six types of models: `MoCo`, `BYOL`, `SimCLR`, `SimSiam`, `BarlowTwins`, and `VICReg`.

### Parameters

* `name` (str, default="InputYourModelName"): The name of the model to instantiate. Accepted values include `"MoCo"`, `"BYOL"`, `"SimCLR"`, `"SimSiam"`, `"BarlowTwins"`, and `"VICReg"`.
* `config` (dict, optional): A configuration dictionary that can be used to specify the `backbone`, `stop_gradient`, and `prjhead_dim` parameters for the model. If not provided, these parameters should be passed through `kwargs`.
* `**kwargs`: Additional parameters to be passed to the model constructor. These may include `backbone`, `stop_gradient`, and `prjhead_dim`.

### Returns

An instance of the specified model.

### Examples

Using `config` dictionary:

```python
config = {
    "backbone": "resnet50",
    "stop_gradient": True,
    "prjhead_dim": 128,
    "model": "MoCo"
}
model = pipe_model(config=config)
```

Using `**kwargs`:

```python
model = pipe_model(name="MoCo", backbone="resnet50", stop_gradient=True, prjhead_dim=128)
```

### Use Cases

* When you need to create an instance of a specific SSL model for your training or inference tasks.
* When you want to change the SSL model for experimenting with different learning algorithms and architectures.
* When you need to customize the models by specifying different backbones or settings for the projection head dimension and gradient stopping.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://autossl.gitbook.io/autossl/api/model/pipe_model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
