--- language: - pt license: mit library_name: transformers metrics: - accuracy - f1 pipeline_tag: text-classification --- I trained this model just to learn, using a dataset of product reviews ## HYPERPAREMETERS lr = 1e-3 batch_size = 4 num_epochs = 5 weight_decay = 0.01 LoraConfig: r=4 lora_alpha=32 lora_dropout=0.01 target_modules = ['q_lin'] ## F1_SCORE = 0.914643 ## HOW TO USE ```python from transformers import ( AutoTokenizer, AutoConfig, AutoModelForSequenceClassification, ) from peft import PeftModel, PeftConfig, get_peft_model model_repo = "igoramf/lora-pt-sentiment-analysis" config = PeftConfig.from_pretrained(model_repo) model = AutoModelForSequenceClassification.from_pretrained( config.base_model_name_or_path, num_labels=3 ) tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path) tokenizer.pad_token = tokenizer.eos_token model = PeftModel.from_pretrained(model, model_repo) ``` ## RESULTS ```python id2c = {0: 'neg', 1:'neutral', 2: 'pos'} text_list = ["Não gostei da programação da TV hoje, o programa BBB foi muito ruim!!", "Gostei muito do jogo do corinthians hoje", "Que prova dificil", "Baptista é um professor muito legal"] for text in text_list: inputs = tokenizer.encode(text, return_tensors="pt") logits = model(inputs).logits predictions = torch.argmax(logits) print(text + " - " + id2c[predictions.tolist()]) ## RESULTS: Não gostei da programação da TV hoje, o programa BBB foi muito ruim!! - neg Gostei muito do jogo do corinthians hoje - pos Que prova dificil - neg Baptista é um professor muito legal - pos ```