
A machine learning benchmark of in-the-wild distribution shifts, with data loaders, evaluators, and default models.
Repo p-lambda/wilds, read from GitHub 4 h ago. p-lambda has not joined Take My Repo.
p-lambda/wilds is a public repo on GitHub by p-lambda. A machine learning benchmark of in-the-wild distribution shifts, with data loaders, evaluators, and default models. It declares the MIT license on GitHub. It is written mainly in Python, has 605 stars and last changed on 2026-11-09. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-24.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
WILDS is a benchmark of in-the-wild distribution shifts spanning diverse data modalities and applications, from tumor identification to wildlife monitoring to poverty mapping.
The WILDS package contains:
In addition, the example scripts contain default models, optimizers, schedulers, and training/evaluation code. New algorithms can be easily added and run on all of the WILDS datasets.
For more information, please visit our website or read the main WILDS paper (1) and its follow-up integrating unlabeled data (2). For questions and feedback, please post on the discussion board.
We recommend using pip to install WILDS:
pip install wilds
If you have already installed it, please check that you have the latest version:
python -c "import wilds; print(wilds.__version__)"
# This should print "2.0.1". If it doesn't, update by running:
pip install -U wilds
If you plan to edit or contribute to WILDS, you should install from source:
git clone git@github.com:p-lambda/wilds.git
cd wilds
pip install -e .
In examples/, we provide a set of scripts that can be used to train models on the WILDS datasets. These scripts were also used to benchmark baselines in our papers [1, 2].
These scripts are not part of the installed WILDS package. To use them, you should install from source, as described above.
The WILDS package depends on the following requirements:
Running pip install wilds or pip install -e . will automatically check for and install all of these requirements
except for the torch-scatter and torch-geometric packages, which require a
quick manual install.
To run the example scripts, you will also need to install these additional dependencies:
pip install wandb.All baseline experiments in the paper were run on Python 3.8.5 and CUDA 10.1.
WILDS currently includes 10 datasets, which we've briefly listed below. For full dataset descriptions, please see our papers (1, 2).
| Dataset | Modality | Labeled splits | Unlabeled splits |
|---|---|---|---|
| iwildcam | Image | train, val, test, id_val, id_test | extra_unlabeled |
| camelyon17 | Image | train, val, test, id_val | train_unlabeled, val_unlabeled, test_unlabeled |
| rxrx1 | Image | train, val, test, id_test | - |
| ogb-molpcba | Graph | train, val, test | train_unlabeled, val_unlabeled, test_unlabeled |
| globalwheat | Image | train, val, test, id_val, id_test | train_unlabeled, val_unlabeled, test_unlabeled, extra_unlabeled |
| civilcomments | Text | train, val, test | extra_unlabeled |
| fmow | Image | train, val, test, id_val, id_test | train_unlabeled, val_unlabeled, test_unlabeled |
| poverty | Image | train, val, test, id_val, id_test | train_unlabeled, val_unlabeled, test_unlabeled |
| amazon | Text | train, val, test, id_val, id_test | val_unlabeled, test_unlabeled, extra_unlabeled |
| py150 | Text | train, val, test, id_val, id_test | - |
The WILDS package provides a simple, standardized interface for all datasets in the benchmark. This short Python snippet covers all of the steps of getting started with a WILDS dataset, including dataset download and initialization, accessing various splits, and preparing a user-customizable data loader. We discuss data loading in more detail in #Data loading.
from wilds import get_dataset
from wilds.common.data_loaders import get_train_loader
import torchvision.transforms as transforms
# Load the full dataset, and download it if necessary
dataset = get_dataset(dataset="iwildcam", download=True)
# Get the training set
train_data = dataset.get_subset(
"train",
transform=transforms.Compose(
[transforms.Resize((448, 448)), transforms.ToTensor()]
),
)
# Prepare the standard data loader
train_loader = get_train_loader("standard", train_data, batch_size=16)
# (Optional) Load unlabeled data
dataset = get_dataset(dataset="iwildcam", download=True, unlabeled=True)
unlabeled_data = dataset.get_subset(
"test_unlabeled",
transform=transforms.Compose(
[transforms.Resize((448, 448)), transforms.ToTensor()]
),
)
unlabeled_loader = get_train_loader("standard", unlabeled_data, batch_size=16)
# Train loop
for labeled_batch, unlabeled_batch in zip(train_loader, unlabeled_loader):
x, y, metadata = labeled_batch
unlabeled_x, unlabeled_metadata = unlabeled_batch
...
The metadata contains information like the domain identity, e.g., which camera a photo was taken from, or which hospital the patient's data came from, etc., as well as other metadata.
To allow algorithms to leverage domain annotations as well as other groupings over the available metadata, the WILDS package provides Grouper objects.
These Grouper objects are helper objects that extract group annotations from metadata, allowing users to specify the grouping scheme in a flexible fashion.
They are used to initialize group-aware data loaders (as discussed in #Data loading) and to implement algorithms that rely on domain annotations (e.g., Group DRO).
In the following code snippet, we initialize and use a Grouper that extracts the domain annotations on the iWildCam dataset, where the domain is location.
from wilds.common.grouper import CombinatorialGrouper
# Initialize grouper, which extracts domain information
# In this example, we form domains based on location
grouper = CombinatorialGrouper(dataset, ['location'])
# Train loop
for x, y_true, metadata in train_loader:
z = grouper.metadata_to_group(metadata)
...
For training, the WILDS package provides two types of data loaders. The standard data loader shuffles examples in the training set, and is used for the standard approach of empirical risk minimization (ERM), where we minimize the average loss.
from wilds.common.data_loaders import get_train_loader
# Prepare the standard data loader
train_loader = get_train_loader('standard', train_data, batch_size=16)
To support other algorithms that rely on specific data loading schemes, we also provide the group data loader.
In each minibatch, the group loader first samples a specified number of groups, and then samples a fixed number of examples from each of those groups.
(By default, the groups are sampled uniformly at random, which upweights minority groups as a result. This can be toggled by the uniform_over_groups parameter.)
We initialize group loaders as follows, using Grouper that specifies the grouping scheme.
# Prepare a group data loader that samples from user-specified groups
train_loader = get_train_loader(
"group", train_data, grouper=grouper, n_groups_per_batch=2, batch_size=16
)
Lastly, we also provide a data loader for evaluation, which loads examples without shuffling (unlike the training loaders).
from wilds.common.data_loaders import get_eval_loader
# Get the test set
test_data = dataset.get_subset(
"test",
transform=transforms.Compose(
[transforms.Resize((224, 224)), transforms.ToTensor()]
),
)
# Prepare the evaluation data loader
test_loader = get_eval_loader("standard", test_data, batch_size=16)
The WILDS package standardizes and automates evaluation for each dataset.
Invoking the eval method of each dataset yields all metrics reported in the paper and on the leaderboard.
from wilds.common.data_loaders import get_eval_loader
# Get the test set
test_data = dataset.get_subset(
"test",
transform=transforms.Compose(
[transforms.Resize((224, 224)), transforms.ToTensor()]
),
)
# Prepare the data loader
test_loader = get_eval_loader("standard", test_data, batch_size=16)
# Get predictions for the full test set
for x, y_true, metadata in test_loader:
y_pred = model(x)
# Accumulate y_true, y_pred, metadata
# Evaluate
dataset.eval(all_y_pred, all_y_true, all_metadata)
# {'recall_macro_all': 0.66, ...}
Most eval methods take in predicted labels for all_y_pred by default, but the default inputs vary across datasets and are documented in the eval docstrings of the corresponding dataset class.
In examples/, we provide a set of scripts that can be used to train models on the WILDS datasets.
python examples/run_expt.py --dataset iwildcam --algorithm ERM --root_dir data
python examples/run_expt.py --dataset civilcomments --algorithm groupDRO --root_dir data
python examples/run_expt.py --dataset fmow --algorithm DANN --unlabeled_split test_unlabeled --root_dir data
The scripts are configured to use the default models and reasonable hyperparameters. Training configurations are in examples/configs, including dataset-specific settings in examples/configs/datasets.py.
The first time you run these scripts, you might need to download the datasets. You can do so with the --download argument, for example:
# downloads (labeled) dataset
python examples/run_expt.py --dataset globalwheat --algorithm groupDRO --root_dir data --download
# additionally downloads all unlabeled data
python examples/run_expt.py --dataset globalwheat --algorithm groupDRO --root_dir data --download --unlabeled_split [...]
Note that downloading the large amount of unlabeled data is optional; unlabeled data will only be downloaded if some --unlabeled_split is set. (It does not matter which --unlabeled_split is set; all unlabeled data will be downloaded together.)
Alternatively, you can use the standalone wilds/download_datasets.py script to download the datasets, for example:
# downloads (labeled) data
python wilds/download_datasets.py --root_dir data
# downloads (unlabeled) data
python wilds/download_datasets.py --root_dir data --unlabeled
This will download all datasets to the specified data folder. You can also use the --datasets argument to download particular datasets.
Dataset archives are hosted in the WILDS Hugging Face collection. OGB-MolPCBA continues to use the official OGB/SNAP downloads. The mirrored releases have the same dataset contents, splits, and evaluation protocols as their CodaLab releases.
If your installed WILDS version still tries to download from CodaLab, install the updated code from this repository or download the archive files manually from the collection. To use a manually downloaded archive, extract it into the folder named after the archive, without .tar.gz:
mkdir -p data/iwildcam_v2.0
tar -xzf iwildcam_v2.0.tar.gz -C data/iwildcam_v2.0
Keep RELEASE_v2.0.txt at the root of that folder, then use get_dataset(dataset="iwildcam", root_dir="data", download=False). Separate unlabeled archives use their own folders, such as data/iwildcam_unlabeled_v1.0. Amazon, FMoW, and DomainNet each share one archive between their labeled and unlabeled loaders; extract those archives into the labeled dataset folder once.
Only releases listed in the Hugging Face collection are mirrored. Older releases remain outside this migration; existing local copies can still be used.
These are the sizes of each of our datasets, as well as their approximate time taken to train and evaluate the default model for a single ERM run using a NVIDIA V100 GPU.
| Dataset command | Modality | Download size (GB) | Size on disk (GB) | Train+eval time (Hours) |
|---|---|---|---|---|
| iwildcam | Image | 12.0 | 25 | 7 |
| camelyon17 | Image | 10.7 | 15 | 2 |
| rxrx1 | Image | 7.4 | 7 | 11 |
| ogb-molpcba | Graph | 0.04 | 2 | 15 |
| globalwheat | Image | 10.3 | 10 | 2 |
p-lambda/wilds is a public repo on GitHub by p-lambda. A machine learning benchmark of in-the-wild distribution shifts, with data loaders, evaluators, and default models.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-09. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run wilds. What is known comes from GitHub. It declares the MIT license on GitHub. Its last change was on 2026-11-09. It has 605 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.