Assertion `srcIndex < srcSelectDimSize` failed
11asdad opened this issue · 4 comments
I managed to get beyond this issue. Turned out my input file had Windows line endings (can't believe I'm even admitting to that, but whatever, it happens) Also, my source files are C, not CPP, not sure if that was causing CUBLAS_STATUS_NOT_INITIALIZED
but I intend to create a new processor for C.
Originally posted by @raffian in #55 (comment)
Dose it worked after you changed the line endings?I have the same error.But it doesn't work after I change these.
I just ran as the guide in https://github.com/facebookresearch/CodeGen/blob/main/docs/transcoder.md
:
[translator_transcoder_size_from_DOBF](https://dl.fbaipublicfiles.com/transcoder/pre_trained_models/translator_transcoder_size_from_DOBF.pth)
Its computational accuracy (CA@1) scores are 39.5% for Python -> Java (44.7% with beam size 10) and 49.2% for Java -> Python (52.5% with beam size 10).
You can use these models to translate functions with [this script](https://github.com/facebookresearch/CodeGen/blob/main/codegen_sources/model/translate.py):
python -m codegen_sources.model.translate --src_lang python --tgt_lang java --model_path <model_path> --beam_size 1 < my_python_file_to_translate.py
Then after the output INE', 'DEDENT'] Loading codes from /home/<user_dir>/projects/code-gen/CodeGen-main/data/bpe/cpp-java-python/codes ... Read 50000 codes from the codes file.
I got errors like these all over the screen:
/opt/conda/conda-bld/pytorch_1646755897462/work/aten/src/ATen/native/cuda/Indexing.cu:703: indexSelectLargeIndex: block: [142,0,0], thread: [64,0,0] Assertion `srcIndex < srcSelectDimSize` failed. /opt/conda/conda-bld/pytorch_1646755897462/work/aten/src/ATen/native/cuda/Indexing.cu:703: indexSelectLargeIndex: block: [142,0,0], thread: [65,0,0] Assertion `srcIndex < srcSelectDimSize` failed.
and one another error:
File "/home/<user_dir>/anaconda3/envs/<env_dir>/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/<user_dir>/anaconda3/envs/<env_dir>/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/<user_dir>/projects/code-gen/CodeGen-main/codegen_sources/model/translate.py", line 280, in <module>
output = translator.translate(
File "/home/<user_dir>/projects/code-gen/CodeGen-main/codegen_sources/model/translate.py", line 197, in translate
enc1 = self.encoder("fwd", x=x1, lengths=len1, langs=langs1, causal=False)
File "/home/<user_dir>/anaconda3/envs/<env_dir>/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/<user_dir>/projects/code-gen/CodeGen-main/codegen_sources/model/src/model/transformer.py", line 433, in forward
return self.fwd(**kwargs)
File "/home/<user_dir>/projects/code-gen/CodeGen-main/codegen_sources/model/src/model/transformer.py", line 526, in fwd
attn = self.attentions[i](tensor, attn_mask, use_cache=use_cache)
File "/home/<user_dir>/anaconda3/envs/<env_dir>/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/<user_dir>/projects/code-gen/CodeGen-main/codegen_sources/model/src/model/transformer.py", line 243, in forward
q = shape(self.q_lin(input)) # (bs, n_heads, qlen, dim_per_head)
File "/home/<user_dir>/anaconda3/envs/<env_dir>/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/<user_dir>/anaconda3/envs/<env_dir>/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 103, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling `cublasCreate(handle)`
I find some discussions say it's maybe a version problem between CUDA and pytorch ,but my pytorch and CUDA have ran successfully in other project.And if I set them with the install_env.sh ,I got the same problem as #20 (comment) which was solved by using different versions.
N_MAX_POSITIONS = 2048 # maximum input sequence length
set a bigger number just like 10000
N_MAX_POSITIONS = 10000 # maximum input sequence length
It works!thank you!