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

[fix] output sequence under the multiple samples #1707

Merged
merged 15 commits into from
Nov 26, 2024
Prev Previous commit
Next Next commit
output the log for invalid response
  • Loading branch information
cuauty committed Nov 21, 2024
commit 87cecdbbdc40adc3819d5e5c6e4b0c063962d2e9
12 changes: 11 additions & 1 deletion opencompass/models/bailing_api_oc.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,24 @@ def generate(
try:
result = resp.json()
except Exception as e: # noqa F841
pass
self.logger.error(f'Fail to inference; '
f'model_name={self.path}; error={e}, '
f'request={inputs[m]}')
else:
if (result.get('choices')
and result['choices'][0].get('message') and
result['choices'][0]['message'].get('content')
is not None):
results[m] = \
result['choices'][0]['message']['content']
else:
self.logger.error(f'Receive invalid result. '
f'result={result}; '
f'request={inputs[m]}')
else:
self.logger.error(f'Receive invalid response. '
f'response={resp}; '
f'request={inputs[m]}')
self.flush()
return results

Expand Down