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

Add mapping for automatic parallelization over inputs #845

Merged
merged 6 commits into from
Feb 14, 2024
Merged

Add mapping for automatic parallelization over inputs #845

merged 6 commits into from
Feb 14, 2024

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Feb 14, 2024

This exposes a map utility as an attribute of the major Marvin functions cast, extract, and classify.

Mapping is performed by calling each function's "map" attribute, e.g. marvin.cast.map()

inputs = [
    "I drove from New York to California.",
    "I took a flight from NYC to BOS."
]
outputs = marvin.extract.map(inputs, target=str, instructions="2-letter state codes")
assert outputs  == [
	["NY", "CA"], 
	["NY", "MA"]
]

Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woot woot! i've been wanting to back out map forever

functional marvin ftw 🎉

@jlowin jlowin merged commit 65731e6 into main Feb 14, 2024
15 checks passed
@jlowin jlowin deleted the mapping branch February 14, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants