-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
How to reproduce the behaviour
I'm trying to run python -m spacy train config.cfg --output ./output --paths.train ./train.spacy --paths.dev ./dev.spacy --gpu-id 0 and as soon as I see
ℹ Saving to output directory: output
ℹ Using GPU: 0
=========================== Initializing pipeline ===========================
Some weights of RobertaModel were not initialized from the model checkpoint at roberta-base and are newly initialized: ['roberta.pooler.dense.bias', 'roberta.pooler.dense.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
✔ Initialized pipeline
============================= Training pipeline =============================
ℹ Pipeline: ['transformer', 'ner']
ℹ Initial learn rate: 0.0
I get the stacktrace
C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\thinc\util.py:395: VisibleDeprecationWarning: This function is deprecated and will be removed in a future release. Use the cupy.from_dlpack() array constructor instead. dlpack_tensor = xp_tensor.toDlpack() # type: ignore⚠ Aborting and saving the final best model. Encountered exception:
RuntimeError('from_dlpack received an invalid capsule. Note that DLTensor
capsules can be consumed only once, so you might have already constructed a
tensor from it once.')
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\__main__.py", line 4, in <module>
setup_cli()
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\cli\_util.py", line 87, in setup_cli
command(prog_name=COMMAND)
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1485, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\typer\core.py", line 795, in main
return _main(
^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\typer\core.py", line 188, in _main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1873, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 1269, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\click\core.py", line 824, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\typer\main.py", line 1514, in wrapper
return callback(**use_params)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\cli\train.py", line 54, in train_cli
train(config_path, output_path, use_gpu=use_gpu, overrides=overrides)
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\cli\train.py", line 84, in train
train_nlp(nlp, output_path, use_gpu=use_gpu, stdout=sys.stdout, stderr=sys.stderr)
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\training\loop.py", line 135, in train
raise e
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\training\loop.py", line 118, in train
for batch, info, is_best_checkpoint in training_step_iterator:
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\training\loop.py", line 220, in train_while_improving
nlp.update(
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy\language.py", line 1197, in update proc.update(examples, sgd=None, losses=losses, **component_cfg[name]) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "spacy/pipeline/transition_parser.pyx", line 439, in spacy.pipeline.transition_parser.Parser.update
backprop_tok2vec(golds)
File "spacy/ml/parser_model.pyx", line 334, in spacy.ml.parser_model.ParserStepModel.finish_steps
self.bp_tokvecs(d_tokvecs[:-1])
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\thinc\layers\chain.py", line 60, in backprop
dX = callback(dY)
^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\thinc\layers\chain.py", line 60, in backprop
dX = callback(dY)
^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy_transformers\layers\listener.py", line 41, in backprop_and_clear
result = self._backprop(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy_transformers\pipeline_component.py", line 316, in backprop
d_trf_full = trf_full.unsplit_by_doc(d_tensors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy_transformers\data_classes.py", line 315, in unsplit_by_doc
model_output[f"output_{i}"] = xp2torch(xp.vstack(x))
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\thinc\util.py", line 396, in xp2torch
torch_tensor = torch.utils.dlpack.from_dlpack(dlpack_tensor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\john\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\utils\dlpack.py", line 121, in from_dlpack
return _from_dlpack(dlpack)
^^^^^^^^^^^^^^^^^^^^
RuntimeError: from_dlpack received an invalid capsule. Note that DLTensor capsules can be consumed only once, so you might have already constructed a tensor from it once.
I've found a few other issues that suggest this is a version mismatch between pytorch and numpy, however I can't seem to find the winning version combination. Any ideas on how I can resolve this issue?
Your Environment
- Operating System: Windows 10
- Python Version Used: 3.12.10
- spaCy Version Used: 3.8.11
- Environment Information: here is the output of
pip list
Package Version
------------------ ------------
annotated-doc 0.0.4
annotated-types 0.7.0
blis 1.3.3
catalogue 2.0.10
certifi 2026.2.25
charset-normalizer 3.4.6
click 8.3.1
cloudpathlib 0.23.0
colorama 0.4.6
confection 0.1.5
cuda-pathfinder 1.4.3
cuda-toolkit 13.2.0
cupy-cuda12x 14.0.1
cymem 2.0.13
fastrlock 0.8.3
filelock 3.25.2
fsspec 2026.2.0
huggingface_hub 0.36.2
idna 3.11
Jinja2 3.1.6
markdown-it-py 4.0.0
MarkupSafe 3.0.3
mdurl 0.1.2
mpmath 1.3.0
murmurhash 1.0.15
networkx 3.6.1
numpy 2.4.3
packaging 26.0
pillow 12.0.0
pip 26.0.1
preshed 3.0.12
pydantic 2.12.5
pydantic_core 2.41.5
Pygments 2.19.2
PyYAML 6.0.3
regex 2026.2.28
requests 2.32.5
rich 14.3.3
safetensors 0.7.0
setuptools 82.0.1
shellingham 1.5.4
smart_open 7.5.1
spacy 3.8.11
spacy-alignments 0.9.2
spacy-legacy 3.0.12
spacy-loggers 1.0.5
spacy-transformers 1.3.9
srsly 2.5.2
sympy 1.13.1
thinc 8.3.10
tokenizers 0.21.4
torch 2.5.1+cu121
torchaudio 2.5.1+cu121
torchvision 0.20.1+cu121
tqdm 4.67.3
transformers 4.49.0
typer 0.24.1
typer-slim 0.24.0
typing_extensions 4.15.0
typing-inspection 0.4.2
urllib3 2.6.3
wasabi 1.1.3
weasel 0.4.3
wrapt 2.1.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels