1

I'm trying to propose a patch to deeplearning4j, but first I need to be able to build the project. I'm able to build it from maven using the manual instructions, but IntelliJ (2016.3.6) is finding errors, and when I look at the source code, I don't blame it.

The source file I'm specifically stumped by is https://github.com/deeplearning4j/deeplearning4j/blob/master/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/StaticWord2Vec.java, which has a couple references to a variable log that's not declared in this file.

package org.deeplearning4j.models.word2vec;

import lombok.extern.slf4j.Slf4j;
import org.deeplearning4j.models.embeddings.WeightLookupTable;
import org.deeplearning4j.models.embeddings.reader.ModelUtils;
import org.deeplearning4j.models.embeddings.wordvectors.WordVectors;
import org.deeplearning4j.models.word2vec.wordstore.VocabCache;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.compression.AbstractStorage;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.ops.transforms.Transforms;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * This is special limited Word2Vec implementation, suited for serving as lookup table in concurrent multi-gpu environment
 * This implementation DOES NOT load all vectors onto any of gpus, instead of that it holds vectors in, optionally, compressed state in host memory.
 * This implementation DOES NOT provide some of original Word2Vec methods, such as wordsNearest or wordsNearestSum.
 *
 * @author [email protected]
 */
@Slf4j
public class StaticWord2Vec implements WordVectors {
    private List<Map<Integer, INDArray>> cacheWrtDevice = new ArrayList<>();
    private AbstractStorage<Integer> storage;
    private long cachePerDevice = 0L;
    private VocabCache<VocabWord> vocabCache;
    private String unk = null;
 ... snipped

The class extends an interface, but does not explicitly extend a parent class. Inspecting the class file generated by Maven using javap, I see:

Compiled from "StaticWord2Vec.java"
public class org.deeplearning4j.models.word2vec.StaticWord2Vec 
implements org.deeplearning4j.models.embeddings.wordvectors.WordVectors {
private static final org.slf4j.Logger log;
... snipped
2

1 Answer 1

2

I finally noticed the annotation @Slf4j and tracing the import statement, discovered that I needed to add the Lombok plugin to IntelliJ to be able to build this project.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.