Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pytorch notebook #551

Merged
merged 6 commits into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def obs_batch(self) -> pd.DataFrame:
class ExperimentDataPipe(pipes.IterDataPipe[Dataset[ObsDatum]]): # type: ignore
"""
An iterable-style PyTorch ``DataPipe`` that reads obs and X data from a SOMA Experiment, and returns an iterator of
tuples of PyTorch ``Tensor``s:
tuples of PyTorch ``Tensor`` objects.

>>> (tensor([0., 0., 0., 0., 0., 1., 0., 0., 0.]), # X data
tensor([2415, 0, 0], dtype=torch.int32)) # obs data, encoded
Expand Down Expand Up @@ -459,9 +459,9 @@ def experiment_dataloader(
**dataloader_kwargs: Any,
) -> DataLoader:
"""
Factory method for PyTorch ``DataLoader``. Provides a safer, more convenient interface for instantiating a
``DataLoader`` that works with the ``ExperimentDataPipe``, since not all of ``DataLoader``'s params can be
used (``batch_size``, ``sampler``, ``batch_sampler``, ``collate_fn``).
Factory method for PyTorch ``DataLoader``. This method can be used to safely instantiate a
``DataLoader`` that works with the ``ExperimentDataPipe``, since not all of the ``DataLoader`` constructor params
can be used (``batch_size``, ``sampler``, ``batch_sampler``, ``collate_fn``).

Returns:
PyTorch ``DataLoader``.
Expand Down
Loading