activeloopai / activeloopai/deeplake

[FEATURE] Accessing dataset index as if it's a dictionary

Đang mở
#319 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
enhancement feature-discussion
Ngôn ngữ chính
C++
Star
9.2k
Fork
722
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 🚨🚨 Feature Request

- [ ] A new implementation

### Is your feature request related to a problem?

Instead of accessing elements in a dataset by index, sometimes users prefer to provide a key instead of an index.

### If your feature will improve `HUB`

Improves user experience for accessing datasets with a key instead of an index. The drawback is that the user would miss chunked access and this will inherently add an inefficiency.

### Description of the possible solution

A key could be a tensor inside the dataset, which will be loaded to the RAM and map key -> index. Then the user can use a special API to query the key from the dataset.

**Teachability, Documentation, Adoption, Migration Strategy**
here is a proposal that conflicts with nested tensor access, but provides a clear explanation.
```python
schema = {
"image": Image(shape=(None, None, 3), max_shape=(1920, 1920, 3), dtype="uint8"),
"id": Text(max_shape=(15,)),
}

ds = Dataset(tag, mode="w+", schema=my_schema, shape=(100,), primary_key="id")
ds["id", 0] = "sometext"
assert ds["image", 0] == ds["image", "sometext"]
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.