Skip to content

Commit efa4d7e

Browse files
eugenos-programosgithub-actions[bot]
authored andcommitted
Fix question_answering (#3134)
* fix question_answering * fix raising 400 HTTP error while calling question answering models * fix question_answering remove extra_payload parameter values * Apply style fixes --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b71dbb7 commit efa4d7e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/huggingface_hub/inference/_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ def question_answering(
15021502
model_id = model or self.model
15031503
provider_helper = get_provider_helper(self.provider, task="question-answering", model=model_id)
15041504
request_parameters = provider_helper.prepare_request(
1505-
inputs=None,
1505+
inputs={"question": question, "context": context},
15061506
parameters={
15071507
"align_to_words": align_to_words,
15081508
"doc_stride": doc_stride,
@@ -1512,7 +1512,6 @@ def question_answering(
15121512
"max_seq_len": max_seq_len,
15131513
"top_k": top_k,
15141514
},
1515-
extra_payload={"question": question, "context": context},
15161515
headers=self.headers,
15171516
model=model_id,
15181517
api_key=self.token,

src/huggingface_hub/inference/_generated/_async_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ async def question_answering(
15511551
model_id = model or self.model
15521552
provider_helper = get_provider_helper(self.provider, task="question-answering", model=model_id)
15531553
request_parameters = provider_helper.prepare_request(
1554-
inputs=None,
1554+
inputs={"question": question, "context": context},
15551555
parameters={
15561556
"align_to_words": align_to_words,
15571557
"doc_stride": doc_stride,
@@ -1561,7 +1561,6 @@ async def question_answering(
15611561
"max_seq_len": max_seq_len,
15621562
"top_k": top_k,
15631563
},
1564-
extra_payload={"question": question, "context": context},
15651564
headers=self.headers,
15661565
model=model_id,
15671566
api_key=self.token,

0 commit comments

Comments
 (0)