allenai / allenai/hci-alt-texts

Issue with `train` function

Offen
#6 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Jupyter Notebook
Sterne
13
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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())

```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.