Skip to content

[DOC] How does one initialise a network without from_dataset? #1548

@chrism2671

Description

@chrism2671

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions