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

[BUG] Can't get torch.nn.Sequential from FlyteRemote: "Type ~T not supported currently in Flytekit. Please register a new transformer" #3148

Closed
2 tasks done
cosmicBboy opened this issue Dec 12, 2022 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@cosmicBboy
Copy link
Contributor

Describe the bug

Trying to get a FlyteExecution output with execution.outputs["o0"] where the output type is torch.nn.Sequential (a subclass of torch.nn.Module`) raises the following error:

Traceback (most recent call last):
  File "/Users/nielsbantilan/git/flyte-demos/flyte_demo/test.py", line 23, in <module>
    print(execution.outputs["o0"])
  File "/Users/nielsbantilan/miniconda3/envs/flyte-demos/lib/python3.9/site-packages/flytekit/core/type_engine.py", line 1584, in __getitem__
    return self.get(key)
  File "/Users/nielsbantilan/miniconda3/envs/flyte-demos/lib/python3.9/site-packages/flytekit/core/type_engine.py", line 1613, in get
    val = TypeEngine.to_python_value(self._ctx or FlyteContext.current_context(), self._literals[attr], as_type)
  File "/Users/nielsbantilan/miniconda3/envs/flyte-demos/lib/python3.9/site-packages/flytekit/core/type_engine.py", line 763, in to_python_value
    transformer = cls.get_transformer(expected_python_type)
  File "/Users/nielsbantilan/miniconda3/envs/flyte-demos/lib/python3.9/site-packages/flytekit/core/type_engine.py", line 702, in get_transformer
    raise ValueError(f"Type {python_type} not supported currently in Flytekit. Please register a new transformer")
ValueError: Type ~T not supported currently in Flytekit. Please register a new transformer

Need to set this explicitly with execution.outputs.get("o0", as_type=torch.nn.Sequential).

Expected behavior

The flyte type engine should be able to get supported outputs without having to specify as_type.

Additional context to reproduce

To reproduce:

from flytekit.configuration import Config
from flytekit.remote import FlyteRemote
from workflows import model_training

remote = FlyteRemote(
    config=Config.auto(),
    default_project="flytesnacks",
    default_domain="development",
)
execution = remote.execute_local_workflow(
    model_training.training_workflow,
    inputs={
        "n_epochs": 30,
        "hyperparameters": model_training.Hyperparameters(
            in_dim=4, hidden_dim=100, out_dim=3, learning_rate=0.01
        ),
    }
)

print(remote.generate_console_url(execution))
execution = remote.wait(execution)
print(execution.outputs["o0"])

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@cosmicBboy cosmicBboy added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Dec 12, 2022
@eapolinario eapolinario self-assigned this Dec 16, 2022
@cosmicBboy cosmicBboy added this to the 1.4.0 milestone Jan 29, 2023
@cosmicBboy cosmicBboy removed the untriaged This issues has not yet been looked at by the Maintainers label Mar 3, 2023
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.

3 participants