paninski-lab / yass

YASS: Yet Another Spike Sorter
https://github.com/paninski-lab/yass/wiki
Apache License 2.0
63 stars 15 forks source link

Size mismatch for out.weight in pre_final_deconv #321

Closed DradeAW closed 4 years ago

DradeAW commented 4 years ago

Hi,

After resolving the issue #320 I have another issue.

I'm having (with yass 2.0) a similar problem that I had in the previous versions: issue #310 I am currently running this on my data without the neural network for spike detection.

yass.pipeline@pre_final_deconv 31/03/2020 15:26:03 INFO RESIDUAL COMPUTATION

of chunks: 60

60it [00:06, 9.08it/s] Total residual time: 6.61220121383667 yass.pipeline@pre_final_deconv 31/03/2020 15:26:13 INFO SOFT ASSIGNMENT Traceback (most recent call last): File "/users/nsr/wyngaard/miniconda3/envs/yass2/bin/yass", line 11, in load_entry_point('yass-algorithm', 'console_scripts', 'yass')() File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/export/home1/users/nsr/wyngaard/yass/src/yass/command_line.py", line 80, in sort calculate_rf=calculate_rf, visualize=visualize)#, File "/export/home1/users/nsr/wyngaard/yass/src/yass/pipeline.py", line 172, in run run_chunk_sec = CONFIG.clustering_chunk) File "/export/home1/users/nsr/wyngaard/yass/src/yass/pipeline.py", line 431, in pre_final_deconv compute_template_soft=True) File "/export/home1/users/nsr/wyngaard/yass/src/yass/soft_assignment/run.py", line 69, in run detector.load(CONFIG.neuralnetwork.detect.filename) File "/export/home1/users/nsr/wyngaard/yass/src/yass/neuralnetwork/model_detector.py", line 145, in load self.load_state_dict(checkpoint) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 830, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Detect: size mismatch for out.weight: copying a param with shape torch.Size([1, 56]) from checkpoint, the shape in current model is torch.Size([1, 88]).

Here is my config.yaml: (I removed the comment for more visibility) ` data: root_folder: ./ recordings: amplifier.dat geometry: geom.txt initial_templates:

resources: multi_processing: 1 n_processors: 20 n_gpu_processors: 1 n_sec_chunk: 10 n_sec_chunk_gpu_detect: 0.5 n_sec_chunk_gpu_deconv: 5 gpu_id: 0 generate_phy: 1

recordings: dtype: int16 sampling_rate: 30000 n_channels: 64 spatial_radius: 70 spike_size_ms: 5 clustering_chunk: [0, 300] final_deconv_chunk: #[0, 120]

neuralnetwork: apply_nn: False detect: filename: detect.pt n_filters: [16, 8, 8] denoise: filename: denoise.pt n_filters: [16, 8, 4] filter_sizes : [5, 11, 21] training: input_spike_train_filname: spike_size_ms:

preprocess: apply_filter: True dtype: float32 filter: order: 3 low_pass_freq: 300 high_factor: 0.1

detect: threshold: 4

cluster: max_n_spikes: 20000 knn_triage: 0.05 min_fr: 0.2 prior: beta: 1 a: 1 lambda0: 0.01 nu: 5 V: 2

clean_up: abs_max_diff: 1.5 rel_max_diff: 0.1 min_ptp: 2.5 min_fr: 0.2 off_center: 5 mad: min_var_gap: 2 max_violations: 10

deconvolution: threshold: 50 deconv_gpu: True update_templates: True template_update_time: 300 `

Thank you

catubc commented 4 years ago

Hi. Thanks for your report. For several versions now, YASS uses NNs to denoise as well as detect waveforms. Even if you default to threshold event detection, you will need NNs to denoise your waveforms (we did not implement a non-NN option at this time).

We recommend training YASS on your data using the wiki instructions: https://github.com/paninski-lab/yass/wiki/Neural-Networks---Loading-and-Retraining

If you have issues with this let us know.

jinhyunglee commented 4 years ago

@Dradeliomecus,

I can see what the problem there is. We haven't really tested no nn version thoroughly.

Let me try to fix it today and if it seems that it will take a while, i will also let you know.

jinhyunglee commented 4 years ago

@Dradeliomecus, can you try now? I tested that no nn yass works on the sample data

DradeAW commented 4 years ago

Thank you for the quick solution! I no longer have this problem.

However I have a new one: yass.phy.run@run 31/03/2020 21:57:33 INFO GENERATTING PHY files Traceback (most recent call last): File "/users/nsr/wyngaard/miniconda3/envs/yass2/bin/yass", line 11, in load_entry_point('yass-algorithm', 'console_scripts', 'yass')() File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/export/home1/users/nsr/wyngaard/yass/src/yass/command_line.py", line 80, in sort calculate_rf=calculate_rf, visualize=visualize)#, File "/export/home1/users/nsr/wyngaard/yass/src/yass/pipeline.py", line 185, in run CONFIG) File "/export/home1/users/nsr/wyngaard/yass/src/yass/pipeline.py", line 646, in final_deconv phy.run(CONFIG) File "/export/home1/users/nsr/wyngaard/yass/src/yass/phy/run.py", line 45, in run spike_train = np.load(root_dir + '/tmp/final_deconv/deconv/spike_train.npy') File "/users/nsr/wyngaard/miniconda3/envs/yass2/lib/python3.7/site-packages/numpy/lib/npyio.py", line 428, in load fid = open(os_fspath(file), "rb") FileNotFoundError: [Errno 2] No such file or directory: './/tmp/final_deconv/deconv/spike_train.npy'

jinhyunglee commented 4 years ago

do you want to generate phy files? if not, can you set resources, generate_phy: 0?

DradeAW commented 4 years ago

Yes, if possible I would want to generate the phy files.

But maybe if I try with the neural network I won't have this error? I might try with the neural network tomorrow to see if it works.

jinhyunglee commented 4 years ago

you will still get the error with the nn. this is not my code but let me take a look and see if I can fix.

jinhyunglee commented 4 years ago

@Dradeliomecus , can you check now and let me know?

DradeAW commented 4 years ago

Yes it works now!

Thank you very much :)