This MR fixes a crash in fiftyone's web app that happens when we try to filter the annotations by attributes.
The bug can be reproduced if we load the dataset lours_test/test_data/caipy_dataset/tags/default_schema.
running dataset.to_fiftyone() will work but when we try to filter on attributes in the GUI, we get this error:
Here's the same dataset, loaded and correctly filtered after applying the fix:
The error is very deep inside the fiftyone package and I couldn't get a clue from it. Here's the full message if you want to take a shot!
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/graphql/execution/execute.py", line 1038, in await_result
return build_response(await result, errors) # type: ignore
^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/graphql/execution/execute.py", line 453, in get_results
await gather(*(results[field] for field in awaitable_fields)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/graphql/execution/execute.py", line 537, in await_result
self.handle_field_error(error, return_type)
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/graphql/execution/execute.py", line 571, in handle_field_error
raise error
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/graphql/execution/execute.py", line 530, in await_result
return_type, field_nodes, info, path, await result
^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/strawberry/schema/schema_converter.py", line 513, in _async_resolver
return await await_maybe(_get_result(_source, strawberry_info, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/strawberry/utils/await_maybe.py", line 12, in await_maybe
return await value
^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/query.py", line 456, in samples
return await paginate_samples(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/samples.py", line 97, in paginate_samples
view = await run_sync_task(run, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/samples.py", line 85, in <lambda>
run = lambda reload: fosv.get_view(
^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/view.py", line 146, in get_view
return run(dataset, stages)
^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/view.py", line 133, in run
view = get_extended_view(
^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/view.py", line 194, in get_extended_view
stages = _make_filter_stages(view, filters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/view.py", line 364, in _make_filter_stages
queries.append(_make_query(path, path_field, args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nacerkaci/projects/ia_tools/libia/.venv/lib/python3.11/site-packages/fiftyone/server/view.py", line 452, in _make_query
path = ".".join(keys[:-1] + [field.db_field or field.name])
^^^^^^^^^^^^^^
But after experimenting a bit with the attribute columns in libia, I found that the error happens when the name of the attribute column starts with the string "attributes". This could be caused by the fact that fiftyone have something they call attributes but it's only a guess at this point: https://docs.voxel51.com/user_guide/using_datasets.html#dynamic-attributes
To fix the error, I just replaced the string "attributes" with "attr" when exporting to fiftyone (juste like we replace dots with "->" to avoid problems with fiftyone).
I also upgraded fiftyone to 0.25 since we're two versions behind but this has nothing to do with the bug being fixed. The bug is still present in 0.25 if we don't rename "attributes" to 'attr'.
Some docs file have been corrected by pre-commit too.
Hi!
This MR fixes a crash in fiftyone's web app that happens when we try to filter the annotations by attributes.
The bug can be reproduced if we load the dataset
lours_test/test_data/caipy_dataset/tags/default_schema
.running
dataset.to_fiftyone()
will work but when we try to filter on attributes in the GUI, we get this error:Here's the same dataset, loaded and correctly filtered after applying the fix:
The error is very deep inside the fiftyone package and I couldn't get a clue from it. Here's the full message if you want to take a shot!
But after experimenting a bit with the attribute columns in libia, I found that the error happens when the name of the attribute column starts with the string "attributes". This could be caused by the fact that fiftyone have something they call attributes but it's only a guess at this point: https://docs.voxel51.com/user_guide/using_datasets.html#dynamic-attributes
To fix the error, I just replaced the string "attributes" with "attr" when exporting to fiftyone (juste like we replace dots with "->" to avoid problems with fiftyone).
I also upgraded fiftyone to 0.25 since we're two versions behind but this has nothing to do with the bug being fixed. The bug is still present in 0.25 if we don't rename "attributes" to 'attr'.
Some docs file have been corrected by pre-commit too.