urchade/GLiNER

Required seqeval dependency is outdated and not maintained

Closed this issue · 6 comments

One of the required dependencies of GLiNER seqeval looks to be outdated. Its breaking setuptools which is causing issues when trying to install GLiNER. The development of this package seems to have halted in 2022 which means that it will keep raising issue. Could you maybe port important code from the package to GLiNER and remove the dependency? Else build systems like Bazel or Pants might have difficulties rolling out GLiNER in prod systems.

Also looking at the dependency I feel it could be pretty easy to port or use another more active package.

from seqeval.metrics.v1 import _prf_divide

def _prf_divide(numerator, denominator, metric,
                modifier, average, warn_for, zero_division='warn'):
    """Performs division and handles divide-by-zero.

    On zero-division, sets the corresponding result elements equal to
    0 or 1 (according to ``zero_division``). Plus, if
    ``zero_division != "warn"`` raises a warning.

    The metric, modifier and average arguments are used only for determining
    an appropriate warning.
    """
    mask = denominator == 0.0
    denominator = denominator.copy()
    denominator[mask] = 1  # avoid infs/nans
    result = numerator / denominator

    if not np.any(mask):
        return result

    # if ``zero_division=1``, set those with denominator == 0 equal to 1
    result[mask] = 0.0 if zero_division in ['warn', 0] else 1.0

    # the user will be removing warnings if zero_division is set to something
    # different than its default value. If we are computing only f-score
    # the warning will be raised only if precision and recall are ill-defined
    if zero_division != 'warn' or metric not in warn_for:
        return result

    # build appropriate warning
    # E.g. "Precision and F-score are ill-defined and being set to 0.0 in
    # labels with no predicted samples. Use ``zero_division`` parameter to
    # control this behavior."

    if metric in warn_for and 'f-score' in warn_for:
        msg_start = '{0} and F-score are'.format(metric.title())
    elif metric in warn_for:
        msg_start = '{0} is'.format(metric.title())
    elif 'f-score' in warn_for:
        msg_start = 'F-score is'
    else:
        return result

    _warn_prf(average, modifier, msg_start, len(result))

    return result

If repo org agree's that this is an issue I'm more than happy to make a PR to resolve this

hi @roberth-plutoflume, sure you can make a PR

Ok great Ill push it from my private github account

I have the code ready in a branch but cant push it due to access rights. I tried to find any guidance on contributing but can't find it.

ERROR: Permission to urchade/GLiNER.git denied to RobertHGit.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

My bad was doing it wrong of course