Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 7, 2024
1 parent 0bc8c78 commit 4300489
Show file tree
Hide file tree
Showing 25 changed files with 11 additions and 21 deletions.
1 change: 1 addition & 0 deletions notebooks/demo2/cascade_mask_rcnn_hrnetv2p_w32_20e_v2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model settings."""

model = dict(
type="CascadeRCNN",
# num_stages=3,
Expand Down
1 change: 1 addition & 0 deletions notebooks/demo2/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Default runtime config."""

import pathlib
import os
import yaml
Expand Down
1 change: 0 additions & 1 deletion notebooks/demo2/config_farm_train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Config FARM Training."""


import pathlib
import os
from farm.modeling.prediction_head import TextClassificationHead
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/base_component.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""BaseComponent."""


from abc import ABC, abstractmethod


Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/base_curator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""BaseCurator."""


import re
from abc import abstractmethod

Expand Down
2 changes: 1 addition & 1 deletion src/components/preprocessing/base_kpi_inference_curator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def return_sliced_squad(self, squad_json, indices):
return {}

pdf2pars = defaultdict(list)
for (i1, i2) in indices:
for i1, i2 in indices:
pdf2pars[i1].append(i2)

data = []
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/curator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Curator."""


import glob
import logging

Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/extractor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Extractor class."""


from .pdf_table_extractor import PDFTableExtractor
from .pdf_text_extractor import PDFTextExtractor
import logging
Expand Down
1 change: 1 addition & 0 deletions src/components/preprocessing/kpi_inference_curator.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def clean(self, df):
Args:
df (A pandas dataframe)
"""

# map kpi to question
def map_kpi(r):
try:
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/nq_curator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Processing nq curator."""


import logging
import os
from ast import literal_eval
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/nq_extractor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""NQExtractor."""


import json
import logging
import os
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/pdf_table_extractor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""PDFTableExtractor."""


from .base_component import BaseComponent
import os
from pdf2image import convert_from_path, pdfinfo_from_path
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/pdf_text_extractor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""PDFTextExtractor."""


import glob
import io
import json
Expand Down
1 change: 0 additions & 1 deletion src/components/preprocessing/text_curator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""TextCurator."""


import ast
import json
import logging
Expand Down
1 change: 0 additions & 1 deletion src/components/utils/cscdtabnet_checkpoint_url.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Cscdtabnet checkpoint URLs."""


checkpoint_url = {
"general_model.pth": "https://drive.google.com/uc?id=1-xfq5hDmFdKgbY9FSFTmhSlcb2p13RPn",
"icdar_13.pth": "https://drive.google.com/uc?id=1-mVr4UBicFk3mjUz5tsVPjQ4jzRtiT7V",
Expand Down
1 change: 0 additions & 1 deletion src/components/utils/nq_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""NQ utils."""


import re


Expand Down
1 change: 0 additions & 1 deletion src/components/utils/qa_metrics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""QA metrics."""


import numpy as np
from farm.evaluation.metrics import squad_EM, squad_f1
from sklearn.metrics import confusion_matrix
Expand Down
1 change: 1 addition & 0 deletions src/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Data collection module."""

from .s3_communication import S3FileType, S3Communication # noqa F401
1 change: 1 addition & 0 deletions src/data/make_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data collection code."""

import click
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/data/s3_communication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""S3 communication tools."""

import os
import pathlib
import os.path as osp
Expand Down
1 change: 1 addition & 0 deletions src/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for models."""

from .farm_trainer import FARMTrainer
from .qa_farm_trainer import QAFARMTrainer
from .trainer_optuna import TrainerOptuna
Expand Down
1 change: 0 additions & 1 deletion src/models/farm_trainer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""FARM Trainer."""


import logging
import os

Expand Down
1 change: 0 additions & 1 deletion src/models/qa_farm_trainer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""QA Farm trainer."""


import logging
import json
import os
Expand Down
1 change: 0 additions & 1 deletion src/models/relevance_infer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""RelevanceInfer."""


import json
import logging
import os
Expand Down
7 changes: 3 additions & 4 deletions src/models/text_kpi_infer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Text KPI Inference."""


import glob
import logging
import os
Expand Down Expand Up @@ -61,9 +60,9 @@ def __init__(self, infer_config, n_best_per_sample=1):
self.model.model.prediction_heads[0].n_best_per_sample = n_best_per_sample
# If positive, this will boost "No Answer" as prediction.
# If negative, this will decrease the model from giving "No Answer" as prediction.
self.model.model.prediction_heads[
0
].no_ans_boost = self.infer_config.no_ans_boost
self.model.model.prediction_heads[0].no_ans_boost = (
self.infer_config.no_ans_boost
)
self.result_dir = self.infer_config.result_dir["Text"]
if not os.path.exists(self.result_dir):
os.makedirs(self.result_dir)
Expand Down

0 comments on commit 4300489

Please sign in to comment.