Views
No views yet
roberta-base. It is designed to predict 5 distinct eye-tracking (ET) features directly from text inputs. This model was trained to serve as the ET generator component required to replicate and extend the GazeReward framework."Through ablation studies we test our framework with different integration methods, LLMs, and ET generator models..." (Lopez-Cardona et al., "SEEING EYE TO AI: HUMAN ALIGNMENT VIA GAZE-BASED RESPONSE REWARDS FOR LARGE LANGUAGE MODELS")
roberta-basemodel.py file..safetensors) and the custom architecture script (model.py). You must use the safetensors library to load the weights. The tokenizer is included in this repository and can be loaded directly from the Hub.1# File: test_inference.py
2# Downloads the custom ET generator model and tokenizer from the Hugging Face Hub, loads them using safetensors, and runs a test inference.
3
4import torch
5from transformers import AutoTokenizer
6from huggingface_hub import hf_hub_download
7from safetensors.torch import load_file
8from model import RobertaRegressionModel
9
10def run_quick_test(repo_id="skboy/et_prediction_2", filename="et_predictor2_seed123.safetensors"):
11 # Downloads weights, initializes the custom model, applies the tokenizer from the same repo, and prints the output tensor.
12 weights_path = hf_hub_download(repo_id=repo_id, filename=filename)
13
14 model = RobertaRegressionModel()
15 state_dict = load_file(weights_path, device="cpu")
16 model.load_state_dict(state_dict)
17 model.eval()
18
19 tokenizer = AutoTokenizer.from_pretrained(repo_id)
20
21 sample_text = "This is a test sentence for eye-tracking feature generation."
22 inputs = tokenizer(sample_text, return_tensors="pt")
23
24 input_ids = inputs["input_ids"]
25 attention_mask = inputs["attention_mask"]
26
27 predict_mask = attention_mask.clone()
28 predict_mask[0, 0] = 0
29 predict_mask[0, -1] = 0
30
31 with torch.no_grad():
32 output = model(input_ids=input_ids, attention_mask=attention_mask, predict_mask=predict_mask)
33
34 print(f"Output shape: {output.shape}")
35 print(f"Output tensor:\n{output}")
36
37if __name__ == "__main__":
38 run_quick_test()