# PyTorch

PyTorch is an S3 native library. Prior to starting a session that accesses and stores data in and to UltiHash, the user should ensure that their UltiHash credentials are exported in their working terminal and then can proceed as follows:

```python
import s3torchconnector

# Define S3 region (could be any, since the custom S3 endpoint is used)
REGION = "us-east-1"
# Define the endpoint URL for the UltiHash cluster
ENDPOINT_URL = "<https://ultihash.cluster>"

# Enforce the path style URLs
config = s3torchconnector.S3ClientConfig(force_path_style=True)

# EXAMPLE 1: Create a dataset from the data stored on the UltiHash bucket named "test-data"
dataset = s3torchconnector.S3MapDataset.from_prefix(
    "s3://test-data/", 
    endpoint=ENDPOINT_URL, 
    region=REGION, 
    s3client_config=config
)

# EXAMPLE 2: Create a checkpoint
checkpoint = s3torchconnector.S3Checkpoint(
    region=REGION, 
    endpoint=S3_ENDPOINT, 
    s3client_config=config
)
```


---

# 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://docs.ultihash.io/operations/prebuilt-connections/pytorch.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.
