Batch Size Issue in Maissi Generative Model Configuration
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 38/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- python, pytorch
- Domaine
- data, machine-learning
Piste de recherche
Commencez dans scripts/diff_model_train.py, au niveau de prepare_data, et examinez comment la taille de batch configurée parvient à l’appel de ThreadDataLoader. Comparez le len(train_loader) journalisé avec le nombre de fichiers d’entraînement et vérifiez la configuration effective du loader ; l’issue est terminée lorsque la taille de batch configurée est effectivement reflétée dans le comportement du loader ou que l’écart est expliqué.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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)
- Langage dominant
- Jupyter Notebook
- Étoiles
- 2.5k
- Forks
- 803
- Merge moyen
- 6 j 22 h
- PR mergées (30 j)
- 3
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Project-MONAI/tutorials
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
Project-MONAI/tutorials#2076 ·
-
Difficulté 1/5 1-3 heures Accessibilité débutants 76/100
Project-MONAI/tutorials#2069 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
Project-MONAI/tutorials#1704 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 62/100
Project-MONAI/tutorials#2071 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
Project-MONAI/tutorials#2067 ·
Toutes les issues de Project-MONAI/tutorials
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
indexing issue in correct_cte Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
Schema-level dtype cannot be serialized: to_yaml raises RepresenterError, to_json raises TypeError Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
unionai-oss/pandera#2511 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
unitaryfoundation/qldpc-challenge#1651 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
statsmodels/statsmodels#10271 ·