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

When using Any a TypeError is thrown: isinstance() arg 2 must be a type or tuple of types #47

Closed
jaichopra opened this issue Jun 26, 2022 · 0 comments · Fixed by #297
Closed
Assignees
Labels
bug Something isn't working

Comments

@jaichopra
Copy link
Contributor

Using HuggingFace datasets:

`from datasets import load_dataset

@sematic.func
def pipeline() -> Any:
dataset = load_yelp_dataset()
return dataset

@sematic.func
def load_yelp_dataset() -> Any:
dataset = load_dataset("yelp_review_full")
print(type(dataset))
return dataset`

When using DatasetDict instead of Any it works

Here is the stack trace:

Traceback (most recent call last): File "/Users/jai/opt/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/Users/jai/opt/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/jai/projects/sematic/my_project/__main__.py", line 17, in <module> main() File "/Users/jai/projects/sematic/my_project/__main__.py", line 13, in main pipeline().resolve() File "/Users/jai/projects/sematic/sematic/future.py", line 21, in resolve self.value = resolver.resolve(self) File "/Users/jai/projects/sematic/sematic/resolvers/state_machine_resolver.py", line 28, in resolve self._schedule_future_if_input_ready(future_) File "/Users/jai/projects/sematic/sematic/resolvers/state_machine_resolver.py", line 220, in _schedule_future_if_input_ready self._schedule_future(future) File "/Users/jai/projects/sematic/sematic/resolvers/offline_resolver.py", line 84, in _schedule_future self._run_inline(future) File "/Users/jai/projects/sematic/sematic/resolvers/offline_resolver.py", line 93, in _run_inline self._handle_future_failure(future, exception) File "/Users/jai/projects/sematic/sematic/resolvers/state_machine_resolver.py", line 242, in _handle_future_failure raise exception File "/Users/jai/projects/sematic/sematic/resolvers/offline_resolver.py", line 91, in _run_inline self._update_future_with_value(future, value) File "/Users/jai/projects/sematic/sematic/resolvers/state_machine_resolver.py", line 271, in _update_future_with_value value = future.calculator.cast_output(value) File "/Users/jai/projects/sematic/sematic/calculator.py", line 131, in cast_output return self.cast_value( File "/Users/jai/projects/sematic/sematic/calculator.py", line 155, in cast_value cast_value, error = safe_cast(value, type_) File "/Users/jai/projects/sematic/sematic/types/casting.py", line 95, in safe_cast if isinstance(value, type_): TypeError: isinstance() arg 2 must be a type or tuple of types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants