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

ValueError: Caught ValueError in DataLoader worker process 0 #1

Open
jiangyuinsar opened this issue Dec 28, 2022 · 0 comments
Open

Comments

@jiangyuinsar
Copy link

Hi Yijian,

Thanks for sharing the codes, PAL and MESS, and the user guide and video are helpful.

I try to follow your user guide to run MESS, but an error occurred in cutting templates, cut_template_eg.py.

I trace the error and the problem lies in line 150 in cut_template_tensor.py.

for i, data_paths_i in enumerate(dataloader): 
    print(1)
    data_paths += data_paths_i
    if i%10==0: print('%s/%s sta-date pairs done/total'%(i+1,len(dataset)))

The error is also listed below.

runfile('/home/yu.jiang/Program/122PAL/example_mess_workdir/cut_template_eg.py', wdir='/home/yu.jiang/Program/122PAL/example_mess_workdir')
0/2828 events done/total
1000/2828 events done/total
2000/2828 events done/total
reading CI.CCC 2019-07-04
reading CI.JRC2 2019-07-04
reading CI.WBM 2019-07-04
reading CI.SLA 2019-07-04
reading CI.LRL 2019-07-04
reading CI.CLC 2019-07-04
reading CI.MPM 2019-07-04
reading CI.SRT 2019-07-04
reading CI.TOW2 2019-07-04
<enumerate object at 0x7fa2818c5b80>
Traceback (most recent call last):
  File "/home/yu.jiang/Program/122PAL/cut_template_intense.py", line 151, in <module>
    for i, data_paths_i in enumerate(dataloader): 
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 681, in __next__
    data = self._next_data()
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1376, in _next_data
    return self._process_data(data)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1402, in _process_data
    data.reraise()
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/torch/_utils.py", line 461, in reraise
    raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/scipy/signal/windows/_windows.py", line 2214, in get_window
    beta = float(window)
ValueError: could not convert string to float: 'hanning'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/scipy/signal/windows/_windows.py", line 2232, in get_window
    winfunc = _win_equiv[winstr]
KeyError: 'hanning'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
    data = self.dataset[possibly_batched_index]
  File "/home/yu.jiang/Program/122PAL/cut_template_intense.py", line 105, in __getitem__
    stream = preprocess(stream)
  File "/home/yu.jiang/Program/122PAL/dataset_gpu.py", line 184, in preprocess
    if org_rate!=samp_rate: st.resample(samp_rate)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/obspy/core/stream.py", line 2335, in resample
    tr.resample(sampling_rate, window=native_str(window),
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/obspy/core/util/decorator.py", line 245, in skip_if_no_data
    return func(*args, **kwargs)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/obspy/core/trace.py", line 273, in _add_processing_info
    result = func(*args, **kwargs)
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/obspy/core/trace.py", line 1733, in resample
    large_w = np.fft.ifftshift(get_window(native_str(window),
  File "/home/yu.jiang/.conda/envs/obspy/lib/python3.8/site-packages/scipy/signal/windows/_windows.py", line 2234, in get_window
    raise ValueError("Unknown window type.") from e
ValueError: Unknown window type.

Note that, enumerate(dataloader) seems okay, which returns

reading CI.CCC 2019-07-04
reading CI.JRC2 2019-07-04
reading CI.WBM 2019-07-04
reading CI.SLA 2019-07-04
reading CI.LRL 2019-07-04
reading CI.CLC 2019-07-04
reading CI.MPM 2019-07-04
reading CI.SRT 2019-07-04
reading CI.TOW2 2019-07-04

Could you help me to figure out what happened? Many thanks for your help.

Kind regards,
Yu

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