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

Modified 2 files to update newsrec model #2125

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions recommenders/models/newsrec/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ def fit(
valid_behaviors_file,
test_news_file=None,
test_behaviors_file=None,
steps=None,
sumana-2705 marked this conversation as resolved.
Show resolved Hide resolved

):
"""Fit the model with train_file. Evaluate the model on valid_file per epoch to observe the training status.
If test_news_file is not None, evaluate it too.
Expand All @@ -212,6 +214,8 @@ def fit(
)

for batch_data_input in tqdm_util:
if steps is not None and steps>=steps:
break

step_result = self.train(batch_data_input)
step_data_loss = step_result
Expand Down
8 changes: 4 additions & 4 deletions tests/smoke/recommenders/recommender/test_newsrec_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_model_nrms(mind_resource_path):
assert model.run_eval(valid_news_file, valid_behaviors_file) is not None
assert isinstance(
model.fit(
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file,steps=1
),
BaseModel,
)
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_model_naml(mind_resource_path):
assert model.run_eval(valid_news_file, valid_behaviors_file) is not None
assert isinstance(
model.fit(
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file,steps=1
sumana-2705 marked this conversation as resolved.
Show resolved Hide resolved
),
BaseModel,
)
Expand Down Expand Up @@ -166,7 +166,7 @@ def test_model_lstur(mind_resource_path):
assert model.run_eval(valid_news_file, valid_behaviors_file) is not None
assert isinstance(
model.fit(
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file,steps=1
),
BaseModel,
)
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_model_npa(mind_resource_path):
assert model.run_eval(valid_news_file, valid_behaviors_file) is not None
assert isinstance(
model.fit(
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file
train_news_file, train_behaviors_file, valid_news_file, valid_behaviors_file,steps=1
),
BaseModel,
)
Loading