snap-stanford / UCE

UCE is a zero-shot foundation model for single-cell gene expression data
MIT License
120 stars 15 forks source link

Other "Output dimension" #26

Closed fengzhanying closed 4 months ago

fengzhanying commented 4 months ago

Can the parameter "--output_dim" be used? I set it to be 128 and I got this error:

Traceback (most recent call last): File "eval_single_anndata.py", line 155, in main(args, accelerator) File "eval_single_anndata.py", line 85, in main processor.run_evaluation() File "evaluate.py", line 145, in run_evaluation run_eval(self.adata, self.name, self.pe_idx_path, self.chroms_path, File "evaluate.py", line 203, in run_eval model.load_state_dict(torch.load(args.model_loc, map_location="cpu"), File "/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1671, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for TransformerModel: size mismatch for decoder.1.0.weight: copying a param with shape torch.Size([1280, 1024]) from checkpoint, the shape in current model is torch.Size([128, 1024]). size mismatch for decoder.1.0.bias: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for decoder.1.1.weight: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for decoder.1.1.bias: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for decoder.2.0.weight: copying a param with shape torch.Size([1280, 1280]) from checkpoint, the shape in current model is torch.Size([128, 128]). size mismatch for decoder.2.0.bias: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for decoder.2.1.weight: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for decoder.2.1.bias: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for decoder.3.weight: copying a param with shape torch.Size([1280, 1280]) from checkpoint, the shape in current model is torch.Size([128, 128]). size mismatch for decoder.3.bias: copying a param with shape torch.Size([1280]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for binary_decoder.0.0.weight: copying a param with shape torch.Size([2048, 2560]) from checkpoint, the shape in current model is torch.Size([2048, 1408]).

What is the cause of this error?

Yanay1 commented 4 months ago

Both of the models we made available for download have the same output dimension which is fixed (1280).