Skip to content

Torch not compiled with CUDA enabled #7

@prashantvidja

Description

@prashantvidja

Hi,

Run spacy with the "extend" but got below error.

(extend) ubuntu@ip-172-31-3-241:~/extend$ python spacy_test.py 
Some weights of the model checkpoint at allenai/longformer-large-4096 were not used when initializing LongformerForQuestionAnswering: ['lm_head.layer_norm.weight', 'lm_head.bias', 'lm_head.decoder.weight', 'lm_head.dense.bias', 'lm_head.layer_norm.bias', 'lm_head.dense.weight']
- This IS expected if you are initializing LongformerForQuestionAnswering from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing LongformerForQuestionAnswering from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some weights of LongformerForQuestionAnswering were not initialized from the model checkpoint at allenai/longformer-large-4096 and are newly initialized: ['qa_outputs.weight', 'qa_outputs.bias']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
Traceback (most recent call last):
  File "spacy_test.py", line 13, in <module>
    nlp.add_pipe("extend", after="ner", config=extend_config)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/spacy/language.py", line 792, in add_pipe
    pipe_component = self.create_pipe(
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/spacy/language.py", line 674, in create_pipe
    resolved = registry.resolve(cfg, validate=validate)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/thinc/config.py", line 746, in resolve
    resolved, _ = cls._make(
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/thinc/config.py", line 795, in _make
    filled, _, resolved = cls._fill(
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/thinc/config.py", line 867, in _fill
    getter_result = getter(*args, **kwargs)
  File "/home/ubuntu/extend/extend/spacy_component.py", line 86, in __init__
    self.model = load_checkpoint(checkpoint_path, device)
  File "/home/ubuntu/extend/extend/spacy_component.py", line 24, in load_checkpoint
    model.to(torch.device(device))
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/pytorch_lightning/core/mixins/device_dtype_mixin.py", line 111, in to
    return super().to(*args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/nn/modules/module.py", line 852, in to
    return self._apply(convert)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/nn/modules/module.py", line 530, in _apply
    module._apply(fn)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/nn/modules/module.py", line 530, in _apply
    module._apply(fn)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/nn/modules/module.py", line 530, in _apply
    module._apply(fn)
  [Previous line repeated 1 more time]
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/nn/modules/module.py", line 552, in _apply
    param_applied = fn(param)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/nn/modules/module.py", line 850, in convert
    return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
  File "/home/ubuntu/miniconda3/envs/extend/lib/python3.8/site-packages/torch/cuda/__init__.py", line 166, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

I think we can't install Cuda without GPU on the machine.
Can we solve this without GPU?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions