Skip to content

Commit

Permalink
final cleanup for the day
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Apr 7, 2023
1 parent 07c1f5b commit 3433cd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'toolformer-pytorch',
packages = find_packages(exclude=[]),
version = '0.0.26',
version = '0.0.27',
license='MIT',
description = 'Toolformer - Pytorch',
author = 'Phil Wang',
Expand Down
7 changes: 7 additions & 0 deletions toolformer_pytorch/toolformer_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ def forward(
self,
data: List[str],
return_after_generating_api_calls = False,
return_after_making_api_calls = False,
return_after_filtering_api_calls = False,
return_after_filtering_by_api_response = False
):
Expand All @@ -881,12 +882,18 @@ def forward(
assert len(filtered_data_with_api_calls) > 0, 'your model failed to follow instructions and make API calls. please try a better model or do some better prompt engineering'

data_with_responses = self.make_api_calls(filtered_data_with_api_calls)

if return_after_making_api_calls:
return filtered_data, filtered_data_with_api_calls, data_with_responses

filtered_results = self.filter_by_api_responses(filtered_data, filtered_data_with_api_calls, data_with_responses)

if return_after_filtering_by_api_response:
return filtered_results

if self.should_finetune:
assert filtered_results.num_passed > 0, f'none of the sequences with API calls passed the filtering criteria with threshold {self.filter_threshold}'

self.finetune(filtered_results)

return filtered_results

0 comments on commit 3433cd9

Please sign in to comment.