Skip to content

Commit 2308c84

Browse files
committed
added comments
1 parent 88b9b2b commit 2308c84

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

simpletransformers.clj

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns scicloj.ml.simpletransformers
22
(:require [libpython-clj2.python :refer [py.- py.] :as py]))
33

4+
;; Using the "(require ..)" macro makes it crash
45

56

67

@@ -18,24 +19,24 @@
1819

1920

2021
(println "train...")
21-
(py/with-gil-stack-rc-context
22+
(py/with-gil-stack-rc-context ;; without this it crashes
2223

23-
(py/from-import simpletransformers.classification ClassificationModel)
24+
;; having this outside of 'with-gil-stack-rc-context' makes it crash
25+
(py/from-import simpletransformers.classification ClassificationModel)
2426

2527

26-
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+
(let [
29+
pd (py/import-module "pandas")
30+
train-df (py. pd DataFrame train-data)
31+
eval-df (py. pd DataFrame eval-data)
3132

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+
model (ClassificationModel "bert" "prajjwal1/bert-tiny" :use_cuda false :args
34+
{:num_train_epochs 1
35+
:use_multiprocessing false
36+
:overwrite_output_dir true})
3637

3738

38-
x (py. model train_model train-df)]
39-
(println x)))
39+
x (py. model train_model train-df)]
40+
(println x)))
4041

4142
(println "finished train")

0 commit comments

Comments
 (0)