Shortcuts

Remote Data Loading

Where possible, all file loading in Flash uses the fsspec library. As a result, file references can use any of the protocols returned by fsspec.available_protocols().

For example, you can load TabularClassificationData from a URL to a CSV file:

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 ImageClassificationData for prediction using images found on the web:

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,
)
Read the Docs v: stable
Versions
latest
stable
0.8.1
0.8.0
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0post1
Downloads
html
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.