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 extensible tests to transformers #663

Merged

Conversation

riedgar-ms
Copy link
Collaborator

@riedgar-ms riedgar-ms commented Feb 27, 2024

Add basic smoke tests to transformers which are parameterised with the name of a Hugging Face model. This is to prevent things like #609 reoccurring.

@riedgar-ms riedgar-ms changed the title Add extensible test to transformers Add extensible tests to transformers Feb 27, 2024
Comment on lines +41 to +43
# Inexact, but at least make sure not too much was produced
assert len(lm["answer"]) < 8, f"Output: {lm['answer']}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the idea but model quality checks like this (when asserting against unconstrained generations) are a bit dangerous -- you'd be surprised how often a model with minor updates on HuggingFace might spit out an answer that e.g. isn't a number. I'd either add a regex constraint to the gen and check that the number produced can be cast to an integer or just check that the model generated something at all

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shouldn't len() always return an integer?

Comment on lines +58 to +59
assert lm["answer"] in ["p", "t", "w"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

glad to see a forced grammar test here!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My background idea is to have a smoke test for each of the ways a generation (be that gen(), select() etc.) can be invoked.

@Harsha-Nori Harsha-Nori merged commit aa90e68 into guidance-ai:main Feb 28, 2024
5 checks passed
@riedgar-ms riedgar-ms deleted the riedgar-ms/more-transformer-tests-01 branch March 15, 2024 12:00
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