INNER CODE UNIT · Python
Analyzer
barissayil/SentimentAnalysis · analyzer.py:13
class Analyzer:
def __init__(self, will_train, args):
# If no model name/path is given, use mine/BERT depending on task.
if args.model_name_or_path is None:
if will_train:
args.model_name_or_path = "bert-base-uncased"
else:
args.model_name_or_path = "barissayil/bert-sentiment-analysis-sst"
# Set up configuration.
self.config = AutoConfig.from_pretrained(args.model_name_or_path)
# Create the model with the given configuration.
if self.config.model_type == "bert":
self.model = BertForSentimentClassification.from_pretrained(
args.model_name_or_path
)