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

How does one initialise a network without from_dataset? #1548

Open
chrism2671 opened this issue Mar 21, 2024 · 0 comments
Open

How does one initialise a network without from_dataset? #1548

chrism2671 opened this issue Mar 21, 2024 · 0 comments

Comments

@chrism2671
Copy link

chrism2671 commented Mar 21, 2024

Expected behavior

Code:

from pytorch_forecasting.models import NBeats, BaseModel
from pytorch_lightning import Trainer, LightningModule

model = NBeats()
trainer.fit(model, train, valid)

Result:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-102-a9a3146dfc98>](https://localhost:8080/#) in <cell line: 1>()
----> 1 trainer.fit(model, train,valid)

1 frames
[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/utilities/compile.py](https://localhost:8080/#) in _maybe_unwrap_optimized(model)
    130         return model
    131     _check_mixed_imports(model)
--> 132     raise TypeError(
    133         f"`model` must be a `LightningModule` or `torch._dynamo.OptimizedModule`, got `{type(model).__qualname__}`"
    134     )

TypeError: `model` must be a `LightningModule` or `torch._dynamo.OptimizedModule`, got `NBeats`

I'm trying to use the naked networks without the rest of the stuff around pytorch_forecasting.

I've read the source code I do believe this should work; but I must be doing something stupid.

Is it possible to add an example or FAQ of how to use pytorch_forecasting without from_dataset?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant