tahamajs / bert-base-swag-lora

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: 7月 08 2025
text-classification

Introduction of bert-base-swag-lora

Model Details of bert-base-swag-lora

Model Card for bert-base-swag-lora

Model Details
Model Description

This model is a bert-base-uncased model that has been fine-tuned for the multiple-choice question-answering task using the SWAG (Situations with Adversarial Generations) dataset. The fine-tuning was performed using a parameter-efficient technique called LoRA (Low-Rank Adaptation) , which significantly reduces the number of trainable parameters while achieving strong performance.

The model is trained to predict the most plausible continuation of a sentence from four possible choices, testing its commonsense and contextual reasoning abilities.

  • Developed by: Taha Majlesi
  • Model type: BERT (Bidirectional Encoder Representations from Transformers)
  • Language(s) (NLP): English
  • License: Apache-2.0
  • Finetuned from model: google-bert/bert-base-uncased
Model Sources [optional]
Uses
Direct Use

This model is intended to be used for multiple-choice question answering, specifically on tasks that require commonsense inference similar to the SWAG dataset. It takes a context and four possible endings as input and outputs the index of the most likely correct ending.

from transformers import AutoModelForMultipleChoice, AutoTokenizer
from peft import PeftModel
import torch

# Define your repository name
repo_name = "[Your Hugging Face Username]/bert-base-swag-lora"
base_model_name = "google-bert/bert-base-uncased"

# Load the fine-tuned model from the Hub
tokenizer = AutoTokenizer.from_pretrained(repo_name)
base_model = AutoModelForMultipleChoice.from_pretrained(base_model_name)
model = PeftModel.from_pretrained(base_model, repo_name)
model.eval()

# Example from SWAG
context = "A man is skiing down a mountain."
choices = [
    "he falls down and gets back up.",
    "he makes a snowball and throws it.",
    "he takes a picture of the scenery.",
    "he stops to drink some water."
]

# Prepare the input
prompt = [context] * 4
next_sentences = [f"{choices[i]}" for i in range(4)]
inputs = tokenizer(prompt, next_sentences, return_tensors="pt", padding=True)

# Reshape for the model
inputs = {k: v.unsqueeze(0) for k, v in inputs.items()}

# Get prediction
with torch.no_grad():
    outputs = model(**inputs)
    predicted_index = torch.argmax(outputs.logits).item()

print(f"The most likely ending is: '{choices[predicted_index]}'")
# Expected output: 'he falls down and gets back up.'

Runs of tahamajs bert-base-swag-lora on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About bert-base-swag-lora huggingface.co Model

bert-base-swag-lora huggingface.co

bert-base-swag-lora huggingface.co is an AI model on huggingface.co that provides bert-base-swag-lora's model effect (), which can be used instantly with this tahamajs bert-base-swag-lora model. huggingface.co supports a free trial of the bert-base-swag-lora model, and also provides paid use of the bert-base-swag-lora. Support call bert-base-swag-lora model through api, including Node.js, Python, http.

bert-base-swag-lora huggingface.co Url

https://huggingface.co/tahamajs/bert-base-swag-lora

tahamajs bert-base-swag-lora online free

bert-base-swag-lora huggingface.co is an online trial and call api platform, which integrates bert-base-swag-lora's modeling effects, including api services, and provides a free online trial of bert-base-swag-lora, you can try bert-base-swag-lora online for free by clicking the link below.

tahamajs bert-base-swag-lora online free url in huggingface.co:

https://huggingface.co/tahamajs/bert-base-swag-lora

bert-base-swag-lora install

bert-base-swag-lora is an open source model from GitHub that offers a free installation service, and any user can find bert-base-swag-lora on GitHub to install. At the same time, huggingface.co provides the effect of bert-base-swag-lora install, users can directly use bert-base-swag-lora installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

bert-base-swag-lora install url in huggingface.co:

https://huggingface.co/tahamajs/bert-base-swag-lora

Url of bert-base-swag-lora

bert-base-swag-lora huggingface.co Url

Provider of bert-base-swag-lora huggingface.co

tahamajs
ORGANIZATIONS

Other API from tahamajs

huggingface.co

Total runs: 4
Run Growth: 0
Growth Rate: 0.00%
Updated:8月 08 2025
huggingface.co

Total runs: 4
Run Growth: 0
Growth Rate: 0.00%
Updated:2月 09 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:9月 18 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:8月 26 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:8月 26 2025