Views
No views yet
cross-encoder/mmarco-mMiniLMv2-L12-H384-v10 — denied1 — allowedgoal — the user's current focus goaltext — the content of the web page, video, or post1Title: <title>
2
3Description: <description>
4
5Tags: <up to 5 tags>
6
7Headings H1: <H1 headings>
8
9Headings H3: <H3 headings>
10
11Paragraphs: <paragraphs>agraphs:1{
2 "goal": "learn chemistry",
3 "text": "Title: 19. Spectroscopy: Probing Molecules with Light\nDescription: MIT 5.61 Physical Chemistry, Fall 2017\nInstructor: Professor Robert Field\nView the complete course: \nYouTube Playlist: \n\nThis lecture discusses time-dependent quantum mechanics.\n\nLicense: Creative Commons BY-NC-SA\nMore information at \nMore courses at\nTags: 5-61-physical-chemistry-fall-2017, dipole approximation, fermi's golden rule, linear response, quantum mechanics",
4 "label": 1
5},
6In this example, the video is matched with the goal, therefore allowed1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4MODEL_NAME = "nsagatov1/youtube-video-relevance-classifier"
5
6tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
7model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME)
8
9goal = "learn chemistry"
10
11text = """
12Title: Atomic spectra | Physics | Khan Academy
13Description: Courses on Khan Academy are always 100% free. Start practicing—and saving your progress—now!
14
15Electrons only exist at specific, discrete energy levels in an atom.
16Tags: online learning, online class, video class, video tutorial, online education
17"""
18
19inputs = tokenizer(
20 goal,
21 text_pair=text,
22 truncation=True,
23 max_length=512,
24 return_tensors="pt"
25)
26
27with torch.no_grad():
28 outputs = model(**inputs)
29
30prediction = torch.argmax(outputs.logits, dim=-1).item()
31
32labels = {
33 0: "denied",
34 1: "allowed"
35}
36
37print(labels[prediction])