jomarie04 commited on
Commit
b6fc63b
·
verified ·
1 Parent(s): fa385b9

Create files.py

Browse files
Files changed (1) hide show
  1. files.py +28 -0
files.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
+
3
+ model_name = "distilbert-base-uncased"
4
+
5
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
6
+ model = AutoModelForSequenceClassification.from_pretrained(
7
+ model_name,
8
+ num_labels=6,
9
+ id2label={
10
+ 0: "Australopithecus",
11
+ 1: "Homo habilis",
12
+ 2: "Homo erectus",
13
+ 3: "Homo heidelbergensis",
14
+ 4: "Homo neanderthalensis",
15
+ 5: "Homo sapiens"
16
+ },
17
+ label2id={
18
+ "Australopithecus": 0,
19
+ "Homo habilis": 1,
20
+ "Homo erectus": 2,
21
+ "Homo heidelbergensis": 3,
22
+ "Homo neanderthalensis": 4,
23
+ "Homo sapiens": 5
24
+ }
25
+ )
26
+
27
+ model.save_pretrained("human-evolution-classifier")
28
+ tokenizer.save_pretrained("human-evolution-classifier")