Batch Size Issue in Maissi Generative Model Configuration
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- python, pytorch
- 領域
- data, machine-learning
調査の方向性
scripts/diff_model_train.py の prepare_data から始め、設定されたバッチサイズが ThreadDataLoader の呼び出しにどのように渡されるかを調べてください。記録された len(train_loader) をトレーニングファイル数と比較し、実際の loader 設定を確認してください。設定されたバッチサイズが実際に loader の動作に反映されているか、または不一致の理由が説明されれば、issue は完了です。
索引モデルが issue の本文から書いたものです。
説明
Dear Dong Yang (@dongyang0122),
I hope this message finds you well. Thank you in advance for your time and support.
I am currently working with the Maissi generative model and planning to accelerate the training process by increasing the batch size. However, I encountered an issue where, despite modifying the batch size in the configuration file, the DataLoader batch size remains set to 1.
Could you kindly advise on how to resolve this issue?
The log file is as bellow:
wherein the log is recorded base on the code:
if local_rank == 0:
logger.info(
"[{0}] epoch {1}, iter {2}/{3}, loss: {4:.4f}, lr: {5:.12f}.".format(
str(datetime.now())[:19], epoch + 1, _iter, len(train_loader), loss.item(), current_lr
)
)
Note that the number of itereation is equal to the length of train_loader and the number of training set is 1000. In my understanding, the enlarged batch size should decrease the length of train_loader. However, the length of train_loader is still equal to 1000 (the number of training set), which seems that the batch size is 1.
Additionaly, the corresponding code for data loader is in the scripts.diff_model_train.py:
def prepare_data(
train_files: list, device: torch.device, cache_rate: float, num_workers: int = 2, batch_size: int = 1
) -> ThreadDataLoader:
"""
Prepare training data.
Args:
train_files (list): List of training files.
device (torch.device): Device to use for training.
cache_rate (float): Cache rate for dataset.
num_workers (int): Number of workers for data loading.
batch_size (int): Mini-batch size.
Returns:
ThreadDataLoader: Data loader for training.
"""
train_transforms = Compose(
[
monai.transforms.LoadImaged(keys=["image"]),
monai.transforms.EnsureChannelFirstd(keys=["image"]),
monai.transforms.Lambdad(
keys="top_region_index", func=lambda x: torch.FloatTensor(json.load(open(x))["top_region_index"])
),
monai.transforms.Lambdad(
keys="bottom_region_index", func=lambda x: torch.FloatTensor(json.load(open(x))["bottom_region_index"])
),
monai.transforms.Lambdad(keys="spacing", func=lambda x: torch.FloatTensor(json.load(open(x))["spacing"])),
monai.transforms.Lambdad(keys="top_region_index", func=lambda x: x * 1e2),
monai.transforms.Lambdad(keys="bottom_region_index", func=lambda x: x * 1e2),
monai.transforms.Lambdad(keys="spacing", func=lambda x: x * 1e2),
]
)
train_ds = monai.data.CacheDataset(
data=train_files, transform=train_transforms, cache_rate=cache_rate, num_workers=num_workers
)
return ThreadDataLoader(train_ds, num_workers=6, batch_size=batch_size, shuffle=True)
- 主要言語
- Jupyter Notebook
- スター
- 2.5k
- フォーク
- 803
- 平均マージ
- 6日 22時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Project-MONAI/tutorials のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
Project-MONAI/tutorials#2076 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
Project-MONAI/tutorials#2069 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
Project-MONAI/tutorials#1704 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
Project-MONAI/tutorials#2071 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
Project-MONAI/tutorials#2067 ·
Project-MONAI/tutorials の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Schema-level dtype cannot be serialized: to_yaml raises RepresenterError, to_json raises TypeError オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
unionai-oss/pandera#2511 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
unitaryfoundation/qldpc-challenge#1651 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
statsmodels/statsmodels#10271 ·