Skip to content

Commit

Permalink
🛠️ Updates, small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf-kali committed Jan 11, 2024
1 parent adc351c commit cca8dea
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
16 changes: 12 additions & 4 deletions playground/online_codenames_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from codenames.game.color import TeamColor
from codenames.game.exceptions import QuitGame
from codenames.online.codenames_game.adapter import CodenamesGameLanguage
from codenames.online.codenames_game.adapter import CodenamesGameLanguage, GameConfigs
from codenames.online.codenames_game.runner import CodenamesGameRunner

from playground.printer import print_results
Expand All @@ -20,11 +20,11 @@
# configure_logging(level="DEBUG", mute_solvers=False, mute_online=False)
log = logging.getLogger(__name__)

model_id = ModelIdentifier(language="english", model_name="wiki-50", is_stemmed=False)
# model_id = ModelIdentifier(language="english", model_name="wiki-50", is_stemmed=False)
# model_id = ModelIdentifier("english", "google-300", False)
# model_id = ModelIdentifier("hebrew", "twitter", False)
# model_id = ModelIdentifier(language="hebrew", model_name="ft-200", is_stemmed=False)
# model_id = ModelIdentifier("hebrew", "skv-ft-150", True)
model_id = ModelIdentifier(language="hebrew", model_name="skv-ft-150", is_stemmed=True)
# model_id = ModelIdentifier("hebrew", "skv-cbow-150", True)

os.environ[MODEL_NAME_ENV_KEY] = model_id.model_name
Expand All @@ -39,6 +39,7 @@ def run_online():
log.info("Running online game...")
online_manager = runner = None
try:
configs = GameConfigs(language=CodenamesGameLanguage.HEBREW)
# blue_hinter = GPTHinter(name="Einstein", api_key=GPT_API_KEY)
blue_hinter = NaiveHinter(
"Einstein", team_color=TeamColor.BLUE, model_identifier=model_id, model_adapter=adapter
Expand All @@ -53,7 +54,14 @@ def run_online():
red_guesser = NaiveGuesser(
name="Anakin", team_color=TeamColor.RED, model_identifier=model_id, model_adapter=adapter
)
online_manager = CodenamesGameRunner(blue_hinter, red_hinter, blue_guesser, red_guesser, show_host=True)
online_manager = CodenamesGameRunner(
blue_hinter=blue_hinter,
red_hinter=red_hinter,
blue_guesser=blue_guesser,
red_guesser=red_guesser,
show_host=True,
game_configs=configs,
)
# online_manager = CodenamesGameGameRunner(blue_hinter, red_hinter, blue_guesser, red_guesser, show_host=False)
runner = online_manager.auto_start()
except QuitGame:
Expand Down
16 changes: 10 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ all = ["openai"]
python = "^3.9"
# Algo
the-spymaster-util = ">=2.0,<4.0"
codenames = "^4.1.2"
codenames = "^4.1.5"
pydantic = "^1.9"
# Numbers
numpy = "^1.21"
Expand All @@ -35,7 +35,7 @@ networkx = "^2.6"
matplotlib = "^3.4.3" # TODO: This should not be here
# Language
gensim = "^4.1"
generic-iterative-stemmer = "^0.2"
generic-iterative-stemmer = "^1.0.7"
python-louvain = "^0.15"
editdistance = "^0.6"
# GPT
Expand Down
2 changes: 1 addition & 1 deletion solvers/naive/naive_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def _prepare_model(self, language: Optional[str] = None):
else:
raise ValueError("No language provided")
self._model_adapter.clear_cache()
self._model_adapter.checker = self.model.key_to_index.__contains__
self._model_adapter.checker = self.model.__contains__

0 comments on commit cca8dea

Please sign in to comment.