我正在尝试为deeplearning4j提出一个补丁,但首先我需要能够构建该项目。我可以使用手册中的说明从maven进行构建,但是IntelliJ(2016.3.6)发现了错误,当我查看源代码时,我并不怪它。
我特别为之困扰的源文件是https://github.com/deeplearning4j/deeplearning4j/blob/master/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/StaticWord2Vec.java,该文件有两个引用,该变量未在此文件中声明log
。
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
该类扩展了接口,但没有显式扩展父类。检查Maven使用javap生成的类文件,我看到:
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
最佳答案
我终于注意到注释@Slf4j
并跟踪import语句,发现我需要将Lombok plugin添加到IntelliJ中才能构建此项目。