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

Added some error handling for ooba for #81 #84

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Changes from all commits
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
Added some error handling for ooba
  • Loading branch information
Josh-XT committed Apr 25, 2023
commit edf1ac54392673a549409723d351b4046221541f
7 changes: 5 additions & 2 deletions provider/oobabooga.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ def instruct(self, prompt, seed=None):
'truncation_length': 4096, 'ban_eos_token': False
}
response = requests.post(f"{CFG.AI_PROVIDER_URI}/run/textgen", json={"data": [json.dumps([prompt, params])]})
stripped_string = re.sub(r"(?<!\\)\\(?!n)", "", response.json()['data'][0])
return stripped_string
data = response.json()
if "data" in data:
data = data["data"]
data = re.sub(r"(?<!\\)\\(?!n)", "", data[0])
return data