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

ValidationError: 1 validation error for PyTorchPredictorModel #158

Open
cooling-0 opened this issue Jan 3, 2024 · 0 comments
Open

ValidationError: 1 validation error for PyTorchPredictorModel #158

cooling-0 opened this issue Jan 3, 2024 · 0 comments

Comments

@cooling-0
Copy link

cooling-0 commented Jan 3, 2024

scheduler = DEISMultistepScheduler( num_train_timesteps=150, beta_end=0.1, )

estimator = TimeGradEstimator(
    input_size=int(dataset.metadata.feat_static_cat[0].cardinality),
    hidden_size=64,
    num_layers=2,
    dropout_rate=0.1,
    lags_seq=[1],
    scheduler=scheduler,
    num_inference_steps=10,
    prediction_length=dataset.metadata.prediction_length,
    context_length=dataset.metadata.prediction_length,
    freq=dataset.metadata.freq,
    scaling="mean",
    trainer_kwargs=dict(max_epochs=3, accelerator="gpu", devices="-1"),
)
predictor = estimator.train(dataset_train)

Hi, I am running the code and got the following error. Can you tell me how to solve this?
I installed pytorch-ts by git clone and branched to ver-0.7.0.
the code is Time-Grad-Electricity.ipynb

GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
[c:\Users\chanyoung\anaconda3\envs\coolingts\lib\site-packages\lightning\pytorch\trainer\configuration_validator.py:74](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/lightning/pytorch/trainer/configuration_validator.py:74): You defined a `validation_step` but have no `val_dataloader`. Skipping val loop.
You are using a CUDA device ('NVIDIA GeForce RTX 3090') that has Tensor Cores. To properly utilize them, you should set `torch.set_float32_matmul_precision('medium' | 'high')` which will trade-off precision for performance. For more details, read https://pytorch.org/docs/stable/generated/torch.set_float32_matmul_precision.html#torch.set_float32_matmul_precision
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]

  | Name  | Type          | Params | In sizes | Out sizes        
-----------------------------------------------------------------------
0 | model | TimeGradModel | 432 K  | ?        | [1, 100, 24, 370]
-----------------------------------------------------------------------
432 K     Trainable params
0         Non-trainable params
432 K     Total params
1.729     Total estimated model params size (MB)
Epoch 0: |          | 50/? [00:26<00:00,  1.86it/s, v_num=11, train_loss=0.414]
Epoch 0, global step 50: 'train_loss' reached 0.41410 (best 0.41410), saving model to 'c:\\Users\\chanyoung\\Desktop\\새 폴더 (2)\\lightning_logs\\version_11\\checkpoints\\epoch=0-step=50.ckpt' as top 1
Epoch 1: |          | 50/? [00:25<00:00,  1.93it/s, v_num=11, train_loss=0.265]
Epoch 1, global step 100: 'train_loss' reached 0.26505 (best 0.26505), saving model to 'c:\\Users\\chanyoung\\Desktop\\새 폴더 (2)\\lightning_logs\\version_11\\checkpoints\\epoch=1-step=100.ckpt' as top 1
Epoch 2: |          | 50/? [00:27<00:00,  1.79it/s, v_num=11, train_loss=0.189]
Epoch 2, global step 150: 'train_loss' reached 0.18864 (best 0.18864), saving model to 'c:\\Users\\chanyoung\\Desktop\\새 폴더 (2)\\lightning_logs\\version_11\\checkpoints\\epoch=2-step=150.ckpt' as top 1
`Trainer.fit` stopped: `max_epochs=3` reached.
Epoch 2: |          | 50/? [00:27<00:00,  1.79it/s, v_num=11, train_loss=0.189]


ValidationError                           Traceback (most recent call last)
Cell In[13], [line 1](vscode-notebook-cell:?execution_count=13&line=1)
----> [1](vscode-notebook-cell:?execution_count=13&line=1) predictor = estimator.train(dataset_train)

File [c:\Users\chanyoung\anaconda3\envs\coolingts\lib\site-packages\gluonts\torch\model\estimator.py:246](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:246), in PyTorchLightningEstimator.train(self, training_data, validation_data, shuffle_buffer_length, cache_data, ckpt_path, **kwargs)
    [237](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:237) def train(
    [238](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:238)     self,
    [239](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:239)     training_data: Dataset,
   (...)
    [244](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:244)     **kwargs,
    [245](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:245) ) -> PyTorchPredictor:
--> [246](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:246)     return self.train_model(
    [247](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:247)         training_data,
    [248](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:248)         validation_data,
    [249](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:249)         shuffle_buffer_length=shuffle_buffer_length,
    [250](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:250)         cache_data=cache_data,
    [251](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:251)         ckpt_path=ckpt_path,
    [252](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:252)     ).predictor

File [c:\Users\chanyoung\anaconda3\envs\coolingts\lib\site-packages\gluonts\torch\model\estimator.py:230](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:230), in PyTorchLightningEstimator.train_model(self, training_data, validation_data, from_predictor, shuffle_buffer_length, cache_data, ckpt_path, **kwargs)
    [223](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:223) else:
    [224](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:224)     best_model = training_network
    [226](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:226) return TrainOutput(
    [227](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/gluonts/torch/model/estimator.py:227)     transformation=transformation,
...
File [c:\Users\chanyoung\anaconda3\envs\coolingts\lib\site-packages\pydantic\main.py:341](file:https:///C:/Users/chanyoung/anaconda3/envs/coolingts/lib/site-packages/pydantic/main.py:341), in pydantic.main.BaseModel.__init__()

ValidationError: 1 validation error for PyTorchPredictorModel
device
  str type expected (type=type_error.str)
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