aws / fmeval

Foundation Model Evaluations Library
http://aws.github.io/fmeval
Apache License 2.0
155 stars 40 forks source link

fix: Fix example notebook unit tests #188

Closed danielezhu closed 4 months ago

danielezhu commented 4 months ago

Description of changes:

After PR #180, we've been consistently running into issues where pip installing fmeval from pypi within the example notebooks (this installation is always included as the first cell of the notebooks) is causing dependency version issues that cause the test_custom_model_hf_notebook test to fail.

Specifically, tokenizers is getting re-installed to be a lower version (0.12.1) that is used by the current release of fmeval , but transformers somehow isn't also getting re-installed to its lower version (4.22.1); it's still 4.37.2 as dictated by pyproject.toml.

This PR updates the example notebook unit tests so that they do not install fmeval from pypi. Rather they will continue to use the fmeval package installed by poetry during poetry install, i.e. the same fmeval package that the rest of the unit tests run against.

In order to accomplish this desired behavior, I have updated the unit tests to skip the execution of the first code cell. The for loop that iterates through tb.cells and runs execute_cell() is directly copied from the body of execute(); I simply added a couple lines of extra logic to skip the first code cell.

While this is a bit hacky, the testbook library doesn't provide a good way to skip cells that get run during the test (there is a way to specify cells to run before the test, but that's not what we want to do).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

oyangz commented 4 months ago

Thanks for fixing the issue!