Skip to content

Commit

Permalink
Reduce logging messages and simplify logging (#2682)
Browse files Browse the repository at this point in the history
* change log levels to debug and use torch.div

* Update Documentation & Code Style

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
julian-risch and github-actions[bot] authored Jul 4, 2022
1 parent 322d964 commit f7d0047
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion haystack/document_stores/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
try:
from numba import njit # pylint: disable=import-error
except (ImportError, ModuleNotFoundError):
logger.info("Numba not found, replacing njit() with no-op implementation. Enable it with 'pip install numba'.")
logger.debug("Numba not found, replacing njit() with no-op implementation. Enable it with 'pip install numba'.")

def njit(f):
return f
Expand Down
4 changes: 2 additions & 2 deletions haystack/modeling/model/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

except AttributeError:
APEX_PARALLEL_AVAILABLE = False
logger.info("apex.parallel not found, won't use it. See https://nvidia.github.io/apex/parallel.html")
logger.debug("apex.parallel not found, won't use it. See https://nvidia.github.io/apex/parallel.html")

AMP_AVAILABLE = True

except ImportError:
AMP_AVAILABLE = False
APEX_PARALLEL_AVAILABLE = False
logger.info("apex not found, won't use it. See https://nvidia.github.io/apex/")
logger.debug("apex not found, won't use it. See https://nvidia.github.io/apex/")


class WrappedDataParallel(DataParallel):
Expand Down
2 changes: 1 addition & 1 deletion haystack/modeling/model/prediction_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def logits_to_preds(

# The returned indices are then converted back to the original dimensionality of the matrix.
# sorted_candidates.shape : (batch_size, max_seq_len^2, 2)
start_indices = flat_sorted_indices // max_seq_len
start_indices = torch.div(flat_sorted_indices, max_seq_len, rounding_mode="trunc")
end_indices = flat_sorted_indices % max_seq_len
sorted_candidates = torch.cat((start_indices, end_indices), dim=2)

Expand Down
3 changes: 2 additions & 1 deletion haystack/nodes/file_classifier/file_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
try:
import magic
except ImportError as ie:
logging.error(
logging.debug(
"Failed to import 'magic' (from 'python-magic' and 'python-magic-bin' on Windows). "
"FileTypeClassifier will not perform mimetype detection on extensionless files. "
"Please make sure the necessary OS libraries are installed if you need this functionality."
Expand Down Expand Up @@ -64,6 +64,7 @@ def _estimate_extension(self, file_path: Path) -> str:
except NameError as ne:
logger.error(
f"The type of '{file_path}' could not be guessed, probably because 'python-magic' is not installed. Ignoring this error."
"Please make sure the necessary OS libraries are installed if you need this functionality ('python-magic' or 'python-magic-bin' on Windows)."
)
return ""

Expand Down

0 comments on commit f7d0047

Please sign in to comment.