INNER CODE UNIT · Python

__init__

barissayil/SentimentAnalysis · analyzer.py:14

    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
            )
        elif self.config.model_type == "albert":

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…