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

Fixed Regression in Promptsource #65

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "smashed"
version = "0.21.5"
version = "0.21.6"
description = """\
SMASHED is a toolkit designed to apply transformations to samples in \
datasets, such as fields extraction, tokenization, prompting, batching, \
Expand Down
35 changes: 26 additions & 9 deletions src/smashed/mappers/promptsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,33 @@ def approx_input_fields(self) -> Tuple[Set[str], ...]:
are used, nor cases where members of a variable are accessed.
"""

# we compute variables first because some might
all_variables = set(
field
for field in self.get_vars_from_txt(self.template)
if field not in self.extra_vars
)
return tuple(
{v for v in all_variables if v in fragment}
for fragment in self.template.split("|||")
output = tuple(
set(
field
for field in self.get_vars_from_txt(t)
if field not in self.extra_vars
)
for t in self.template.split("|||")
)
print(output)

return output

# # we compute variables first because some might
# all_variables = set(
# field
# for field in self.get_vars_from_txt(self.template)
# if field not in self.extra_vars
# )
# out = tuple(
# {
# field
# for field in all_variables
# if (field in fragment and field not in self.extra_vars)
# }
# for fragment in self.template.split("|||")
# )
# return out

@property
def template_text(self) -> Tuple[str, ...]:
Expand Down
Loading