From e15fd57929a77f8d69ecee4f2f2718cb000a0f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Sun, 16 May 2021 10:01:08 +0200 Subject: [PATCH] python3Packages.spacy-transformers: init at 1.0.2 This package provides spaCy model pipelines that wrap Hugging Face's transformers package, so that they can be used in spaCy. --- .../spacy-transformers/default.nix | 39 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 41 insertions(+) create mode 100644 pkgs/development/python-modules/spacy-transformers/default.nix diff --git a/pkgs/development/python-modules/spacy-transformers/default.nix b/pkgs/development/python-modules/spacy-transformers/default.nix new file mode 100644 index 00000000000..0e8669d98ff --- /dev/null +++ b/pkgs/development/python-modules/spacy-transformers/default.nix @@ -0,0 +1,39 @@ +{ lib +, fetchPypi +, buildPythonPackage +, pytorch +, spacy +, spacy-alignments +, srsly +, transformers +}: + +buildPythonPackage rec { + pname = "spacy-transformers"; + version = "1.0.2"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-AYshH2trMTgeSkAPRb6wRWpm4gA5FaKV2NJd+PhzAy4="; + }; + + propagatedBuildInputs = [ + pytorch + spacy + spacy-alignments + srsly + transformers + ]; + + # Test fails due to missing arguments for trfs2arrays(). + doCheck = false; + + pythonImportsCheck = [ "spacy_transformers" ]; + + meta = with lib; { + description = "spaCy pipelines for pretrained BERT, XLNet and GPT-2"; + homepage = "https://github.com/explosion/spacy-transformers"; + license = licenses.mit; + maintainers = with maintainers; [ danieldk ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 514ce9626e6..85c1a6a1f60 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7724,6 +7724,8 @@ in { spacy-pkuseg = callPackage ../development/python-modules/spacy-pkuseg { }; + spacy-transformers = callPackage ../development/python-modules/spacy-transformers { }; + spake2 = callPackage ../development/python-modules/spake2 { }; spark_parser = callPackage ../development/python-modules/spark_parser { };