mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-10 11:41:04 +08:00
Fix typos (#1143)
Found via `codespell -S .mypy_cache,yarn.lock,*.json,*.ipynb -L rouge,nam,vie`
This commit is contained in:
@@ -18,7 +18,7 @@ async def get_text_toxicity(
|
||||
|
||||
Args:
|
||||
msg (str): the message that we want to analyze.
|
||||
api_client (ApiClient, optional): authentification of the user of the request.
|
||||
api_client (ApiClient, optional): authentication of the user of the request.
|
||||
Defaults to Depends(deps.get_trusted_api_client).
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -14,7 +14,7 @@ class TreeManagerConfiguration(BaseModel):
|
||||
number is reached."""
|
||||
|
||||
max_initial_prompt_review: int = 100
|
||||
"""Maximum number of initial prompts under review before no more inital prompt tasks will be handed out."""
|
||||
"""Maximum number of initial prompts under review before no more initial prompt tasks will be handed out."""
|
||||
|
||||
max_tree_depth: int = 3
|
||||
"""Maximum depth of message tree."""
|
||||
@@ -75,7 +75,7 @@ class TreeManagerConfiguration(BaseModel):
|
||||
|
||||
min_active_rankings_per_lang: int = 0
|
||||
"""When the number of active ranking tasks is below this value when a tree enters a terminal
|
||||
state an available trees in BACKLOG_RANKING will be actived (i.e. enters the RANKING state)."""
|
||||
state an available trees in BACKLOG_RANKING will be activated (i.e. enters the RANKING state)."""
|
||||
|
||||
labels_initial_prompt: list[TextLabel] = [
|
||||
TextLabel.spam,
|
||||
|
||||
@@ -12,7 +12,7 @@ class State(str, Enum):
|
||||
"""States of the Open-Assistant message tree state machine."""
|
||||
|
||||
INITIAL_PROMPT_REVIEW = "initial_prompt_review"
|
||||
"""In this state the message tree consists only of a single inital prompt root node.
|
||||
"""In this state the message tree consists only of a single initial prompt root node.
|
||||
Initial prompt labeling tasks will determine if the tree goes into `growing` or
|
||||
`aborted_low_grade` state."""
|
||||
|
||||
@@ -33,11 +33,11 @@ class State(str, Enum):
|
||||
compute the aggergated ranking scores that will appear in the dataset."""
|
||||
|
||||
READY_FOR_EXPORT = "ready_for_export"
|
||||
"""The Scoring algorithm computed rankings scores for all childern. The message tree can be
|
||||
"""The Scoring algorithm computed rankings scores for all children. The message tree can be
|
||||
exported as part of an Open-Assistant message tree dataset."""
|
||||
|
||||
SCORING_FAILED = "scoring_failed"
|
||||
"""An exception occured in the scoring algorithm."""
|
||||
"""An exception occurred in the scoring algorithm."""
|
||||
|
||||
ABORTED_LOW_GRADE = "aborted_low_grade"
|
||||
"""The system received too many bad reviews and stopped handing out tasks for this message tree."""
|
||||
|
||||
@@ -484,7 +484,7 @@ class PromptRepository:
|
||||
OasstErrorCode.TASK_PAYLOAD_TYPE_MISMATCH,
|
||||
)
|
||||
|
||||
logger.debug(f"text_labels relpy: {valid_labels=}, {mandatory_labels=}")
|
||||
logger.debug(f"text_labels reply: {valid_labels=}, {mandatory_labels=}")
|
||||
|
||||
if valid_labels:
|
||||
if not all([label in valid_labels for label in text_labels.labels.keys()]):
|
||||
|
||||
@@ -177,7 +177,7 @@ class TaskRepository:
|
||||
if not allow_personal_tasks and not task.collective:
|
||||
raise OasstError("This is not a collective task", OasstErrorCode.TASK_NOT_COLLECTIVE)
|
||||
if task.done:
|
||||
raise OasstError("Allready closed", OasstErrorCode.TASK_ALREADY_DONE)
|
||||
raise OasstError("Already closed", OasstErrorCode.TASK_ALREADY_DONE)
|
||||
|
||||
task.done = True
|
||||
self.db.add(task)
|
||||
|
||||
@@ -320,7 +320,7 @@ class TreeManager:
|
||||
if num_red_flag is not None and num_red_flag >= self.cfg.auto_mod_red_flags:
|
||||
if m.parent_id is None:
|
||||
logger.warning(
|
||||
f"[AUTO MOD] Halting tree {m.message_tree_id}, inital prompt got too many red flags ({m.emojis})."
|
||||
f"[AUTO MOD] Halting tree {m.message_tree_id}, initial prompt got too many red flags ({m.emojis})."
|
||||
)
|
||||
self.enter_low_grade_state(m.message_tree_id)
|
||||
else:
|
||||
@@ -895,7 +895,7 @@ class TreeManager:
|
||||
logger.warning("The intersection of ranking results ID sets has less than two elements. Skipping.")
|
||||
continue
|
||||
|
||||
# keep only elements in commond set
|
||||
# keep only elements in command set
|
||||
ordered_ids_list = [list(filter(lambda x: x in common_set, ids)) for ids in ordered_ids_list]
|
||||
assert all(len(x) == len(common_set) for x in ordered_ids_list)
|
||||
|
||||
@@ -1069,7 +1069,7 @@ HAVING(COUNT(mr.message_id) FILTER (WHERE mr.user_id = :user_id) = 0)
|
||||
"""
|
||||
|
||||
def query_incomplete_rankings(self, lang: str) -> list[IncompleteRankingsRow]:
|
||||
"""Query parents which have childern that need further rankings"""
|
||||
"""Query parents which have children that need further rankings"""
|
||||
|
||||
user_id = self.pr.user_id if not settings.DEBUG_ALLOW_DUPLICATE_TASKS else None
|
||||
r = self.db.execute(
|
||||
@@ -1256,7 +1256,7 @@ LEFT JOIN message_reaction mr ON mr.task_id = t.id AND mr.payload_type = 'Rankin
|
||||
|
||||
@managed_tx_method(CommitMode.COMMIT)
|
||||
def ensure_tree_states(self) -> None:
|
||||
"""Add message tree state rows for all root nodes (inital prompt messages)."""
|
||||
"""Add message tree state rows for all root nodes (initial prompt messages)."""
|
||||
|
||||
missing_tree_ids = self.query_misssing_tree_states()
|
||||
for id in missing_tree_ids:
|
||||
@@ -1598,7 +1598,7 @@ DELETE FROM message WHERE message_tree_id = :message_tree_id;
|
||||
total_messages = sum(len(x) for x in replies_by_tree.values())
|
||||
logger.debug(f"found: {len(replies_by_tree)} trees; {len(prompts)} prompts; {total_messages} messages;")
|
||||
|
||||
# remove all trees based on inital prompts of the user
|
||||
# remove all trees based on initial prompts of the user
|
||||
if purge_initial_prompts:
|
||||
for p in prompts:
|
||||
self.purge_message_tree(p.message_tree_id)
|
||||
@@ -1636,7 +1636,7 @@ DELETE FROM message WHERE message_tree_id = :message_tree_id;
|
||||
logger.debug(f"purging message: {m.id}")
|
||||
self._purge_message_internal(m.id)
|
||||
|
||||
# update childern counts
|
||||
# update children counts
|
||||
self.pr.update_children_counts(m.message_tree_id)
|
||||
|
||||
# reactivate tree
|
||||
|
||||
@@ -66,7 +66,7 @@ def get_winner(pairs):
|
||||
|
||||
def get_ranking(pairs):
|
||||
"""
|
||||
Abuses concordance property to get a (not necessarily unqiue) ranking.
|
||||
Abuses concordance property to get a (not necessarily unique) ranking.
|
||||
The lack of uniqueness is due to the potential existence of multiple
|
||||
equally ranked winners. We have to pick one, which is where
|
||||
the non-uniqueness comes from
|
||||
|
||||
Reference in New Issue
Block a user