allenai / allenai/hci-alt-texts
Issue with `train` function
- Dominant language
- Jupyter Notebook
- Stars
- 13
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
In the file `models/semantic_level_classifier/scibert_classifier.py` I believe that the 'fit' function has unexpected behaviour as for `trainer.fit`, the whole DataLoader is being passed, and not just the`train_dataloader`, aka `trainer.fit(model, dm.train_dataloader())`
I was facing an issue with the progress bar and noticed this issue.
```
def train(model, train_file, val_file, outdir, logname, device_type, devices):
dm = DataModule(train_file=train_file, val_file=val_file, model_name_or_path=model)
dm.setup(stage="fit")
model = TransformerModule(warmup_steps=200, model_name_or_path=model)
logger = TensorBoardLogger(outdir, name=logname)
checkpoint_callback = ModelCheckpoint(
dirpath=os.path.join(outdir, 'checkpoints'),
save_top_k=1,
verbose=True,
monitor='val_loss',
mode='min'
)
trainer = Trainer(
accelerator=device_type,
devices=devices,
progress_bar_refresh_rate=5,
max_epochs=16,
default_root_dir=outdir,
logger=logger,
callbacks=[checkpoint_callback]
)
trainer.fit(model, dm)
trainer.validate(model, dm.val_dataloader())
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.