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

Updated logging error #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 5 additions & 8 deletions summarizer/bert_parent.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import logging
from typing import List

import numpy as np
import torch
from numpy import ndarray
from transformers import *

logging.basicConfig(level=logging.WARNING)


class BertParent(object):

Expand All @@ -28,8 +25,8 @@ class BertParent(object):
def __init__(
self,
model: str,
custom_model: PreTrainedModel=None,
custom_tokenizer: PreTrainedTokenizer=None
custom_model: PreTrainedModel = None,
custom_tokenizer: PreTrainedTokenizer = None
):
"""
:param model: Model is the string path for the bert weights. If given a keyword, the s3 path will be used
Expand Down Expand Up @@ -67,7 +64,7 @@ def tokenize_input(self, text: str) -> torch.tensor:
def extract_embeddings(
self,
text: str,
hidden: int=-2,
hidden: int = -2,
reduce_option: str ='mean'
) -> torch.Tensor:

Expand Down Expand Up @@ -100,7 +97,7 @@ def extract_embeddings(
def create_matrix(
self,
content: List[str],
hidden: int=-2,
hidden: int = -2,
reduce_option: str = 'mean'
) -> ndarray:
"""
Expand All @@ -120,7 +117,7 @@ def create_matrix(
def __call__(
self,
content: List[str],
hidden: int= -2,
hidden: int = -2,
reduce_option: str = 'mean'
) -> ndarray:
return self.create_matrix(content, hidden, reduce_option)
2 changes: 1 addition & 1 deletion summarizer/model_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class TransformerSummarizer(ModelProcessor):
'TransfoXL': (TransfoXLModel, TransfoXLTokenizer),
'XLNet': (XLNetModel, XLNetTokenizer),
'XLM': (XLMModel, XLMTokenizer),
'DistilBert': (DistilBertModel, DistilBertTokenizer),
'DistilBert': (DistilBertModel, DistilBertTokenizer)
}

def __init__(
Expand Down