Skip to content

Commit

Permalink
[fix] ranking_type is None
Browse files Browse the repository at this point in the history
  • Loading branch information
huyiwen committed Jun 8, 2024
1 parent 3ebe98a commit 857cf27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions utilization/chat_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

__all__ = ["DEFAULT_CHAT_TEMPLATE", "DEFAULT_CHAT_CONFIGS", "add_space", "smart_space"]


def add_space(msg: str, auto_leading_space: bool, context: str) -> str:
if auto_leading_space and msg and context and not context[-1].isspace() and not msg[0].isspace():
return ' ' + msg
Expand Down
2 changes: 2 additions & 0 deletions utilization/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ def model_evaluation_method(self) -> Literal['get_ppl', 'get_prob', 'generation'
if not hasattr(self, "args"):
raise ValueError("The `args` attribute is not found. Please call `__init__` first.")
if self.evaluation_type == "ranking":
if self.ranking_type is None:
self.ranking_type = "ppl_no_option"
if self.ranking_type.startswith("ppl"): # ppl or ppl_no_option
return "get_ppl"
elif self.ranking_type == "prob":
Expand Down

0 comments on commit 857cf27

Please sign in to comment.