# pipe\_collate

## Function: pipe\_collate

```python
def pipe_collate(address, reg):
```

### Description

`pipe_collate` is a function that scans through a given directory and filters subdirectories that match a specific regular expression. For each matching subdirectory, it finds the latest checkpoint of a trained model, loads the model, and collates relevant information into a pandas DataFrame. This DataFrame is then saved as a CSV file.

### Parameters

* `address` (str): The directory to search for trained model checkpoints.
* `reg` (str): A regular expression used to filter the subdirectories in the specified directory.

### Returns

This function returns a dictionary containing the names of the directories, the models loaded from these directories, and the address of the created CSV file.

* `name` (list of str): The names of the directories matching the regular expression.
* `model` (list of torch.nn.Module): The list of models loaded from the checkpoints found in the matching directories.
* `address` (str): The path to the created CSV file that contains the collated information.

### Example

Here's an example of how to use the `pipe_collate` function:

```python
results = pipe_collate("/path/to/model/directory", "batch_*")
```

This code scans the directory at `/path/to/model/directory`, filters subdirectories that start with "batch\_", finds the latest checkpoint file in each subdirectory, loads the model from the checkpoint, and collates relevant information into a CSV file. The returned dictionary from the function will contain the directory names, the loaded models, and the address of the CSV file.


---

# 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/evaluate/pipe_collate.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.
