Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ppg-moderation-classifier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oschmanf
ppg-moderation-classifier
Commits
d0ce44af
Commit
d0ce44af
authored
1 year ago
by
oschmanf
Browse files
Options
Downloads
Patches
Plain Diff
Evaluate trained BERT
parent
35189e2e
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Dev train models
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
moderation_classifier/eval_BERT.py
+19
-0
19 additions, 0 deletions
moderation_classifier/eval_BERT.py
moderation_classifier/predict_BERT.py
+16
-3
16 additions, 3 deletions
moderation_classifier/predict_BERT.py
with
35 additions
and
3 deletions
moderation_classifier/eval_BERT.py
0 → 100644
+
19
−
0
View file @
d0ce44af
from
datasets
import
load_dataset
from
evaluate
import
evaluator
from
transformers
import
pipeline
data
=
load_dataset
(
"
imdb
"
,
split
=
"
test
"
).
shuffle
(
seed
=
42
).
select
(
range
(
10
))
task_evaluator
=
evaluator
(
"
text-classification
"
)
pipe
=
pipeline
(
"
text-classification
"
,
model
=
"
../saved_models/20230630-103946/
"
)
eval_results
=
task_evaluator
.
compute
(
model_or_pipeline
=
pipe
,
data
=
data
,
label_mapping
=
{
"
NEGATIVE
"
:
0
,
"
POSITIVE
"
:
1
}
)
import
pdb
;
pdb
.
set_trace
()
print
(
eval_results
)
This diff is collapsed.
Click to expand it.
moderation_classifier/predict_BERT.py
+
16
−
3
View file @
d0ce44af
from
datasets
import
load_dataset
from
evaluate
import
evaluator
from
transformers
import
pipeline
text
=
"
This was a masterpiece. Not completely faithful to the books, but enthralling from beginning to end. Might be my favorite of the three.
"
data
=
load_dataset
(
"
imdb
"
,
split
=
"
test
"
).
shuffle
(
seed
=
42
).
select
(
range
(
10
))
task_evaluator
=
evaluator
(
"
text-classification
"
)
pipe
=
pipeline
(
"
text-classification
"
,
model
=
"
../saved_models/20230630-103946/
"
)
eval_results
=
task_evaluator
.
compute
(
model_or_pipeline
=
pipe
,
data
=
data
,
label_mapping
=
{
"
NEGATIVE
"
:
0
,
"
POSITIVE
"
:
1
}
)
import
pdb
;
pdb
.
set_trace
()
print
(
eval_results
)
classifier
=
pipeline
(
"
sentiment-analysis
"
,
model
=
"
../saved_models/
"
)
classifier
(
text
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment