Unverified Commit 4435c7f5 authored by Nicolas Patry's avatar Nicolas Patry Committed by GitHub
Browse files

Removing `more_itertools` dependency. (#21473)

* Removing `more_itertools` dependency.

* Update examples/research_projects/vqgan-clip/requirements.txt
parent 49433310
......@@ -14,17 +14,10 @@
# limitations under the License.
import re
import unicodedata
from fractions import Fraction
from typing import Iterator, List, Match, Optional, Union
from ...utils import is_more_itertools_available
if is_more_itertools_available():
from more_itertools import windowed
import unicodedata
import regex
......@@ -240,7 +233,9 @@ class EnglishNumberNormalizer:
if len(words) == 0:
return
for prev, current, next in windowed([None] + words + [None], 3):
for i, current in enumerate(words):
prev = words[i - 1] if i != 0 else None
next = words[i + 1] if i != len(words) - 1 else None
if skip:
skip = False
continue
......
......@@ -116,7 +116,6 @@ from .import_utils import (
is_kenlm_available,
is_keras_nlp_available,
is_librosa_available,
is_more_itertools_available,
is_natten_available,
is_ninja_available,
is_onnx_available,
......
......@@ -496,10 +496,6 @@ def is_detectron2_available():
return _detectron2_available
def is_more_itertools_available():
return importlib.util.find_spec("more_itertools") is not None
def is_rjieba_available():
return importlib.util.find_spec("rjieba") is not None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment