matt-gardner / pra

122 stars 42 forks source link

I can't run the code.... #16

Closed liqimai closed 7 years ago

liqimai commented 7 years ago

I cloned the latest version, but it seems not work here. it can not pass all the tests. sbt show me this:

[info] ScalaTest
[info] Run completed in 31 seconds, 983 milliseconds.
[info] Total number of tests run: 159
[info] Suites: completed 26, aborted 0
[info] Tests: succeeded 156, failed 3, canceled 0, ignored 0, pending 0
[info] *** 3 TESTS FAILED ***
[error] Failed: Total 183, Failed 12, Errors 0, Passed 171
[error] Failed tests:
[error]     edu.cmu.ml.rtw.pra.graphs.GraphOnDiskSpec
[error]     edu.cmu.ml.rtw.pra.features.PraFeatureGeneratorSpec
[error]     edu.cmu.ml.rtw.pra.features.RandomWalkPathFollowerTest
[error]     edu.cmu.ml.rtw.pra.graphs.GraphChiPprComputerSpec
[error]     edu.cmu.ml.rtw.pra.features.RandomWalkPathFinderTest
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 42 s, completed Oct 14, 2016 4:40:07 PM

Then I try some simple examples. JVM throw out NullPointerException:

> run examples synthetic
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list

Multiple main classes detected, select one to run:

 [1] edu.cmu.ml.rtw.pra.experiments.ExperimentRunner
 [2] edu.cmu.ml.rtw.pra.experiments.ExperimentScorer
 [3] edu.cmu.ml.rtw.pra.graphs.RunRemoteGraphServer

Enter number: 1

[info] Running edu.cmu.ml.rtw.pra.experiments.ExperimentRunner examples synthetic
[info] Found 354 experiment specs, and kept 6 of them
[info] Running PRA from spec file examples/experiment_specs/debugging/synthetic.json
[error] Exception in thread "main" java.lang.NullPointerException
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator.generateSyntheticRelationSet(GraphCreator.scala:307)
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator$$anonfun$1.apply(GraphCreator.scala:51)
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator$$anonfun$1.apply(GraphCreator.scala:48)
[error]     at scala.collection.immutable.List.map(List.scala:273)
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator.<init>(GraphCreator.scala:48)
[error]     at edu.cmu.ml.rtw.pra.experiments.Driver.getGraphInput(Driver.scala:138)
[error]     at edu.cmu.ml.rtw.pra.experiments.Driver.<init>(Driver.scala:52)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$.runPraFromSpec(ExperimentRunner.scala:76)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$$anonfun$runPra$1.apply(ExperimentRunner.scala:61)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$$anonfun$runPra$1.apply(ExperimentRunner.scala:61)
[error]     at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
[error]     at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
[error]     at scala.collection.mutable.ArraySeq.foreach(ArraySeq.scala:74)
[error]     at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
[error]     at scala.collection.AbstractTraversable.map(Traversable.scala:104)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$.runPra(ExperimentRunner.scala:61)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$.main(ExperimentRunner.scala:31)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner.main(ExperimentRunner.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code returned from runner: 1
[error] Total time: 10 s, completed Oct 14, 2016 5:12:56 PM

Finally I checkout to v3.0. The tests even can't be compiled successfully this time! sbt show me this:

> test
[info] Compiling 18 Scala sources and 21 Java sources to /home/liqimai/host/Document/KnowledgeGraph/pra/target/scala-2.11/test-classes...
[error] /home/liqimai/host/Document/KnowledgeGraph/pra/src/test/scala/edu/cmu/ml/rtw/pra/config/SpecFileReaderSpec.scala:4: object FakeDatasetFactory is not a member of package edu.cmu.ml.rtw.pra.experiments
[error] import edu.cmu.ml.rtw.pra.experiments.FakeDatasetFactory
[error]        ^
[error] one error found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 23 s, completed Oct 14, 2016 5:01:55 PM

Could you help me! I've been stucked on all those errors for two days!

matt-gardner commented 7 years ago

I'm afraid I have no idea what's causing your problem. As you can see on the main page, Travis says the build is passing all tests. I just made a fresh clone of the repository and tried it, and the tests all pass. Something must be up with your environment somehow.

liqimai commented 7 years ago

My environment:

May you tell me your environment?

matt-gardner commented 7 years ago

The same as yours. Just clone a totally new version of the repo, in a new spot, and run sbt test. Both Travis and my experience today say that this should give you a passing result. The ubuntu version, sbt version, and specific jdk should not make a difference (I typically use an oracle jdk). I know the code runs with java 8, though I'm sure if it requires it - it may also run with java 7 or earlier.

liqimai commented 7 years ago

Thanks for your help. It has passed all the tests now, but I still can't run the first example you put.

My linux is running on a virtual machine. For some reason, I placed the repo in a shared folder, which is actually a part of windows' space. After I moved all the repo into ubuntu, it passed all the tests.

When I tried examples/experiment_specs/debugging/synthetic.json, it couldn't generate the graph. GraphCreator threw out NullPointerException.

> run examples synthetic.json
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list

Multiple main classes detected, select one to run:

 [1] edu.cmu.ml.rtw.pra.experiments.ExperimentRunner
 [2] edu.cmu.ml.rtw.pra.experiments.ExperimentScorer
 [3] edu.cmu.ml.rtw.pra.graphs.RunRemoteGraphServer

Enter number: 1

[info] Running edu.cmu.ml.rtw.pra.experiments.ExperimentRunner examples synthetic.json
[info] Found 354 experiment specs, and kept 1 of them
[info] Running PRA from spec file examples/experiment_specs/debugging/synthetic.json
[error] Exception in thread "main" java.lang.NullPointerException
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator.generateSyntheticRelationSet(GraphCreator.scala:307)
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator$$anonfun$1.apply(GraphCreator.scala:51)
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator$$anonfun$1.apply(GraphCreator.scala:48)
[error]     at scala.collection.immutable.List.map(List.scala:273)
[error]     at edu.cmu.ml.rtw.pra.graphs.GraphCreator.<init>(GraphCreator.scala:48)
[error]     at edu.cmu.ml.rtw.pra.experiments.Driver.getGraphInput(Driver.scala:138)
[error]     at edu.cmu.ml.rtw.pra.experiments.Driver.<init>(Driver.scala:52)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$.runPraFromSpec(ExperimentRunner.scala:76)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$$anonfun$runPra$1.apply(ExperimentRunner.scala:61)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$$anonfun$runPra$1.apply(ExperimentRunner.scala:61)
[error]     at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
[error]     at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
[error]     at scala.collection.mutable.ArraySeq.foreach(ArraySeq.scala:74)
[error]     at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
[error]     at scala.collection.AbstractTraversable.map(Traversable.scala:104)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$.runPra(ExperimentRunner.scala:61)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner$.main(ExperimentRunner.scala:31)
[error]     at edu.cmu.ml.rtw.pra.experiments.ExperimentRunner.main(ExperimentRunner.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code returned from runner: 1
[error] Total time: 4 s, completed Oct 15, 2016 3:25:02 PM
matt-gardner commented 7 years ago

The synthetic dataset code is old and un-maintained, and it doesn't surprise me that it doesn't work. It was a failed experiment. Try the commands here: http://rtw.ml.cmu.edu/emnlp2015_sfe/, to run the experiments from the EMNLP 2015 paper.

liqimai commented 7 years ago

I've run the code succussfully. I think more document for input file format may be helpful, especially when others use their own data set. Anyway, thank you guys a lot!