File tree 1 file changed +18
-15
lines changed
1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change 1
- (ns scicloj.ml.simpletransformers )
1
+ (ns scicloj.ml.simpletransformers
2
+ (:require [libpython-clj2.python :refer [py.- py.] :as py]))
3
+
2
4
3
- (require '[libpython-clj2.require :as py-req]
4
- '[libpython-clj2.python.io-redirect]
5
- '[libpython-clj2.python :refer [py.- py.] :as py])
6
5
7
6
8
7
9
- (py/from-import simpletransformers.classification ClassificationModel)
10
- (py-req/require-python '[pandas :as pd])
11
8
12
9
(def train-data [
13
10
[" Example sentence belonging to class 1" 1 ]
21
18
22
19
23
20
(println " train..." )
21
+ (py/with-gil-stack-rc-context
22
+
23
+ (py/from-import simpletransformers.classification ClassificationModel)
24
+
25
+
24
26
25
- (let [
26
- train-df (pd/DataFrame train-data)
27
- eval-df (pd/DataFrame eval-data)
27
+ (let [
28
+ pd (py/import-module " pandas" )
29
+ train-df (py. pd DataFrame train-data)
30
+ eval-df (py. pd DataFrame eval-data)
28
31
29
- model (ClassificationModel " bert" " prajjwal1/bert-tiny" :use_cuda false :args
30
- {:num_train_epochs 1
31
- :use_multiprocessing false
32
- :overwrite_output_dir true })
32
+ model (ClassificationModel " bert" " prajjwal1/bert-tiny" :use_cuda false :args
33
+ {:num_train_epochs 1
34
+ :use_multiprocessing false
35
+ :overwrite_output_dir true })
33
36
34
37
35
- x (py. model train_model train-df)]
36
- (println x))
38
+ x (py. model train_model train-df)]
39
+ (println x) ))
37
40
38
41
(println " finished train" )
You can’t perform that action at this time.
0 commit comments