This model is a fine-tuned version of
OuteAI/Lite-Oute-1-300M-Instruct on the
cardiffnlp/tweet_eval dataset to determine tweets tonality in one of the three classes: positive, neutral or negative.
It was finetuned with LoRA to make training more memory and time efficient. Low-rank finetuning was applied only to V and K matrices of attention layers.
This model was trained with batch_size=32, rank = 8, alpha = 16, learning_rate = 1e-5 on cardiffnlp/tweet_eval for one epoch.
The model achieved 0.51 f1-score on the test dataset.
Chase Headley's RBI double in the 8th inning off David Price snapped a Yankees streak of 33 consecutive scoreless innings against Blue Jays -> "The text is positive. \n The text is neutral."
Chase Headley's RBI double in the 8th inning off David Price snapped a Yankees streak of 33 consecutive scoreless innings against Blue Jays -> "neutral"
1from safetensors.torch import load_file
2from huggingface_hub import hf_hub_download
3
4REPO_NAME = "bikmish/llm-course-hw3-lora"
5
6model = AutoModelForCausalLM.from_pretrained(REPO_NAME, device_map="auto")
7tokenizer = AutoTokenizer.from_pretrained(REPO_NAME)
8tokenizer.pad_token = tokenizer.eos_token
9tokenizer.padding_side = "left"
10
11apply_peft_to_module(model, LinearWithLoRA, r=8, alpha=16, target_submodules=["v_proj", "k_proj"])
12model.to(DEVICE)
13
14path = hf_hub_download(REPO_NAME, "model.safetensors")
15state_dict = load_file(path)
16
17model.load_state_dict(state_dict, strict=False)
18
19LoRA_saved_model_accuracy = eval(model, dataset["test"], tokenizer)
20print(f"Accuracy after LoRA training: {LoRA_saved_model_accuracy:.2f}")