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

[Bug] Pii Redactor fail when running on Windows #971

Open
1 of 2 tasks
touma-I opened this issue Jan 25, 2025 · 0 comments
Open
1 of 2 tasks

[Bug] Pii Redactor fail when running on Windows #971

touma-I opened this issue Jan 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@touma-I
Copy link
Collaborator

touma-I commented Jan 25, 2025

Search before asking

  • I searched the issues and found no similar issues.

Component

Transforms/Other

What happened + What you expected to happen


ImportError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from dpk_pii_redactor.transform_python import PIIRedactor

File ~\OneDrive\Documents\GitHub\data-prep-kit\transforms\language\pii_redactor\dpk_pii_redactor_init_.py:1
----> 1 from .transform import *

File ~\OneDrive\Documents\GitHub\data-prep-kit\transforms\language\pii_redactor\dpk_pii_redactor\transform.py:24
     22 from data_processing.transform import AbstractTableTransform, TransformConfiguration
     23 from data_processing.utils import CLIArgumentProvider, TransformUtils, get_logger
---> 24 from dpk_pii_redactor.pii_analyzer import PIIAnalyzerEngine
     25 from dpk_pii_redactor.pii_anonymizer import PIIAnonymizer
     28 short_name = "pii_redactor"

File ~\OneDrive\Documents\GitHub\data-prep-kit\transforms\language\pii_redactor\dpk_pii_redactor\pii_analyzer.py:15
     12 import logging
     14 import spacy
---> 15 from dpk_pii_redactor.flair_recognizer import FlairRecognizer
     16 from presidio_analyzer import AnalyzerEngine, RecognizerRegistry
     17 from presidio_analyzer.nlp_engine import NlpEngineProvider

File ~\OneDrive\Documents\GitHub\data-prep-kit\transforms\language\pii_redactor\dpk_pii_redactor\flair_recognizer.py:20
     17 from typing import List, Optional, Set, Tuple
     19 from data_processing.utils import get_logger
---> 20 from flair.data import Sentence
     21 from flair.models import SequenceTagger
     22 from presidio_analyzer import AnalysisExplanation, EntityRecognizer, RecognizerResult

File ~\anaconda3\Lib\site-packages\flair\__init__.py:6
      3 from pathlib import Path
      5 import torch
----> 6 from transformers import set_seed as hf_set_seed
      8 # global variable: cache_root
      9 from .file_utils import set_proxies

File ~\AppData\Roaming\Python\Python312\site-packages\transformers\__init__.py:26
     23 from typing import TYPE_CHECKING
     25 # Check the dependencies satisfy the minimal versions required.
---> 26 from . import dependency_versions_check
     27 from .utils import (
     28     OptionalDependencyNotAvailable,
     29     _LazyModule,
   (...)
     48     logging,
     49 )
     52 logger = logging.get_logger(__name__)  # pylint: disable=invalid-name

File ~\AppData\Roaming\Python\Python312\site-packages\transformers\dependency_versions_check.py:16
      1 # Copyright 2020 The HuggingFace Team. All rights reserved.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
   (...)
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     15 from .dependency_versions_table import deps
---> 16 from .utils.versions import require_version, require_version_core
     19 # define which module versions we always want to check at run time
     20 # (usually the ones defined in `install_requires` in setup.py)
     21 #
     22 # order specific notes:
     23 # - tqdm must be checked before tokenizers
     25 pkgs_to_check_at_runtime = [
     26     "python",
     27     "tqdm",
   (...)
     37     "pyyaml",
     38 ]

File ~\AppData\Roaming\Python\Python312\site-packages\transformers\utils\__init__.py:27
     25 from .. import __version__
     26 from .backbone_utils import BackboneConfigMixin, BackboneMixin
---> 27 from .chat_template_utils import DocstringParsingException, TypeHintParsingException, get_json_schema
     28 from .constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD
     29 from .doc import (
     30     add_code_sample_docstrings,
     31     add_end_docstrings,
   (...)
     35     replace_return_docstrings,
     36 )

File ~\AppData\Roaming\Python\Python312\site-packages\transformers\utils\chat_template_utils.py:39
     36     from PIL.Image import Image
     38 if is_torch_available():
---> 39     from torch import Tensor
     42 BASIC_TYPES = (int, float, str, bool, Any, type(None), ...)
     43 # Extracts the initial segment of the docstring, containing the function description

ImportError: cannot import name 'Tensor' from 'torch' (unknown location)

Reproduction script

On Windows 11, start Conda Navigator with python 3.12 and run the pii redactor notebook from here:
data-prep-kit/transforms/language/pii_redactor/piiredactor.ipynb

Anything else

No response

OS

Windows WSL

Python

Other

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@touma-I touma-I added the bug Something isn't working label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant