Skip Menu |

This queue is for tickets about the AI-MXNet CPAN distribution.

Report information
The Basics
Id: 131192
Status: new
Priority: 0/
Queue: AI-MXNet

People
Owner: Nobody in particular
Requestors: andreashad2 [...] googlemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: some issues running the example script at AI::MXNet's POD
Date: Tue, 17 Dec 2019 19:13:22 +0200
To: bug-AI-MXNet [...] rt.cpan.org
From: andreashad2 <andreashad2 [...] googlemail.com>
Hello there and thank you for providing AI::MXNet. After a big battle with building mxnet (v1.5.1), I am finally ready to run mxnet via Perl using the module you provided. Unfortunately the example script in AI::MXNet's pod (this is in the SYNOPSIS section at https://metacpan.org/pod/AI::MXNet) does not compile due to some minor problems which I managed to fix (and with the help from your examples at mxnet's "perl-package" subdir), as follows: add these includes: use AI::MXNet::Gluon::NN qw(nn); use AI::MXNet::Gluon qw(gluon); use AI::MXNet::Base; use AI::MXNet::AutoGrad qw(autograd); define some parameters to get the user started: my $lr = 1.0; # learning rate my $log_interval = 1000; my $epochs = 5; my $momentum = 1.0; my $cuda = 0; # do you want to use cuda? then the examples use sub test() which is not defined. But I found a test() sub in mxnet's perl-package subdir, which is my $val_data = gluon->data->DataLoader( gluon->data->vision->MNIST('./data', train=>0, transform=> \&transformer), batch_size=>$batch_size, shuffle=>0 ); sub test { my $ctx = shift; my $metric = mx->metric->Accuracy(); while(defined(my $d = <$val_data>)) { my ($data, $label) = @$d; $data = $data->as_in_context($ctx); $label = $label->as_in_context($ctx); my $output = $net->($data); $metric->update([$label], [$output]); } return $metric->get; } May I also suggest that calling enumerate() (and any other sub in your packages) should be using its fully-qualified name e.g. AI::MXNet::Base::enumerate() only for reasons of clarity. Some other notes on compiling mxnet which someone may find useful 1) I downloaded mxnet v1.5.1 source code from: https://www.apache.org/dyn/closer.cgi/incubator/mxnet/1.5.1/apache-mxnet-src-1.5.1-incubating.tar.gz I tried several times with their github dev repo but it failed, each time on something different. It tries to compile several things (3rdparty) at the same time which is totally wrong as they should add these as prerequisites. Some of them conflict with my installed versions, some do not compile. The fact that their code is written by some script-kiddies (or at least their cmakefiles) does not help either. It's a chaotic distribution. 2) Disable JEMALLOC because it complains about TLS something or other. 3) Compilation params are in make/config.mk that's that I think, thank you again, Andreas (bliako@cpan.org)