Commit 528c9ad
committed
[Feature] Add Redis-backed TensorDict (RedisTensorDict)
Adds RedisTensorDict, a TensorDictBase subclass that stores tensors in a
Redis instance for out-of-core storage. This enables datasets that exceed
local RAM to be accessed with the familiar TensorDict interface.
MVP features:
- Async redis.asyncio client on a background event loop with sync wrappers
- Zero-copy serialization via torch.frombuffer / untyped_storage bytes
- Metadata (shape, dtype) stored in Redis Hashes for fast introspection
- Redis Cluster-compatible key schema using hash tags
- Pipelined batch I/O for all get/set operations
- Nested TensorDict support via lightweight prefix-based views
- Pickle support for multi-process usage
- from_dict() factory, to_local() / to_tensordict() materialization
- CI: install redis package and start redis-server before tests
ghstack-source-id: 6cb2eff
Pull-Request: pytorch#15671 parent 824e231 commit 528c9ad
6 files changed
Lines changed: 1815 additions & 1 deletion
File tree
- .github/unittest/linux/scripts
- tensordict
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
29 | 46 | | |
30 | 47 | | |
31 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
0 commit comments