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

Check for the len in X before using to print training related log #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sklearn_crfsuite/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def fit(self, X, y, X_dev=None, y_dev=None):
trainer = self._get_trainer()
train_data = zip(X, y)

if self.verbose:
if self.verbose and "__len__" in dir(X):
train_data = tqdm(train_data, "loading training data to CRFsuite", len(X), leave=True)

for xseq, yseq in train_data:
Expand All @@ -319,7 +319,7 @@ def fit(self, X, y, X_dev=None, y_dev=None):
if X_dev is not None:
test_data = zip(X_dev, y_dev)

if self.verbose:
if self.verbose and "__len__" in dir(X_dev):
test_data = tqdm(test_data, "loading dev data to CRFsuite", len(X_dev), leave=True)

for xseq, yseq in test_data:
Expand Down