Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSL finetuning bug #510

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pytorch_tabular/tabular_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def setup(self, stage: Optional[str] = None) -> None:
else:
self.validation = self.validation.copy()
# Preprocessing Train, Validation
self.train, _ = self.preprocess_data(self.train, stage="fit" if not is_ssl else "inference")
self.train, _ = self.preprocess_data(self.train, stage="inference" if is_ssl else "fit")
self.validation, _ = self.preprocess_data(self.validation, stage="inference")
self._fitted = True
self._cache_dataset()
Expand Down
4 changes: 3 additions & 1 deletion src/pytorch_tabular/tabular_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,13 +1001,15 @@ def create_finetune_model(
logger.info("Renaming the experiment run for finetuning as" f" {config['run_name'] + '_finetuned'}")
config["run_name"] = config["run_name"] + "_finetuned"

config_override = {"target": target} if target is not None else {}
config_override["task"] = task
datamodule = self.datamodule.copy(
train=train,
validation=validation,
target_transform=target_transform,
train_sampler=train_sampler,
seed=seed,
config_override={"target": target} if target is not None else {},
config_override=config_override,
)
model_callable = _GenericModel
inferred_config = OmegaConf.structured(datamodule._inferred_config)
Expand Down
Loading