{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "LlamaForSequenceClassification(\n", " (model): LlamaModel(\n", " (embed_tokens): Embedding(49153, 576, padding_idx=49152)\n", " (layers): ModuleList(\n", " (0-29): 30 x LlamaDecoderLayer(\n", " (self_attn): LlamaSdpaAttention(\n", " (q_proj): Linear(in_features=576, out_features=576, bias=False)\n", " (k_proj): Linear(in_features=576, out_features=192, bias=False)\n", " (v_proj): Linear(in_features=576, out_features=192, bias=False)\n", " (o_proj): Linear(in_features=576, out_features=576, bias=False)\n", " (rotary_emb): LlamaRotaryEmbedding()\n", " )\n", " (mlp): LlamaMLP(\n", " (gate_proj): Linear(in_features=576, out_features=1536, bias=False)\n", " (up_proj): Linear(in_features=576, out_features=1536, bias=False)\n", " (down_proj): Linear(in_features=1536, out_features=576, bias=False)\n", " (act_fn): SiLU()\n", " )\n", " (input_layernorm): LlamaRMSNorm((576,), eps=1e-05)\n", " (post_attention_layernorm): LlamaRMSNorm((576,), eps=1e-05)\n", " )\n", " )\n", " (norm): LlamaRMSNorm((576,), eps=1e-05)\n", " (rotary_emb): LlamaRotaryEmbedding()\n", " )\n", " (score): Linear(in_features=576, out_features=2, bias=False)\n", ")" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from transformers import GPT2Tokenizer, LlamaForSequenceClassification\n", "\n", "# Load the GPT2 tokenizer and Llama model for sequence classification\n", "model_path = r\"C:\\Users\\jatin\\OneDrive\\Desktop\\plagiarism-detection\\smolLM-fined-tuned-for-PLAGAIRISM-Detection\\model\"\n", "tokenizer = GPT2Tokenizer.from_pretrained(model_path, local_files_only=True)\n", "model = LlamaForSequenceClassification.from_pretrained(model_path, local_files_only=True)\n", "\n", "# Set model to evaluation mode\n", "model.eval()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | sentence1 | \n", "sentence2 | \n", "label | \n", "
---|---|---|---|
0 | \n", "A person on a horse jumps over a broken down a... | \n", "A person is at a diner, ordering an omelette. | \n", "0 | \n", "
1 | \n", "A person on a horse jumps over a broken down a... | \n", "A person is outdoors, on a horse. | \n", "1 | \n", "
2 | \n", "Children smiling and waving at camera | \n", "There are children present | \n", "1 | \n", "
3 | \n", "Children smiling and waving at camera | \n", "The kids are frowning | \n", "0 | \n", "
4 | \n", "A boy is jumping on skateboard in the middle o... | \n", "The boy skates down the sidewalk. | \n", "0 | \n", "