Skip to content

Commit

Permalink
Refactor code in samplers.py to improve readability and maintainability
Browse files Browse the repository at this point in the history
  • Loading branch information
pufanyi committed Sep 21, 2024
1 parent acac490 commit fe4951e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lmms_eval/api/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def get_context(self, doc, num_fewshot):
+ (
str(self.doc_to_target(doc)[0])
if type(self.doc_to_target(doc)) is list
else self.doc_to_target(doc) if (self.config.doc_to_choice is None or type(self.doc_to_target(doc)) is str) else str(self.doc_to_choice(doc)[self.doc_to_target(doc)])
else self.doc_to_target(doc)
if (self.config.doc_to_choice is None or type(self.doc_to_target(doc)) is str)
else str(self.doc_to_choice(doc)[self.doc_to_target(doc)])
)
for doc in selected_docs
]
Expand Down

1 comment on commit fe4951e

@abzb1
Copy link
Contributor

@abzb1 abzb1 commented on fe4951e Sep 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

black & isort matters 😅

Please sign in to comment.