File "/private/home/melhoushi/miniconda3/envs/wmc/lib/python3.10/site-packages/compiler_gym/datasets/datasets.py", line 209, in contains
self.dataset(dataset)
File "/private/home/melhoushi/miniconda3/envs/wmc/lib/python3.10/site-packages/compiler_gym/datasets/datasets.py", line 137, in dataset
return self.dataset_from_parsed_uri(BenchmarkUri.from_string(dataset))
File "/private/home/melhoushi/miniconda3/envs/wmc/lib/python3.10/site-packages/compiler_gym/datasets/datasets.py", line 152, in dataset_from_parsed_uri
key = self._dataset_key_from_uri(uri)
File "/private/home/melhoushi/miniconda3/envs/wmc/lib/python3.10/site-packages/compiler_gym/datasets/datasets.py", line 162, in _dataset_key_from_uri
raise ValueError(f"Invalid benchmark URI: '{uri}'")
ValueError: Invalid benchmark URI: 'benchmark:/checkpoint/melhoushi/wmc/corpus/src/'
This PR fixes the issue by replacing ValueError in _dataset_key_from_uri and adding some unit test cases for __contains__.
Not sure if this is the best way, or if you think there is a more proper solution. Perhaps _dataset_key_from_uri should throw both ValueError and LookupError ?
I faced an issue where calling:
would throw:
this is because
__contains__
function inDatasets
is handlingLookupError
: https://github.com/facebookresearch/CompilerGym/blob/2b2061380bc42627396b05d5420823b3c31180e6/compiler_gym/datasets/datasets.py#LL206-L212C25 while_dataset_key_from_uri
was throwingValueError
: https://github.com/facebookresearch/CompilerGym/blob/2b2061380bc42627396b05d5420823b3c31180e6/compiler_gym/datasets/datasets.py#LL159-L163C17This PR fixes the issue by replacing
ValueError
in_dataset_key_from_uri
and adding some unit test cases for__contains__
. Not sure if this is the best way, or if you think there is a more proper solution. Perhaps_dataset_key_from_uri
should throw bothValueError
andLookupError
?