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

"--device cpu" does not work when running decode_embeddings.py #4

Open
1000000000000000000000000000000 opened this issue Jun 25, 2024 · 0 comments

Comments

@1000000000000000000000000000000
Copy link

1000000000000000000000000000000 commented Jun 25, 2024

Hello,

I am running on my laptop, a device that does not have a GPU.

When I ran the following command:
"python -m scripts.decode_embeddings --output_file decoded_output.csv --predicted_embeddings sample.pt --model translation --device cpu --model_load models/model.pt --vocab_load models/vocab.nb --config_load models/config.nb --n_batch 65 --num_variants 3"

I got this error:
"ArgumentParser(prog='decode_embeddings.py', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
Namespace(config_load='models/config.nb', device='cpu', model='translation', model_load='models/model.pt', n_batch=65, num_variants=3, output_file='decoded_output.csv', predicted_embeddings='sample.pt', vocab_load='models/vocab.nb')
{'#': 0, '%': 1, '(': 2, ')': 3, '+': 4, '-': 5, '0': 6, '1': 7, '2': 8, '3': 9, '4': 10, '5': 11, '6': 12, '7': 13, '8': 14, '9': 15, '=': 16, 'B': 17, 'Br': 18, 'C': 19, 'Cl': 20, 'F': 21, 'H': 22, 'I': 23, 'N': 24, 'O': 25, 'P': 26, 'S': 27, '[': 28, ']': 29, 'c': 30, 'n': 31, 'o': 32, 'p': 33, 's': 34, '': 35, '': 36, '': 37, '': 38}
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "C:\Users\pearsor5\AppData\Local\miniconda3\envs\spec2mol\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\Users\pearsor5\AppData\Local\miniconda3\envs\spec2mol\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\pearsor5\Documents\Scripts\Spec2mol_Test\Spec2Mol\decoder\scripts\decode_embeddings.py", line 176, in
main(config.model, config)
File "C:\Users\pearsor5\Documents\Scripts\Spec2mol_Test\Spec2Mol\decoder\scripts\decode_embeddings.py", line 166, in main
config.num_variants,
File "C:\Users\pearsor5\Documents\Scripts\Spec2mol_Test\Spec2Mol\decoder\scripts\decode_embeddings.py", line 45, in decode
mu_predicted = mu_predicted.cuda()
File "C:\Users\pearsor5\AppData\Local\miniconda3\envs\spec2mol\lib\site-packages\torch\cuda_init
.py", line 186, in _lazy_init
check_driver()
File "C:\Users\pearsor5\AppData\Local\miniconda3\envs\spec2mol\lib\site-packages\torch\cuda_init
.py", line 68, in _check_driver
http://www.nvidia.com/Download/index.aspx""")
AssertionError:
Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from
http://www.nvidia.com/Download/index.aspx"

To fix my issue, I edited line 45 in the decode_embeddings.py script.

Line 45 was changed from:
" mu_predicted = mu_predicted.cuda()" to " mu_predicted = mu_predicted.to(config.device)".

After some minor changes to the code I was able to get the example working and the output was the following:
image

Thanks for making the code available!

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