-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from grok-ai/feature/hf-integration
Add hf datasets integration
- Loading branch information
Showing
20 changed files
with
339 additions
and
208 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 |
---|---|---|
@@ -1 +1,10 @@ | ||
# While .env is a local file full of secrets, this can be public and ease the setup of known env variables. | ||
# .env.template is a template for .env file that can be versioned. | ||
|
||
# Set to 1 to show full stack trace on error, 0 to hide it | ||
HYDRA_FULL_ERROR=1 | ||
|
||
# Configure where huggingface_hub will locally store data. | ||
HF_HOME="~/.cache/huggingface" | ||
|
||
# Configure the User Access Token to authenticate to the Hub | ||
# HUGGING_FACE_HUB_TOKEN= |
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
22 changes: 22 additions & 0 deletions
22
{{ cookiecutter.repository_name }}/conf/nn/data/dataset/vision/mnist.yaml
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,22 @@ | ||
# This class defines which dataset to use, | ||
# and also how to split in train/[val]/test. | ||
_target_: {{ cookiecutter.package_name }}.utils.hf_io.load_hf_dataset | ||
name: "mnist" | ||
ref: "mnist" | ||
train_split: train | ||
# val_split: val | ||
val_percentage: 0.1 | ||
test_split: test | ||
label_key: label | ||
data_key: image | ||
num_classes: 10 | ||
input_shape: [1, 28, 28] | ||
standard_x_key: ${conventions.x_key} | ||
standard_y_key: ${conventions.y_key} | ||
transforms: | ||
_target_: {{ cookiecutter.package_name }}.utils.hf_io.HFTransform | ||
key: ${conventions.x_key} | ||
transform: | ||
_target_: torchvision.transforms.Compose | ||
transforms: | ||
- _target_: torchvision.transforms.ToTensor |
28 changes: 28 additions & 0 deletions
28
{{ cookiecutter.repository_name }}/conf/nn/data/default.yaml
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,28 @@ | ||
_target_: {{ cookiecutter.package_name }}.data.datamodule.MyDataModule | ||
|
||
val_images_fixed_idxs: [7371, 3963, 2861, 1701, 3172, | ||
1749, 7023, 1606, 6481, 1377, | ||
6003, 3593, 3410, 3399, 7277, | ||
5337, 968, 8206, 288, 1968, | ||
5677, 9156, 8139, 7660, 7089, | ||
1893, 3845, 2084, 1944, 3375, | ||
4848, 8704, 6038, 2183, 7422, | ||
2682, 6878, 6127, 2941, 5823, | ||
9129, 1798, 6477, 9264, 476, | ||
3007, 4992, 1428, 9901, 5388] | ||
|
||
accelerator: ${train.trainer.accelerator} | ||
|
||
num_workers: | ||
train: 4 | ||
val: 2 | ||
test: 0 | ||
|
||
batch_size: | ||
train: 512 | ||
val: 128 | ||
test: 16 | ||
|
||
defaults: | ||
- _self_ | ||
- dataset: vision/mnist # pick one of the yamls in nn/data/ |
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 |
---|---|---|
@@ -1,47 +1,23 @@ | ||
data: | ||
_target_: {{ cookiecutter.package_name }}.data.datamodule.MyDataModule | ||
|
||
datasets: | ||
train: | ||
_target_: {{ cookiecutter.package_name }}.data.dataset.MyDataset | ||
|
||
# val: | ||
# - _target_: {{ cookiecutter.package_name }}.data.dataset.MyDataset | ||
|
||
test: | ||
- _target_: {{ cookiecutter.package_name }}.data.dataset.MyDataset | ||
|
||
accelerator: ${train.trainer.accelerator} | ||
|
||
num_workers: | ||
train: 8 | ||
val: 4 | ||
test: 4 | ||
|
||
batch_size: | ||
train: 32 | ||
val: 16 | ||
test: 16 | ||
|
||
# example | ||
val_percentage: 0.1 | ||
data: ??? | ||
|
||
module: | ||
_target_: {{ cookiecutter.package_name }}.pl_modules.pl_module.MyLightningModule | ||
|
||
optimizer: | ||
# Adam-oriented deep learning | ||
_target_: torch.optim.Adam | ||
# These are all default parameters for the Adam optimizer | ||
lr: 0.001 | ||
lr: 1e-3 | ||
betas: [ 0.9, 0.999 ] | ||
eps: 1e-08 | ||
weight_decay: 0 | ||
|
||
lr_scheduler: | ||
_target_: torch.optim.lr_scheduler.CosineAnnealingWarmRestarts | ||
T_0: 10 | ||
T_mult: 2 | ||
eta_min: 0 # min value for the lr | ||
last_epoch: -1 | ||
verbose: False | ||
# lr_scheduler: | ||
# _target_: torch.optim.lr_scheduler.CosineAnnealingWarmRestarts | ||
# T_0: 20 | ||
# T_mult: 1 | ||
# eta_min: 0 | ||
# last_epoch: -1 | ||
# verbose: False | ||
|
||
|
||
defaults: | ||
- _self_ | ||
- data: default | ||
- module: default |
7 changes: 7 additions & 0 deletions
7
{{ cookiecutter.repository_name }}/conf/nn/module/default.yaml
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,7 @@ | ||
_target_: {{ cookiecutter.package_name }}.pl_modules.pl_module.MyLightningModule | ||
x_key: ${conventions.x_key} | ||
y_key: ${conventions.y_key} | ||
|
||
defaults: | ||
- _self_ | ||
- model: cnn |
2 changes: 2 additions & 0 deletions
2
{{ cookiecutter.repository_name }}/conf/nn/module/model/cnn.yaml
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,2 @@ | ||
_target_: {{ cookiecutter.package_name }}.modules.module.CNN | ||
input_shape: ${nn.data.dataset.input_shape} |
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
Oops, something went wrong.