Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[alpha] Improvements to ModelWrapper and better QA/Classification implementation #8

Merged
merged 16 commits into from
Mar 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update code documentation for HFPipelineWrapper docstring
  • Loading branch information
NISH1001 committed Feb 27, 2023
commit 7aee9f7e1daa9151fd6c3c322c897938cf35e01c
8 changes: 8 additions & 0 deletions evalem/models/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ class HFPipelineWrapper(HFWrapper):
pipe = hf_pipeline("question-answering")
wrapped_model = HFPipelineWrapper(pipe)

# Or: if you want to specify how to post-process predictions,
# provide the processor explicitly.
wrapped_model = HFPipelineWrapper(
pipeline("question-answering", model="deepset/roberta-base-squad2"),
predictions_postprocessor=lambda xs: list(map(lambda x: x["answer"], xs))
)


# compute predictions
# (format?) and pass to evaluator along with references
predictions = wrapped_model.predict(<inputs>)
Expand Down