shenweichen / shenweichen/DeepCTR-Torch

Cannot restore best weights with DeepFM model

Open
#262 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
733
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm using deepctr-torch 0.2.9.
In my code I'm using EarlyStopping as follow:

es = EarlyStopping(monitor='loss', min_delta=0, verbose=1, patience=5, mode='min', restore_best_weights=True)
mdckpt = ModelCheckpoint(filepath='model/model.ckpt', monitor='val_mse', verbose=1,
                         save_best_only=True, mode='min')

history = model.fit(train_model_input, train[target].values, batch_size=128, epochs=100,
                    validation_split=0.1, callbacks=[es, mdckpt], verbose=2)

But when I fit my model I encountered this exception AttributeError: 'DeepFM' object has no attribute 'get_weights'.
Is there anyone know the way to resolve this exception ?
Thank you so much.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided model.fit call with DeepFM, EarlyStopping, and restore_best_weights=True, then inspect how EarlyStopping accesses model weights and how DeepFM exposes them. Done means the training example completes without the AttributeError and best-weight restoration works as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.