CoolFace
Datasetpublic

hanaandargie/granite-1b-base-blindspots

Blind Spots of ibm-granite/granite-4.0-h-1b-base Model tested Model: https://huggingface.co/ibm-granite/granite-4.0-h-1b-base This dataset contains inputs where the model produced incorrect outputs, along with the expected output and the model's output. How the model was loaded (Colab / Transformers) !pip -q install -U transformers accelerate datasets huggingface_hub import torch from transformers import AutoTokenizer, AutoModelForCausalLM… See the full description on the dataset page: https://huggingface.co/datasets/hanaandargie/granite-1b-base-blindspots.

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
0likes2downloads
Dataset Card

Blind Spots of ibm-granite/granite-4.0-h-1b-base

Model tested

  • —Model: https://huggingface.co/ibm-granite/granite-4.0-h-1b-base

This dataset contains inputs where the model produced incorrect outputs, along with the expected output and the model's output.

How the model was loaded (Colab / Transformers)

python
!pip -q install -U transformers accelerate datasets huggingface_hub

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "ibm-granite/granite-4.0-h-1b-base"

tokenizer = AutoTokenizer.from_pretrained(model_id)
if tokenizer.pad_token is None:
    tokenizer.pad_token = tokenizer.eos_token

def pick_dtype():
    if not torch.cuda.is_available():
        return torch.float32
    major, minor = torch.cuda.get_device_capability()
    return torch.bfloat16 if major >= 8 else torch.float16

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
    torch_dtype=pick_dtype(),
)
model.eval()

def generate_completion(prompt: str, max_new_tokens: int = 64) -> str:
    inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
    with torch.no_grad():
        out = model.generate(
            **inputs,
            max_new_tokens=max_new_tokens,
            do_sample=False,
            pad_token_id=tokenizer.pad_token_id,
            eos_token_id=tokenizer.eos_token_id,
        )
    gen_ids = out[0, inputs["input_ids"].shape[-1]:]
    return tokenizer.decode(gen_ids, skip_special_tokens=True).strip()