Views
No views yet
facehuggerapoorv/resume-jd-matchpip install transformers torch1from transformers import BertTokenizer, BertForSequenceClassification
2import torch
3
4device = "cuda" if torch.cuda.is_available() else "cpu"
5
6model_name = "AventIQ-AI/bert-talentmatchai"
7model = BertForSequenceClassification.from_pretrained(model_name).to(device)
8tokenizer = BertTokenizer.from_pretrained(model_name)1import torch
2
3# Set device (use GPU if available)
4device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5model.to(device)
6
7# Define label mapping
8label_mapping = {0: "Not a Good Fit", 1: "Potential Fit", 2: "Good Fit"}
9
10# Sample resume text for testing
11test_resume = ["I have worked in different industries and have a lot of experience. I am a hard worker and can learn anything."]
12
13# Tokenize test data
14test_tokens = tokenizer(test_resume, padding="max_length", truncation=True, return_tensors="pt").to(device) # Move input to same device as model
15
16# Make predictions
17with torch.no_grad(): # Disable gradient computation for inference
18 output = model(**test_tokens)
19
20# Get predicted label
21predicted_label = output.logits.argmax(dim=1).item()
22
23# Print result
24print(f"Predicted Category: {predicted_label} ({label_mapping[predicted_label]})")
25
26label_mapping = {0: "No Fit", 1: "Low Fit", 2: "Potential Fit", 3: "Good Fit"}
27print(f"Predicted Category: {label_mapping[predictions]}")
28.
├── model/ # Contains the quantized model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── model.safetensors/ # Quantized Model
├── README.md # Model documentation