This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor file loading to use fsspec (#1387)
- Loading branch information
1 parent
86e3781
commit fd8cc7f
Showing
42 changed files
with
1,218 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.. _remote_data_loading: | ||
|
||
******************* | ||
Remote Data Loading | ||
******************* | ||
|
||
Where possible, all file loading in Flash uses the `fsspec library <https://github.com/fsspec/filesystem_spec>`_. | ||
As a result, file references can use any of the protocols returned by ``fsspec.available_protocols()``. | ||
|
||
For example, you can load :class:`~flash.tabular.classification.data.TabularClassificationData` from a URL to a CSV file: | ||
|
||
.. testcode:: tabular | ||
|
||
from flash.tabular import TabularClassificationData | ||
|
||
datamodule = TabularClassificationData.from_csv( | ||
categorical_fields=["Sex", "Age", "SibSp", "Parch", "Ticket", "Cabin", "Embarked"], | ||
numerical_fields="Fare", | ||
target_fields="Survived", | ||
train_file="https://pl-flash-data.s3.amazonaws.com/titanic.csv", | ||
val_split=0.1, | ||
batch_size=8, | ||
) | ||
|
||
Here's another example, showing how you can load :class:`~flash.image.classification.data.ImageClassificationData` for prediction using images found on the web: | ||
|
||
.. testcode:: image | ||
|
||
from flash.image import ImageClassificationData | ||
|
||
datamodule = ImageClassificationData.from_files( | ||
predict_files=[ | ||
"https://pl-flash-data.s3.amazonaws.com/images/ant_1.jpg", | ||
"https://pl-flash-data.s3.amazonaws.com/images/ant_2.jpg", | ||
"https://pl-flash-data.s3.amazonaws.com/images/bee_1.jpg", | ||
"https://pl-flash-data.s3.amazonaws.com/images/bee_2.jpg", | ||
], | ||
batch_size=4, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.