Skip to content

Commit

Permalink
Directories structure discrepancy in internal tests and github CI
Browse files Browse the repository at this point in the history
Summary: Fixes directories structure discrepancy in internal tests and github CI, which curently causes one of the unit tests to fail in github CI

Reviewed By: danielrjiang

Differential Revision:
D56959841

Privacy Context Container: L1202097

fbshipit-source-id: bc52854e14a10732d56b396bde3c432f6d7c90fa
  • Loading branch information
Dmytro Korenkevych authored and facebook-github-bot committed May 6, 2024
1 parent 84b8772 commit ea3f757
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/unit/test_tutorials/test_rec_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# pyre-strict


import os
import random
import unittest
from typing import List, Optional, Tuple
Expand Down Expand Up @@ -196,16 +197,23 @@ def setUp(self) -> None:
def test_rec_system(self) -> None:
# load environment
model = SequenceClassificationModel(100).to(device)
if os.path.exists("../Pearl"):
# Github CI
model_dir = "tutorials/single_item_recommender_system_example/"
else:
# internal Meta tests
model_dir = "pearl/tutorials/single_item_recommender_system_example/"

model.load_state_dict(
# Note: in the tutorial the directory "pearl" must be replaced by "Pearl"
torch.load(
"pearl/tutorials/single_item_recommender_system_example/env_model_state_dict.pt",
os.path.join(model_dir, "env_model_state_dict.pt"),
weights_only=True,
)
)
# Note: in the tutorial the directory "pearl" must be replaced by "Pearl"
actions = torch.load(
"pearl/tutorials/single_item_recommender_system_example/news_embedding_small.pt",
os.path.join(model_dir, "news_embedding_small.pt"),
weights_only=True,
)
history_length = 8
Expand Down

0 comments on commit ea3f757

Please sign in to comment.