Fine tuning failed

#8
by KaneWong - opened

When run 'Python run_timesfm_classification.py ', the following error occurred:

Traceback (most recent call last):
File "/alidata/downloads/FlaMinGo-timesfm/experiments/torch_classification_timesfm/run_timesfm_classification.py", line 63, in
tfm_finetuned, preds_list = fine_tune_and_evaluate(tfm_classifier, train_val_dataloaders=dataloaders, test_loader=test_loader, epochs=NUM_EPOCH, learning_rate=LEARNING_RATE, optimizer_type="adam")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/torch_classification_timesfm/train.py", line 50, in fine_tune_and_evaluate
output = model(
^^^^^^
File "/aidata/miniforge3/envs/flamingo/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/aidata/miniforge3/envs/flamingo/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/torch_classification_timesfm/model.py", line 96, in forward
_, _, trasnformer_output = self.base_model.decode(input_ts, paddings, freq, horizon_len, return_forecast_on_context) # Pass data through TimesFm
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/timesfm/pytorch_patched_decoder.py", line 772, in decode
fprop_outputs, trasnformer_out = self(input_ts, input_padding, freq)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/aidata/miniforge3/envs/flamingo/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/aidata/miniforge3/envs/flamingo/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/timesfm/pytorch_patched_decoder.py", line 715, in forward
model_input, patched_padding, stats, _ = self._preprocess_input(
^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/timesfm/pytorch_patched_decoder.py", line 672, in _preprocess_input
patched_inputs, stats = self._forward_transform(patched_inputs,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/timesfm/pytorch_patched_decoder.py", line 618, in _forward_transform
mu, sigma = _masked_mean_std(inputs, patched_pads)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/timesfm/pytorch_patched_decoder.py", line 86, in _masked_mean_std
patch_indices = _get_patch_index(pad_sum)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/alidata/downloads/FlaMinGo-timesfm/src/timesfm/pytorch_patched_decoder.py", line 82, in _get_patch_index
indices = torch.argmax((arr >= 3).to(torch.int32), dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: argmax(): Expected reduction dim 1 to have non-zero size.

How can I fix the issues?
The data used for training like this:
1,1
2,2
3,3
4,4
5,5
6,6
7,7
8,8
9,9
10,10
11,11
12,12
13,13
14,14
15,15
16,16
17,17
18,18
19,19
20,20
21,21
22,22
23,23
24,24
25,25
26,26
27,27
28,28
29,29
30,30
31,31
32,32
33,33
34,34
35,35
36,36
37,37
38,38
39,39
40,40
41,41
42,42
43,43
44,44
45,45
46,46
47,47
48,48
49,49
50,50
51,51
52,52
53,53
54,54
55,55
56,56
57,57
58,58
59,59
60.60
61,61
62,62
63,63
64,64
The data used for evaluating like this:
5,5
6,6
7,7
8,8
9,9
10,10
11,11
12,12
13,13
14,14
15,15
16,16
17,17
18,18
19,19
20,20
21,21
22,22
23,23
24,24
25,25
26,26
27,27
28,28
29,29
30,20
31,31
32,32
33,33
34,34
35,35
36,36

Sign up or log in to comment