java.lang.RuntimeException: java.lang.UnsupportedOperationExceptionat ошибка при обучении GloVe с DL4j - PullRequest
0 голосов
/ 23 мая 2019

Я хочу работать с GloVe встраиванием в английские предложения.Во время обучения показывается ошибка «java.lang.RuntimeException: java.lang.UnsupportedOperationExceptionat»

Встраивание перчаток - это модель без надзора для кодирования английского текста в векторы.Dl4j - это библиотека Java.Во время тренировки модели Glove эта ошибка проявляется.

File inputFile = new ClassPathResource("raw_sentences.txt").getFile();

    // creating SentenceIterator wrapping our training corpus
    SentenceIterator iter = new BasicLineIterator(inputFile.getAbsolutePath());

    // Split on white spaces in the line to get words
    TokenizerFactory t = new DefaultTokenizerFactory();
    t.setTokenPreProcessor(new CommonPreprocessor());

    Glove glove = new Glove.Builder()
            .iterate(iter)
            .tokenizerFactory(t)


            .alpha(0.75)
            .learningRate(0.1)

            // number of epochs for training
            .epochs(25)

            // cutoff for weighting function
            .xMax(100)

            // training is done in batches taken from training corpus
            .batchSize(1000)

            // if set to true, batches will be shuffled before training
            .shuffle(true)

            // if set to true word pairs will be built in both directions, LTR and RTL
            .symmetric(true)
            .build();
    log.info("Up here fine");
    glove.fit();  // Getting error here

o.d.m.s.SequenceVectors - Starting learning process...
Exception in thread "VectorCalculationsThread 0" java.lang.RuntimeException: java.lang.UnsupportedOperationException
    at org.deeplearning4j.models.sequencevectors.SequenceVectors$VectorCalculationsThread.run(SequenceVectors.java:1341)
Caused by: java.lang.UnsupportedOperationException
    at org.deeplearning4j.models.embeddings.learning.impl.elements.GloVe.learnSequence(GloVe.java:137)
    at org.deeplearning4j.models.sequencevectors.SequenceVectors.trainSequence(SequenceVectors.java:399)
    at org.deeplearning4j.models.sequencevectors.SequenceVectors$VectorCalculationsThread.run(SequenceVectors.java:1274)
...