Downloads · 30 days
291
27% of all-time downloads
tinyopsec/granite-4.2-3b-Heretic
granite-4.2-3b-Heretic is a text generation model from tinyopsec. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Granite 4.2 3B Heretic is a representation-edited version of ibm-granite/granite-4.2-3b.
Downloads · 30 days
291
27% of all-time downloads
All-time downloads
1.1K
Public
Parameters
3.7B
14.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors7.3 GB · 60%
From the Hugging Face model README
Granite 4.2 3B Heretic is a representation-edited version of
ibm-granite/granite-4.2-3b.
The model was produced using the Heretic representation-editing workflow. The purpose of this release is research and experimentation with model behavior, refusal behavior, instruction following, and the trade-off between behavioral changes and preservation of the base model's capabilities.
ibm-granite/granite-4.2-3bGraniteForCausalLMtinyopsec/granite-4.2-3b-HereticThe weights may be split into multiple .safetensors shard files. This is
expected and is handled automatically by Transformers through the model index
file.
pip install -U transformers accelerate safetensors torch
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "tinyopsec/granite-4.2-3b-Heretic"
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.float16,
device_map="auto",
trust_remote_code=True,
)
messages = [
{
"role": "user",
"content": "Explain the benefits and limitations of renewable energy.",
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
outputs = model.generate(
inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.9,
repetition_penalty=1.05,
pad_token_id=tokenizer.eos_token_id,
)
new_tokens = outputs[0][inputs.shape[-1]:]
print(
tokenizer.decode(
new_tokens,
skip_special_tokens=True,
)
)
For hardware where float16 is not appropriate, use automatic dtype selection:
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "tinyopsec/granite-4.2-3b-Heretic"
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype="auto",
device_map="auto",
trust_remote_code=True,
)
CPU inference is possible but considerably slower and may require substantial system RAM:
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "tinyopsec/granite-4.2-3b-Heretic"
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype="auto",
device_map="cpu",
trust_remote_code=True,
)
This model is intended for:
This model has not been comprehensively evaluated after editing. In particular, it may differ from the base model in:
The model may produce incorrect, unsafe, biased, or misleading content. Its outputs must be reviewed by a human before being used in applications, published, or relied upon for consequential decisions.
The model should not be used as an autonomous authority, safety filter, medical advisor, legal advisor, financial advisor, or substitute for professional judgment.
When evaluating this model, compare it with the original base model using the same:
Recommended checks include:
A useful baseline is:
BASE_MODEL_ID = "ibm-granite/granite-4.2-3b"
EDITED_MODEL_ID = "tinyopsec/granite-4.2-3b-Heretic"
The edited model was generated from the Granite 4.2 3B base model using a Heretic-style optimization workflow.
For exact reproduction, record and publish:
The final model should be treated as an experimental derivative until those details and a broader evaluation are published.
This repository contains modified weights. It is not the original IBM Granite release.
Please read the original model card before using this model:
The base model's license, attribution requirements, acceptable-use rules, and other conditions remain relevant.
This repository is released under the Apache License 2.0, subject to the license and usage conditions of the base model.
See LICENSE and the original
Granite model card for additional information.