berkeley-entity icon indicating copy to clipboard operation
berkeley-entity copied to clipboard

File not found problem with model file

Open joecheriross opened this issue 9 years ago • 15 comments

Hi Greg, I compiled the source files again and created berkeley-entity jar in target directory. Jar creation is successful. But while running the system with this jar I am getting the following error. Please help.

ERROR: java.lang.RuntimeException: Can't write to models/cached/corefpruner-onto.ser.gz: edu.berkeley.nlp.entity.GUtil$.save(GUtil.scala:28) edu.berkeley.nlp.entity.coref.CorefPruner$.trainAndSaveKFoldModels(CorefPruner.scala:103) edu.berkeley.nlp.entity.coref.CorefPruner$.buildPruner(CorefPruner.scala:93) edu.berkeley.nlp.entity.coref.CorefSystem$.runTrain(CorefSystem.scala:140) edu.berkeley.nlp.entity.coref.CorefSystem$.runTrainPredict(CorefSystem.scala:108) edu.berkeley.nlp.entity.coref.CorefSystem.runTrainPredict(CorefSystem.scala) edu.berkeley.nlp.entity.Driver.run(Driver.java:343) edu.berkeley.nlp.futile.fig.exec.Execution.runWithObjArray(Execution.java:479) edu.berkeley.nlp.futile.fig.exec.Execution.run(Execution.java:432) edu.berkeley.nlp.entity.Driver.main(Driver.java:319)

Thanks, Joe

Command: java -Xmx8g -jar target/scala-2.11/berkeley-entity-assembly-1.jar ++config/base.conf -execDir scratch -mode COREF_TRAIN_PREDICT -testPath /tmp/test_input/ -docSuffix auto_conll -trainPath ./small_train/ -modelPath "models/joint-onto.ser.gz" -wikipediaPath "models/wiki-db-onto.ser.gz" -useGoldMentions -pruningStrategy build:models/cached/corefpruner-onto.ser.gz:-5:5 -nerPruningStrategy build:models/cached/nerpruner-onto.ser.gz:-9:5 -outputPath /tmp/test_output/

joecheriross avatar Dec 25 '15 18:12 joecheriross

Sorry. This issue is with existing jar as well. This is some other problem. The existing jar was working fine. Let me try to resolve it by my own. But in case you know possible causes let me know.

Thanks, Joe

joecheriross avatar Dec 26 '15 06:12 joecheriross

Does that directory exist? GUtil is trying to open the file for write and can't do it, and that's the main reason that might happen.

Greg

On Sat, Dec 26, 2015 at 1:33 AM, Joe Cheri Ross [email protected] wrote:

Sorry. This issue is with existing jar as well. This is some other problem. The existing jar was working fine. Let me try to resolve it by my own. But in case you know possible causes let me know.

Thanks, Joe

— Reply to this email directly or view it on GitHub https://github.com/gregdurrett/berkeley-entity/issues/5#issuecomment-167284749 .

gregdurrett avatar Dec 26 '15 18:12 gregdurrett

Yes yes, the directory does exists. I checked it first. Even I tried deleting and creating cached directory again. This started happening after I did a pull. Let me try to download a fresh one from github and try.

Thanks, Joe

On Sat, Dec 26, 2015 at 11:37 PM, Greg Durrett [email protected] wrote:

Does that directory exist? GUtil is trying to open the file for write and can't do it, and that's the main reason that might happen.

Greg

On Sat, Dec 26, 2015 at 1:33 AM, Joe Cheri Ross [email protected] wrote:

Sorry. This issue is with existing jar as well. This is some other problem. The existing jar was working fine. Let me try to resolve it by my own. But in case you know possible causes let me know.

Thanks, Joe

— Reply to this email directly or view it on GitHub < https://github.com/gregdurrett/berkeley-entity/issues/5#issuecomment-167284749

.

— Reply to this email directly or view it on GitHub https://github.com/gregdurrett/berkeley-entity/issues/5#issuecomment-167351691 .

joecheriross avatar Dec 27 '15 02:12 joecheriross

The issue is the separator ':' is somehow not getting removed from the command line argument. In the exception message you can see that ':' is also there

ERROR: java.lang.RuntimeException: Can't write to models/cached/corefpruner-onto.ser.gz:

This I think is a problem with the newly updated code. I run this on a mac book pro. May be it can also be a problem with the java on this machine. Please check.

joecheriross avatar Dec 28 '15 00:12 joecheriross

Sorry. that ":" has nothing to do with the exception. It just get appended with exception message. My ignorance. When I comment the line which raises this exception it works.

joecheriross avatar Dec 28 '15 13:12 joecheriross

Hi, i have the same issue on macbook pro. @joecheriross could you tell me which line in which file you commented? thanks.

yuliagrishina avatar Feb 04 '16 17:02 yuliagrishina

Hi,

In GUtil.scala there is a save function.

def save[T <: Serializable](obj: T, path: String) {
    //if (new File(path).getParentFile() != null && new File(path).getParentFile().canWrite()) {
    //  throw new RuntimeException("Can't write to " + path + "something"); 
    //}
    if (path.endsWith(".gz")) saveGz(obj, path) else saveNonGz(obj, path);
  }

Comment the lines which are commented here.

joecheriross avatar Feb 04 '16 18:02 joecheriross

should I recompile it afterwards?

yuliagrishina avatar Feb 04 '16 19:02 yuliagrishina

Yes, compilation is required since the source is modified. Note the path and name of the newly compiled jar and make sure you run with the new jar.

On Fri, Feb 5, 2016 at 12:37 AM, yuliagrishina [email protected] wrote:

should I recompile it afterwards?

— Reply to this email directly or view it on GitHub https://github.com/gregdurrett/berkeley-entity/issues/5#issuecomment-180004695 .

joecheriross avatar Feb 04 '16 19:02 joecheriross

thanks, it worked. had to change path to wiki-db-onto.ser.gz, too, because it wasn't in /cache/.

yuliagrishina avatar Feb 04 '16 19:02 yuliagrishina

Great.

On Fri, Feb 5, 2016 at 12:53 AM, yuliagrishina [email protected] wrote:

thanks, it worked. had to change path to wiki-db-onto.ser.gz, too, because it wasn't in /cache/.

— Reply to this email directly or view it on GitHub https://github.com/gregdurrett/berkeley-entity/issues/5#issuecomment-180011263 .

joecheriross avatar Feb 04 '16 19:02 joecheriross

Hey Greg,

I think this is a bug, and canWrite should be negated in GUtil.save. Can submit a PR if you want/agree...

kpich avatar Jun 27 '16 15:06 kpich

Yep, that's definitely wrong...I must have never noticed because I write models to the current directory so the parent ends up being null.

gregdurrett avatar Jun 27 '16 16:06 gregdurrett

(A PR would be nice, thanks!)

gregdurrett avatar Jun 27 '16 16:06 gregdurrett

woo, see PR #11

kpich avatar Jun 27 '16 19:06 kpich