Views
No views yet
transformers library for sequence classification/regression:1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4# Load model and tokenizer
5model_name = "agentlans/bge-small-en-text-quality"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Sample texts
10texts = [
11 "Original publication and designation: Decaisne, J. (1842). Essais sur une classification des algues...",
12 "Modern Action Figure Toys & Collectibles!! You've been outbid to E****y! to YOU!"
13]
14
15# Tokenize and predict
16inputs = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")
17with torch.no_grad():
18 outputs = model(**inputs)
19 # The model outputs a single continuous value per text
20 scores = outputs.logits.squeeze(-1).tolist()
21
22for text, score in zip(texts, scores):
23 print(f"Score: {score:.4f} | Text: {text[:80]}...")
24agentlans/text-quality-v3 dataset. Below is a sample of text inputs alongside their predicted scores versus their true dataset targets.| Input | Predicted Value | Actual |
|---|---|---|
| Modern Action Figure Toys & Collectibles - Vintage, Rare and Hard to Find Toys including Convention ... | -1.6846 | -1.8808 |
| Find 2 listings related to afterglow hair salon in Defuniak Springs on YP.com. See reviews, photos, ... | -1.6602 | -1.7688 |
| We had a little bit of down time yesterday due to some technical difficulties. In other words Martin... | -1.373 | -1.403 |
| Remember Ellen Feiss? From Apple’s ‘Switch’ campaign? THAT is awesome! Thank you so much for sharing... | -1.25 | -1.0043 |
| Should we talk with U.S. Congressmen who we know support campaign finance reform? Our Theory of Chan... | -0.2137 | -0.6712 |
| If you are looking for one of the best high end luxury apartment rentals in all of London I highly r... | -0.5405 | -0.6453 |
| To be fair, Lebron is trying to get his teammates involved. He kinda has to play her ball here, even... | -0.0917 | -0.3884 |
| Sarah Hofstetter is the global CEO at 360i, the hotshot agency that’s behind some of the most buzzed... | -0.3315 | -0.3483 |
| Our Lynchburg office recently completed a retrofit roof at Carter Machinery. They installed 1 ½” ISO... | -0.4929 | -0.2979 |
| A statement suspension light, the Innermost Beads Octo Pendant string together multiple spheres of g... | 0.1059 | -0.1651 |
| Today I wanted to share a clip art set that isn't new but I thought you all might be working on some... | -0.292 | -0.1011 |
| Chinnamasta shows us the simple, playful, and fierce truth that much of what we need is already righ... | -0.2188 | -0.0925 |
| Ministers order BDS activist Lydia de Leeuw to be denied entry into Israel. Public Security Minister... | -0.1429 | 0.0449 |
| LJW lawyers have extensive experience litigating commercial disputes on a broad range of issues and ... | 0.3911 | 0.3204 |
| Dews is a professional waterman and has made a name for himself in stand up paddle boarding, surfing... | 0.2075 | 0.3725 |
| The festival of Lohri is Punjabis’ cultural celebration which marks the culmination of winter by lig... | 0.6953 | 0.5373 |
| At PEC we understand government process for Afghanistan Embassy MBBS Certificate Attestation which c... | 0.6616 | 0.6668 |
| If you own a beautiful hand-knotted Oriental rug, you want to keep it looking beautiful forever. The... | 0.9932 | 1.0737 |
| Original publication and holotype designation: Decaisne, J. (1842). Essais sur une classification de... | 1.6182 | 1.6823 |
| Chemical additives are used in foodstuffs and sometimes it results into adulteration due to processi... | 2.418 | 2.4192 |
adamw_torch_fused) with $\beta_1 = 0.9$, $\beta_2 = 0.999$, and $\epsilon = 10^{-8}$| Training Loss | Epoch | Step | Validation Loss | Mse |
|---|---|---|---|---|
| 0.1426 | 1.0 | 10000 | 0.1778 | 0.1778 |
| 0.0895 | 2.0 | 20000 | 0.1176 | 0.1176 |
| 0.0521 | 3.0 | 30000 | 0.1261 | 0.1261 |
Note: The model begins over-fitting slightly by Epoch 3; the checkpoint at Epoch 2 provides the lowest Validation Loss / MSE.