Views
No views yet
microsoft/codebert-basegood vs bad)[prob_good, prob_bad] — softmax scores| Class | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| good | 0.96 | 0.91 | 0.93 | 150 |
| bad | 0.99 | 1.00 | 0.99 | 1500 |
| Accuracy | 0.99 | 1650 |
test_binary_predict.py:1import sys
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3import torch
4from pathlib import Path
5
6path = Path(sys.argv[1])
7text = path.read_text(encoding="utf-8")
8
9tokenizer = AutoTokenizer.from_pretrained("LeeSek/binary-dockerfile-model")
10model = AutoModelForSequenceClassification.from_pretrained("LeeSek/binary-dockerfile-model")
11model.eval()
12
13inputs = tokenizer(text, return_tensors="pt", padding="max_length", truncation=True, max_length=512)
14
15with torch.no_grad():
16 logits = model(**inputs).logits
17 probs = torch.nn.functional.softmax(logits, dim=1).squeeze()
18
19label = "GOOD" if torch.argmax(probs).item() == 0 else "BAD"
20print(f"Prediction: {label} — Probabilities: good={probs[0]:.3f}, bad={probs[1]:.3f}")1FROM node:18
2WORKDIR /app
3COPY . .
4RUN npm install
5CMD ["node", "index.js"]1FROM ubuntu:latest
2RUN apt-get install python3
3ADD . /app
4WORKDIR /app
5RUN pip install flask
6CMD python3 app.pypython test_binary_predict.py DockerfilePrediction: GOOD — Probabilities: good=0.998, bad=0.002scripts/ folder.💬 Note: Scripts are written with Polish comments and variable names for clarity during local development. Logic is fully portable.