question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running UD-pipeline with CPU results in ValueError: Gradient scaling is not supported

See original GitHub issue

I want to run the universal dependency pipeline only with a cpu. While loading the model i get this error:

Traceback (most recent call last):
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/test.py", line 4, in <module>
    en_nlp = spacy.load("en_udv25_englishewt_trf")
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/__init__.py", line 51, in load
    return util.load_model(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/util.py", line 420, in load_model
    return load_model_from_package(name, **kwargs)  # type: ignore[arg-type]
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/util.py", line 453, in load_model_from_package
    return cls.load(vocab=vocab, disable=disable, exclude=exclude, config=config)  # type: ignore[attr-defined]
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/en_udv25_englishewt_trf/__init__.py", line 10, in load
    return load_model_from_init_py(__file__, **overrides)
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/util.py", line 615, in load_model_from_init_py
    return load_model_from_path(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/util.py", line 488, in load_model_from_path
    nlp = load_model_from_config(config, vocab=vocab, disable=disable, exclude=exclude)
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/util.py", line 525, in load_model_from_config
    nlp = lang_cls.from_config(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/language.py", line 1782, in from_config
    nlp.add_pipe(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/language.py", line 792, in add_pipe
    pipe_component = self.create_pipe(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy/language.py", line 674, in create_pipe
    resolved = registry.resolve(cfg, validate=validate)
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/thinc/config.py", line 746, in resolve
    resolved, _ = cls._make(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/thinc/config.py", line 795, in _make
    filled, _, resolved = cls._fill(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/thinc/config.py", line 850, in _fill
    filled[key], validation[v_key], final[key] = cls._fill(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/thinc/config.py", line 867, in _fill
    getter_result = getter(*args, **kwargs)
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy_transformers/architectures.py", line 234, in create_TransformerModel_v3
    model = TransformerModel(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy_transformers/layers/transformer_model.py", line 45, in __init__
    wrapper = HFWrapper(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy_transformers/layers/hf_wrapper.py", line 49, in HFWrapper
    HFShim(
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/spacy_transformers/layers/hf_shim.py", line 40, in __init__
    grad_scaler=PyTorchGradScaler(**grad_scaler_config),
  File "/home/cyclonaut/Dokumente/workspaces/udSpacy/lib/python3.10/site-packages/thinc/shims/pytorch_grad_scaler.py", line 54, in __init__
    raise ValueError(
ValueError: Gradient scaling is not supported, requires capable GPU and torch>=1.9.0

The model is loaded in ubuntu 22.04

- **spaCy version:** 3.2.4
- **Platform:** Linux-5.15.0-27-lowlatency-x86_64-with-glibc2.35
- **Python version:** 3.10.4
- **Pipelines:** de_udv25_germanhdt_trf (0.0.1), en_udv25_englishewt_trf (0.0.1), en_core_web_sm (3.2.0)

with Python 3.10.4 and this pip environment:

blis==0.7.7
catalogue==2.0.7
certifi==2021.10.8
charset-normalizer==2.0.12
click==8.0.4
cymem==2.0.6
de-udv25-germanhdt-trf @ https://huggingface.co/explosion/de_udv25_germanhdt_trf/resolve/main/de_udv25_germanhdt_trf-any-py3-none-any.whl
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0-py3-none-any.whl
en-udv25-englishewt-trf @ https://huggingface.co/explosion/en_udv25_englishewt_trf/resolve/main/en_udv25_englishewt_trf-any-py3-none-any.whl
filelock==3.6.0
huggingface-hub==0.5.1
idna==3.3
Jinja2==3.1.2
joblib==1.1.0
langcodes==3.3.0
MarkupSafe==2.1.1
murmurhash==1.0.7
numpy==1.22.3
packaging==21.3
pathy==0.6.1
Pillow==9.1.0
preshed==3.0.6
pydantic==1.8.2
pyparsing==3.0.8
PyYAML==6.0
regex==2022.4.24
requests==2.27.1
sacremoses==0.0.53
six==1.16.0
smart-open==5.2.1
spacy==3.2.4
spacy-alignments==0.8.5
spacy-experimental==0.2.0
spacy-legacy==3.0.9
spacy-loggers==1.0.2
spacy-transformers==1.1.5
srsly==2.4.3
thinc==8.0.15
tokenizers==0.12.1
torch==1.11.0+cpu
torchaudio==0.11.0+cpu
torchvision==0.12.0+cpu
tqdm==4.64.0
transformers==4.17.0
typer==0.4.1
typing_extensions==4.2.0
urllib3==1.26.9
wasabi==0.9.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shadeMecommented, May 19, 2022

We are currently in the process of finalizing a bug-fix release (v8.0.16) with the aforementioned fix, amongst others.

1reaction
Bachstelzecommented, May 27, 2022

Yes, it is working with the normal CUDA warnings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running UD-pipeline with CPU results in ValueError: Gradient ...
I want to run the universal dependency pipeline only with a cpu. ... with CPU results in ValueError: Gradient scaling is not supported...
Read more >
mutableState&quot; in android jetpack compose? - t.co / Twitter
MutableState is an alternative to using LiveData or Flow . Compose does not observe any changes to this object by default and therefore...
Read more >
A comparison between spaCy and UDPipe for Natural ...
A comparison between spaCy and UDPipe for Natural Language Processing for R users. In the last few years, Natural Language Processing (NLP) has...
Read more >
Natural Language Processing and Chinese Computing
Welcome to 9th CCF International Conference on Natural Language Processing and. Chinese Computing (NLPCC 2020). Following the success of ...
Read more >
(PDF) Data Science Life Cycle Sheet | Dametreus Vincent
Main types of conver- Scaling: log, z-score, minmax scale ... dt.datetime.now() - Assign datetime and handling ValueError: could not convert my_set = set(l) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found