Repository: pytorch
Issue: Refactor serialization IO infrastructure and support HDFS/HTTP
Labels: module: serialization,triaged

### 🚀 The feature, motivation and pitch

## Background
Currently, serialization.py does not support IO abstraction. As a result, torch.save and torch.load only support local disk file.
But in most cases, we hope to save the models remotely, e.g. cloud storage or remote server. There are 2 ways to use remote storage at this time:
### download to local
Easy to understand and handle. Every time we hope to save the model, call torch.save, and upload it manually. Similar thing happens when loading a model file from cloud, we have to download the model file to local disk and then call torch.load.
### fuse
FUSE is a userspace filesystem framework. It makes it possible for developer to build a filesystem in user space instead of kernel. [sshfs](https://github.com/libfuse/sshfs) is an example. network filesystem client to connect to SSH servers.

```
                                                                                                +-----------+
USER                                                            +------------------------------>|HDFS cluser|
                                                                |                               +-----------+
        +-------+                                         +-----------+
        |pytorch|                                         |fuse daemon|                         +-----------+
        +-------+                                         +-----------+------------------------>|    S3     |
            |                                                   |                               +-----------+
            | torch.save()                                      | handle fuse write
            |                                                   |
-------------------------------------------------------------------------------------
KERNEL      |                                                   |
            | sys.write()                                       |
	    |                                                   |
	    |                     +--------+                    |
	    +-------------------->|fuse dev|--------------------+
				  +--------+
```

## New IO abstraction
I am going to introduce an IO abstraction for pytorch serialization, also implement 3 new IO drivers:
* file: Compatible with current syntax. Users could save/load models locally. 
* hdfs: Support save/load to HDFS.
* http: Support load from HTTP server.

User can also implement other storage protocols easily, by inheriting base class and implement its own IO methods.

By doing this, we have some advantages:
* Rather than upload/download to local disk file manually, this new framework makes it diskless and convenient.
* Compared to fuse-based filesystem, pytorch read/write data directly. The shorter path reduce cpu and memory of fuse. Besides, we can also avoid pytorch IO stuck in D state (uninterruptable in Linux Kernel) when the network is down.

## Syntax Example
```
>>> # Save to HDFS
>>> x = torch.rand(3,5)
>>> torch.save(x, 'hdfs://ip:port/tensor.pt')

>>> # Load a module from HDFS
>>> torch.load('hdfs://ip:port/tensor.pt', weights_only=True)
```

### Alternatives

_No response_

### Additional context

_No response_

cc @mruberry @mikaylagawarecki