Run this model with HF Jobs

Run AnirbanSaha/gemma2-2b-tlink on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/AnirbanSaha/gemma2-2b-tlink. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/AnirbanSaha/gemma2-2b-tlink on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/AnirbanSaha/gemma2-2b-tlink. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/AnirbanSaha/gemma2-2b-tlink. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Gemma-2-2B Temporal Link Classification

Full fine-tuned version of google/gemma-2-2b-it on the fahmidiqbal/tlink-classification dataset for temporal relation classification.

Task

Given an already-formatted task prompt containing two marked spans (such as <e1>, <e2>, <t1>, or <t2>), the model generates one temporal-relation label:

  • BEFORE โ€” first span occurs earlier than the second
  • AFTER โ€” first span occurs later than the second
  • OTHER โ€” overlap or another non-ordering relation
  • NONE โ€” no clear temporal relation

Training Details

Parameter Value
Base model google/gemma-2-2b-it
Fine-tuning Full (all parameters)
Epochs 3
Batch size 8
Learning rate 2e-5
Weight decay 0.01
Max length 2048
Precision bfloat16
Prompt format Gemma chat template
Dataset fahmidiqbal/tlink-classification

Results

Test metrics have not been added yet. Run the evaluation script first to generate test_metrics.json, then run this upload script again.

Usage

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

MODEL_ID = "AnirbanSaha/gemma2-2b-tlink"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    dtype=torch.bfloat16,
    device_map="auto",
)
model.eval()

prompt = "Your already-formatted temporal relation prompt here..."

messages = [
    {"role": "user", "content": prompt}
]

formatted_prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

enc = tokenizer(
    formatted_prompt,
    add_special_tokens=False,
    return_tensors="pt",
).to(model.device)

with torch.inference_mode():
    out = model.generate(
        **enc,
        max_new_tokens=8,
        do_sample=False,
        pad_token_id=tokenizer.pad_token_id,
        eos_token_id=tokenizer.eos_token_id,
    )

new_tokens = out[0][enc["input_ids"].shape[1]:]
prediction = tokenizer.decode(
    new_tokens,
    skip_special_tokens=True,
).strip()

print(prediction)

Base Model License

The base checkpoint uses the Gemma license. Users of this fine-tuned model should review and comply with the applicable Gemma terms.

Downloads last month
10
Safetensors
Model size
3B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for AnirbanSaha/gemma2-2b-tlink

Finetuned
(1,147)
this model

Dataset used to train AnirbanSaha/gemma2-2b-tlink