dnngraph icon indicating copy to clipboard operation
dnngraph copied to clipboard

GoogLeNet.hs: pdf output doesn't work

Open Hi-Angel opened this issue 9 years ago • 10 comments

It's saying:

$ runhaskell NN/Examples/GoogLeNet.hs visualize --format pdf --output /tmp/x.pdf
GoogLeNet.hs: dot: runInteractiveProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

Hi-Angel avatar Dec 07 '15 17:12 Hi-Angel

I'm just tried to create the pdf from AlexNet, and get the same error. It seems that the error somewhere inside the package.

Btw, png output doesn't work either (the same output).

Hi-Angel avatar Dec 08 '15 06:12 Hi-Angel

I got a stacktrace:

λ > :trace main 
Stopped at <exception thrown>
_exception :: e = _
λ > :back 
Logged breakpoint at NN/CLI.hs:63:21-23
_result :: Data.GraphViz.Commands.GraphvizOutput
λ > :list
62        fmtTy "png" = Png
63        fmtTy "pdf" = Pdf
64        fmtTy _ = error "Must be pdf or png"
λ > :hist
-1  : run:fmtTy (NN/CLI.hs:63:21-23)
-2  : run:fmtTy (NN/CLI.hs:(62,7)-(64,42))
-3  : run (NN/CLI.hs:60:46-57)
-4  : toCaffe (NN/DSL.hs:66:29-48)
-5  : _type' (Gen/Caffe/LayerParameter.hs:50:68-73)
-6  : _type' (Gen/Caffe/LayerParameter.hs:50:68-73)
-7  : layerTy (NN/DSL.hs:77:23-33)
-8  : layerTy (NN/DSL.hs:77:13-34)
-9  : layerTy (NN/DSL.hs:77:13-45)
-10 : toCaffe (NN/DSL.hs:(57,1)-(67,19))
-11 : layerTy (NN/DSL.hs:77:13-55)
-12 : layerTy (NN/DSL.hs:77:13-66)
-13 : layerTy (NN/DSL.hs:77:1-66)
-14 : fromEnum (NN/DSL.hs:40:36-39)
-15 : fmtLabelParameter:idx (NN/Visualize.hs:63:41-58)
-16 : fmtLabelParameter:idx (NN/Visualize.hs:63:21-58)
-17 : fmtLabelParameter:idx (NN/Visualize.hs:63:13-62)
-18 : fmtLabelParameter:color' (NN/Visualize.hs:65:27-42)
-19 : fmtLabelParameter:maxColors (NN/Visualize.hs:62:19)
-20 : fmtLabelParameter:scheme (NN/Visualize.hs:64:33-54)
...
λ > 

UPD: ah, forgot — the stacktrace is from AlexNet.hs, though, it have the same problem.

Hi-Angel avatar Dec 08 '15 08:12 Hi-Angel

Do you have graphviz installed? What does dot -V say on your machine?

ajtulloch avatar Dec 08 '15 14:12 ajtulloch

It says

The program 'dot' is currently not installed. You can install it by typing:
sudo apt-get install graphviz

Yay, well, that was an easy bug — adding that to README surely won't break the the compilation ☺

Hi-Angel avatar Dec 08 '15 15:12 Hi-Angel

Btw, is there anywhere an example of recurrent network in the dnngraph?

Hi-Angel avatar Dec 08 '15 15:12 Hi-Angel

Man, I know, you won't care, but I wanna write it anyway. I hate you. Just for you to know: I was writing my diploma about some sort of LSTM nets application, so I choose Haskell because it is the fastest (in the development rate sense) and the most reliable language of what I know. As devel. fastest I could also choose Python, but it isn't reliable, and also the project actually should go further than just diploma, so I preferred Haskell.

To my surprise I didn't find a project in Haskell that does LSTM. I was about to give up, when I found out of hackage your project — it is said to be DSL to two another libraries, which are, according to Google, have recurrent networks and tutorials for writing LSTM. «This is my chance!» — I thought. Although grepping over the code found neither of "recurr", "lstm", "rnn" (any case), but I was sure, at least, I could apply a backend tutorial for this code.

I was just writing the last, practice, chapter, and for reasons beyond my control I was a bit late. So, to not lose time for nothing, I start writing how I am doing the research of the dnngraph code. For writing time I omitted a bunch of research process, and, relatively, for every second sentence I spent at least five minutes. And despite that now I filled the least volume I was needed (18 pages), and ¾ of that text is just how I'm trying to find a way to make at least plain FF network — which is half way to recurrent, which is half way to LSTM. I'm still on my way to the least network, I'm now completely out of time, and I have no idea what to do now.

I see, you're a good mathematician, also I am not that experienced in Haskell as you're. But let me give you some advices. First: check whatever you does in IO! This bug with graphviz app is the obvious example. I know, peoples says that in Haskell no bugs once the program compiles, but that is only due to the great type system — and whatever IO does is out of it! So, if you're doing anything with it, like executing an external app — you have to be ready for anything to go wrong, and to print whatever gone wrong!

Second, please, name variables and types correctly! Of course, variables like «a, b, c» are fine when the function is just a few lines long. But you should not name that omnipresent type G in that way, because, although, one can easily infer from the function name, body, and especially type, whatever does those «a, b, c», but one cannot easily infer from the context, whatever could be that type G — because the type G is the context!

Third, please, leave comments! I know, that code might be obvious to yourself, but it is often not for every one else. For example, could you say, what does the function stack? Let me do it, it is

-- connects a list of nodes

Easy, right? The problem is that I am still not even sure it is absolutely right, and even that took me about a hour to figure it out. Just look at that code, a bunch of comments, most of which even could be compiled into documentation. And compare it with dnngraph — not just there is no comments to be compiled into documentation, there is no comments at all!

Hi-Angel avatar Dec 10 '15 04:12 Hi-Angel

@ajtulloch please, add to the README a note like «The project is under heavily refactoring, and is not recommended to use», or whatever alike. Because I'm sure, you won't do refactoring in any close time, if you'd do it ever, and that text would surely save someone's time. You actually made just every possible architecture error, that could be done with disregard to specific environment and language.

Btw, if you would ever start refactoring, I'd recommend to start from the DSL.hs.

Hi-Angel avatar Dec 11 '15 11:12 Hi-Angel

@Hi-Angel those are some pretty offensive comments!

alexanderkjeldaas avatar Dec 27 '16 15:12 alexanderkjeldaas

@alexanderkjeldaas they're for a reason, aren't they? The most intimidating in the whole thing is that the project has so many forks and stars. They're clearly peoples, who didn't even try to do anything with this, and this is bad, because they delude others into thinking that this works, and makes them spend great amounts of time in vain.

Hi-Angel avatar Dec 27 '16 21:12 Hi-Angel

@alexanderkjeldaas and FYI: I struggle to say what people call "offensive". It's an abstract notion over many so different sets that I gave up to get it to anything meaningful. But if these particular comments turned out to be "offensive" — well, they probably had the reason anyway.

Hi-Angel avatar Dec 28 '16 05:12 Hi-Angel