Views
No views yet

1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "thethinkmachine/Maxwell-Task-Complexity-Scorer-v0.2"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8# 1. Get normalized complexity (0–1)
9def get_normalized_score(text: str) -> float:
10 inputs = tokenizer(text, return_tensors="pt")
11 with torch.no_grad():
12 logits = model(**inputs).logits.squeeze()
13 return float(logits)
14
15# 2. Denormalize to [min_score, max_score]
16def get_denormalized_score(text: str, min_score: float = 1, max_score: float = 6) -> float:
17 norm = get_normalized_score(text)
18 raw = norm * (max_score - min_score) + min_score
19 return float(round(raw, 2))
20
21# Example
22query = "Is learning equivalent to decreasing local entropy?"
23print("Normalized:", get_normalized_score(query))
24print("Evol-Complexity [1–6]:", get_denormalized_score(query))score * (max - min) + min.| Original Score | Count | % |
|---|---|---|
| 1 | 8,729 | 13.3% |
| 2 | 5,399 | 8.2% |
| 3 | 10,937 | 16.7% |
| 4 | 9,801 | 15.0% |
| 5 | 24,485 | 37.4% |
| 6 | 6,123 | 9.3% |
Chaubey, S. (2024). Maxwell Instruction Complexity Estimator (MICE). https://huggingface.co/thethinkmachine/MICE