Chouffe commented on a change in pull request #15023: Extend Clojure BERT
example
URL: https://github.com/apache/incubator-mxnet/pull/15023#discussion_r292339549
##########
File path:
contrib/clojure-package/examples/bert/src/bert/bert_sentence_classification.clj
##########
@@ -138,14 +162,16 @@
{:label {label-desc (ndarray/array
labels [train-num]
{:ctx dev})}
:data-batch-size batch-size})
- model (m/module model-sym {:contexts [dev]
- :data-names ["data0" "data1" "data2"]})]
- (m/fit model {:train-data train-data :num-epoch num-epoch
- :fit-params (m/fit-params {:allow-missing true
- :arg-params (m/arg-params
bert-base)
- :aux-params (m/aux-params
bert-base)
- :optimizer (optimizer/adam
{:learning-rate 5e-6 :episilon 1e-9})
- :batch-end-callback
(callback/speedometer batch-size 1)})})))
+ fitted-model (m/fit (m/module model-sym {:contexts [dev]
+ :data-names ["data0" "data1"
"data2"]})
+ {:train-data train-data :num-epoch num-epoch
+ :fit-params (m/fit-params {:allow-missing true
+ :arg-params
(m/arg-params bert-base)
+ :aux-params
(m/aux-params bert-base)
+ :optimizer
(optimizer/adam {:learning-rate 5e-6 :epsilon 1e-9})
+ :batch-end-callback
(callback/speedometer batch-size 1)})})]
+ (m/save-checkpoint fitted-model {:prefix fine-tuned-prefix :epoch
num-epoch})
Review comment:
With the `infer` API I suppose? Maybe we could change this at some point
@kedarbellare?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services