Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseline_vs.embeddings #21

Open
IdelCoder opened this issue Sep 20, 2017 · 10 comments
Open

baseline_vs.embeddings #21

IdelCoder opened this issue Sep 20, 2017 · 10 comments

Comments

@IdelCoder
Copy link

Hi, Matt. I was trying to run PRA instead of SFE. But I run into the following problem.
[error] Exception in thread "main" java.lang.IllegalStateException: Error specifying embeddings (you must give full paths to embedding files)
So, I want to know what does "pca_svo" mean in file baseline_vs*.json.

@matt-gardner
Copy link
Owner

matt-gardner commented Sep 20, 2017

You can get the embeddings here: http://rtw.ml.cmu.edu/emnlp2015_sfe/embeddings.tgz. Extract that and change the relevant paths in the json file, and let me know if you run into any more issues.

@IdelCoder
Copy link
Author

After solving a bunch of problems of unexpected key such as "mode", "path selector" and the like, I run into a problem concerning scala grammar. In file "FeatureGenerator.scala"(line 85: new PraFeatureGenerator), IDEA said that "Expression of type PraFeatureGenerator doesn't conform to expected type FeatureGenerator[T]". And this problem causes failure to compile.
However, what confuses me is that this problem has already been there before I solved the problem of unexpected key. But the compilation can succeed before the problem of unexpected key was solved.
I am new to scala and have been confused by trait and everywhere generic.
it would be appreciated that you can solve this problem or give me some suggestions. And I am pleasure to state detail on how to run PRA if I eventually run it successfully.

@matt-gardner
Copy link
Owner

Did you change any code? You should not have to change any code, only the configuration files.

@IdelCoder
Copy link
Author

I added the embeddings file. And the error occured
[error] Exception in thread "main" java.util.NoSuchElementException: eat can suffer like
[error] at com.mattg.util.ImmutableIndex.getIndex(Index.scala:165)
[error] at edu.cmu.ml.rtw.pra.graphs.GraphOnDisk.getEdgeIndex(Graph.scala:170)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder$$anonfun$readVectorsFromFile$1.apply(PathFinder.scala:204)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder$$anonfun$readVectorsFromFile$1.apply(PathFinder.scala:202)
[error] at scala.collection.immutable.Stream.map(Stream.scala:418)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder.readVectorsFromFile(PathFinder.scala:202)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder$$anonfun$readEmbeddingsVectors$1.apply(PathFinder.scala:195)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder$$anonfun$readEmbeddingsVectors$1.apply(PathFinder.scala:193)
[error] at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
[error] at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
[error] at scala.collection.immutable.List.foreach(List.scala:381)
[error] at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
[error] at scala.collection.immutable.List.flatMap(List.scala:344)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder.readEmbeddingsVectors(PathFinder.scala:193)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder.createVectorPathTypeFactory(PathFinder.scala:187)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder.createPathTypeFactory(PathFinder.scala:164)
[error] at edu.cmu.ml.rtw.pra.features.GraphChiPathFinder.findPaths(PathFinder.scala:124)
[error] at edu.cmu.ml.rtw.pra.features.PraFeatureGenerator.selectPathFeatures(PraFeatureGenerator.scala:78)
[error] at edu.cmu.ml.rtw.pra.features.PraFeatureGenerator.createTrainingMatrix(PraFeatureGenerator.scala:38)
[error] at edu.cmu.ml.rtw.pra.operations.TrainAndTest.runRelation(Operation.scala:98)
[error] at edu.cmu.ml.rtw.pra.experiments.Driver$$anonfun$_runStep$1.apply(Driver.scala:93)
[error] at edu.cmu.ml.rtw.pra.experiments.Driver$$anonfun$_runStep$1.apply(Driver.scala:87)
[error] at scala.collection.immutable.Stream.foreach(Stream.scala:594)
[error] at edu.cmu.ml.rtw.pra.experiments.Driver._runStep(Driver.scala:87)
[error] at com.mattg.pipeline.Step.runStep(Step.scala:187)
[error] at com.mattg.pipeline.Step._runPipeline(Step.scala:152)
[error] at com.mattg.pipeline.Step.runPipeline(Step.scala:79)
[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 Sep 21, 2017 5:18:58 AM

@matt-gardner
Copy link
Owner

The problem here is that I changed the code to crash if you request an edge id where the edge isn't in the graph, and I haven't run this particular part of the code since I made that change, so I never discovered this bug. The old behavior was to return -1, which worked fine here, but was undesirable for other reasons. To fix this, you need to add a check here for whether the edge is in the graph (I believe the correct method is graph.hasEdge), and only request an index if the edge is present. And if you do fix this, please submit a PR to the repo, so that others can benefit from your fix.

@IdelCoder
Copy link
Author

After fixing this, the code seems to run. Like running the SFE which keeps outputting "[error] getValue", running pra keeps outputting "[error] engine execUpdates - t:1 INFO: Waiting for execution to finish: countDown:1". My machine only has 8GB RAM. And I set "javaOptions in run ++= Seq("-Xmx4g")". As a result, java heap space outOfMemoryError. What is the least space to satisfy the program?

@matt-gardner
Copy link
Owner

Sadly, the code needs a whole lot of memory to run; see the note on the main README.

@IdelCoder
Copy link
Author

Thanks, Matt. I set "Xmx5g". Although it ends up with out of memory again, some relations still succeed to generate "scores.tsv" and "weights.tsv". So, I think maybe I can run only one relation at a time. Eventually, I can have all the 10 relations run. I will pull a request as soon as the programming runs steady.

@IdelCoder
Copy link
Author

If I want to run original pra algo with different dataset , can I use the same embedding file as you posted before?

@matt-gardner
Copy link
Owner

You almost certainly want different embeddings in that case. I just got them from running PCA. There's a way to do that with this code, if you want to dig through it and figure it out, or you could just use Matlab or something instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants