зеркало из https://github.com/mozilla/bugbug.git
Drop the classifier for the component models
This commit is contained in:
Родитель
e154e7a5b1
Коммит
1f5beba559
|
@ -11,22 +11,12 @@ from bugbug import bugzilla, db
|
|||
from bugbug.models import get_model_class
|
||||
from bugbug.utils import download_model
|
||||
|
||||
MODELS_WITH_TYPE = ("component",)
|
||||
|
||||
basicConfig(level=INFO)
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
||||
def classify_bugs(model_name: str, classifier: str, bug_id: int) -> None:
|
||||
if classifier != "default":
|
||||
assert (
|
||||
model_name in MODELS_WITH_TYPE
|
||||
), f"{classifier} is not a valid classifier type for {model_name}"
|
||||
|
||||
model_file_name = f"{model_name}{classifier}model"
|
||||
model_name = f"{model_name}_{classifier}"
|
||||
else:
|
||||
model_file_name = f"{model_name}model"
|
||||
def classify_bugs(model_name: str, bug_id: int) -> None:
|
||||
model_file_name = f"{model_name}model"
|
||||
|
||||
if not os.path.exists(model_file_name):
|
||||
logger.info("%s does not exist. Downloading the model....", model_file_name)
|
||||
|
@ -79,17 +69,11 @@ def main() -> None:
|
|||
parser = argparse.ArgumentParser(description=description)
|
||||
|
||||
parser.add_argument("model", help="Which model to use for evaluation")
|
||||
parser.add_argument(
|
||||
"--classifier",
|
||||
help="Type of the classifier. Only used for component classification.",
|
||||
choices=["default", "nn"],
|
||||
default="default",
|
||||
)
|
||||
parser.add_argument("--bug-id", help="Classify the given bug id", type=int)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
classify_bugs(args.model, args.classifier, args.bug_id)
|
||||
classify_bugs(args.model, args.bug_id)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -11,8 +11,6 @@ from bugbug import db
|
|||
from bugbug.models import MODELS, get_model_class
|
||||
from bugbug.utils import CustomJsonEncoder, create_tar_zst, zstd_compress
|
||||
|
||||
MODELS_WITH_TYPE = ("component",)
|
||||
|
||||
basicConfig(level=INFO)
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
@ -22,15 +20,7 @@ class Trainer(object):
|
|||
# Download datasets that were built by bugbug_data.
|
||||
os.makedirs("data", exist_ok=True)
|
||||
|
||||
if args.classifier != "default":
|
||||
assert (
|
||||
args.model in MODELS_WITH_TYPE
|
||||
), f"{args.classifier} is not a valid classifier type for {args.model}"
|
||||
|
||||
model_name = f"{args.model}_{args.classifier}"
|
||||
else:
|
||||
model_name = args.model
|
||||
|
||||
model_name = args.model
|
||||
model_class = get_model_class(model_name)
|
||||
parameter_names = set(inspect.signature(model_class.__init__).parameters)
|
||||
parameters = {
|
||||
|
@ -97,12 +87,6 @@ def parse_args(args):
|
|||
help="Perform lemmatization (using spaCy)",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--classifier",
|
||||
help="Type of the classifier. Only used for component classification.",
|
||||
choices=["default", "nn"],
|
||||
default="default",
|
||||
)
|
||||
|
||||
subparsers = main_parser.add_subparsers(title="model", dest="model", required=True)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче