Update README.md
Browse files47 unmodified lines48495051525354555657585960616263646566676869707172737475767778798081828384858647 unmodified linesmolecular_dataset = load_dataset("Lab-Rasool/TCGA", "molecular", split="train")```
Example code for loading HF dataset into a PyTorch Dataloader.**Note**: Some embeddings are stored as buffers due to their multi-dimensional shape.
```pythonfrom datasets import load_datasetimport osfrom torch.utils.data import Datasetimport numpy as np
class CustomDataset(Dataset): def __init__(self, hf_dataset): self.hf_dataset = hf_dataset
def __len__(self): return len(self.hf_dataset) def __getitem__(self, idx): hf_item = self.hf_dataset[idx] embedding = np.frombuffer(hf_item["embedding"], dtype=np.float32) embedding_shape = hf_item["embedding_shape"] embedding = embedding.reshape(embedding_shape) return embedding
if __name__ == "__main__": clinical_dataset = load_dataset("Lab-Rasool/TCGA", "clinical", split="train") wsi_dataset = load_dataset("Lab-Rasool/TCGA", "wsi", split="train") for index, item in enumerate(clinical_dataset): print(np.frombuffer(item.get("embedding"), dtype=np.float32).reshape(item.get("embedding_shape")).shape) break```
## Dataset Creation
#### Data Collection and ProcessingREADME.md+33