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

Run on a device without GPU #20

Open
MartinChiaHsinLiu opened this issue Jan 19, 2025 · 1 comment
Open

Run on a device without GPU #20

MartinChiaHsinLiu opened this issue Jan 19, 2025 · 1 comment

Comments

@MartinChiaHsinLiu
Copy link

MartinChiaHsinLiu commented Jan 19, 2025

I had successfully install all dependency for PhenoTagger.
However, my device is old without GPU card supporting.
When I run the example using the given command in README (python PhenoTagger_tagging.py -i ../example/input/ -o ../example/output/)
I get the following error message and I think it is caused by the GPU usage issue.
Consequently, I just wonder weather I can run PhenoTagger using just CPU ?

The error message is as following:

/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/PhenoTagger_tagging.py:35: SyntaxWarning: invalid escape sequence '\|'
  p_title = re.compile('^([0-9]+)\|t\|(.*)$')
/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/PhenoTagger_tagging.py:36: SyntaxWarning: invalid escape sequence '\|'
  p_abstract = re.compile('^([0-9]+)\|a\|(.*)$')
/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/PhenoTagger_tagging.py:235: SyntaxWarning: invalid escape sequence '\|'
  pattern_pubtator = re.compile('^([^\|]+)\|[^\|]+\|(.*)')
2025-01-19 04:23:24.644501: I external/local_xla/xla/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2025-01-19 04:23:24.649508: I external/local_xla/xla/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
2025-01-19 04:23:24.662747: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1737278604.683947 2710561 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1737278604.690330 2710561 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2025-01-19 04:23:32.415721: E external/local_xla/xla/stream_executor/cuda/cuda_driver.cc:152] failed call to cuInit: INTERNAL: CUDA error: Failed call to cuInit: UNKNOWN ERROR (303)
Num GPUs Available:  0
loading dict!
Dic_len: 51201
load dic done!
Traceback (most recent call last):
  File "/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/PhenoTagger_tagging.py", line 278, in <module>
    phenotagger_tag(args.infolder,para_set,args.outfolder)
  File "/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/PhenoTagger_tagging.py", line 213, in phenotagger_tag
    nn_model=bioTag_BERT(vocabfiles)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/nn_model.py", line 110, in __init__
    self.rep = BERT_RepresentationLayer(self.checkpoint_path, self.label_file, lowercase=self.lowercase)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/r740/Script/Public_softwares/9.others/PhenoTagger/src/nn_represent.py", line 217, in __init__
    self.tokenizer = AutoTokenizer.from_pretrained(tokenizer_name_or_path, use_fast=True,do_lower_case=lowercase)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anaconda3/envs/NLP_2025/lib/python3.12/site-packages/transformers/models/auto/tokenization_auto.py", line 871, in from_pretrained
    tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anaconda3/envs/NLP_2025/lib/python3.12/site-packages/transformers/models/auto/tokenization_auto.py", line 725, in get_tokenizer_config
    result = json.load(reader)
             ^^^^^^^^^^^^^^^^^
  File "/home/anaconda3/envs/NLP_2025/lib/python3.12/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/home/anaconda3/envs/NLP_2025/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anaconda3/envs/NLP_2025/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anaconda3/envs/NLP_2025/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@lingluodlut
Copy link
Collaborator

Hi,
You can run PhenoTagger using only the CPU, but it will process text slowly.
I don't think this error is related to the GPU usage. It seems to be caused by the Python version. You could try installing Python 3.10.

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

2 participants