Re: [Moses-support] mosese decoder android and ios porting

2012-11-28 Thread Hieu Hoang
 > It's not clear to me how you're planning to call Moses. stdin/stdout, 
mosesserver, a C++ library wrapper, some JNI with a .so file?

if you can compile the library, the c++-to-c wrapper is in the android 
(& iphone) build. Then you can call it using JNI.

___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-28 Thread Kenneth Heafield
You can make a chroot on your desktop machine where all the binaries are 
arm and emulated on your desktop by qemu.  Once setup, it will act like 
a normal gentoo system in a chroot except slower.  Install moses inside 
this system, compiling with --static.

You can copy either the entire chroot or just the static moses 
executable to your phone where the binaries will run natively.

It's not clear to me how you're planning to call Moses.  stdin/stdout, 
mosesserver, a C++ library wrapper, some JNI with a .so file?

If you can compile Moses with the android NDK, that's fine, but I don't 
know how to do it.  However, you should follow 
http://stackoverflow.com/questions/4663291/android-ndk-r5-and-support-of-c-exception
 
to enable exceptions.

Kenneth

On 11/28/12 08:36, myounggun jang wrote:
> Thank you for your help.
>   I don't know about qemu, so I read some article about qemu.
> do you mean that I need to install gentoo system in android, then
> install moses using emulated gentoo system?
> I have to make a library for using moses decoder function. therfore I'm
> tring to build mosese decoder by android NDK.
> MG Jang
>
> On Tue, Nov 27, 2012 at 11:22 PM, Kenneth Heafield  > wrote:
>
> A pedantic point: they can be arranged any way you like but must be
> accessed in multiples of 32 bits.  The KenLM trie data structure does
> not follow this alignment.  However, NICT added code to KenLM for ARM
> that accesses the data in an aligned way by rounding up/down and doing
> multiple accesses.
>
> Kenneth
>
> On 11/27/12 11:33, Hieu Hoang wrote:
>  > 2. To save memory and have quick loading time, the language model and
>  > phrase-table has to be binarized. The binary phrase-table isn't a
>  > problem. However, ARM chips require that datastructures be in
> multiple
>  > of 32-bits ('aligned'). This isn't the case with some
> datastructure in
>  > the irstlm (maybe also kenlm).
> ___
> Moses-support mailing list
> Moses-support@mit.edu 
> http://mailman.mit.edu/mailman/listinfo/moses-support
>
>
___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-28 Thread myounggun jang
Thank you for your help.

 I don't know about qemu, so I read some article about qemu.
do you mean that I need to install gentoo system in android, then install
moses using emulated gentoo system?
I have to make a library for using moses decoder function. therfore I'm
tring to build mosese decoder by android NDK.

MG Jang

On Tue, Nov 27, 2012 at 11:22 PM, Kenneth Heafield wrote:

> A pedantic point: they can be arranged any way you like but must be
> accessed in multiples of 32 bits.  The KenLM trie data structure does
> not follow this alignment.  However, NICT added code to KenLM for ARM
> that accesses the data in an aligned way by rounding up/down and doing
> multiple accesses.
>
> Kenneth
>
> On 11/27/12 11:33, Hieu Hoang wrote:
> > 2. To save memory and have quick loading time, the language model and
> > phrase-table has to be binarized. The binary phrase-table isn't a
> > problem. However, ARM chips require that datastructures be in multiple
> > of 32-bits ('aligned'). This isn't the case with some datastructure in
> > the irstlm (maybe also kenlm).
> ___
> Moses-support mailing list
> Moses-support@mit.edu
> http://mailman.mit.edu/mailman/listinfo/moses-support
>
___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Kenneth Heafield
A pedantic point: they can be arranged any way you like but must be 
accessed in multiples of 32 bits.  The KenLM trie data structure does 
not follow this alignment.  However, NICT added code to KenLM for ARM 
that accesses the data in an aligned way by rounding up/down and doing 
multiple accesses.

Kenneth

On 11/27/12 11:33, Hieu Hoang wrote:
> 2. To save memory and have quick loading time, the language model and
> phrase-table has to be binarized. The binary phrase-table isn't a
> problem. However, ARM chips require that datastructures be in multiple
> of 32-bits ('aligned'). This isn't the case with some datastructure in
> the irstlm (maybe also kenlm).
___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Hieu Hoang

ah sorry, i've found the rest of the code and checked it in.
  https://github.com/moses-smt/mosesdecoder/tree/android-ui

Looks like a lot of people are interested in this so if you continue to 
develop it openly on github, other people may be able to help you.


Some things i found when doing it:
   1. The android NDK compiler is very different from a normal C++ 
compiler. eg. it doesn't support exceptions, lots of code that compile 
ok with gcc broke with the ndk compiler.
Therefore, the code changed a lot from the original. It may 
be better to follow Ken's advice, set up a linux distribution on android 
and compile moses statically.
   2. To save memory and have quick loading time, the language model 
and phrase-table has to be binarized. The binary phrase-table isn't a 
problem. However, ARM chips require that datastructures be in multiple 
of 32-bits ('aligned'). This isn't the case with some datastructure in 
the irstlm (maybe also kenlm).


good luck. if you need help, please let me know. I'm interested in the 
progress of this project too.


On 27/11/2012 05:47, myounggun jang wrote:

I'm trying to port the moses decoder for android
I'll make tables in linux system. and then I just use it in android 
system. I just need to port moses decoder.
I'm trying to find article about moses android porting. however I 
didn't find useful article.
I found data for android 
http://www.mail-archive.com/moses-support@mit.edu/msg06392.html

however there are missing parts.
is there any aticle or some ported source for android and ios?
Thanks in advance.
MG Jang


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Marcin Junczys-Dowmunt
Yes. In combination both methods can achieve a size reduction of two 
orders of magnitude compared to the standard binary unfiltered phrase 
table.


W dniu 27.11.2012 11:39, Germán Sanchis Trilles pisze:
There are also some works addressing phrase-table size reduction. With 
very limited loss in translation quality (if any), it has been shown 
that the phrase-table can be pruned by up to 97%. See for instance:


http://www.mt-archive.info/EAMT-2011-Sanchis-Trilles.pdf
http://aclweb.org/anthology-new/N/N07/N07-2006.pdf
http://aclweb.org/anthology-new/D/D07/D07-1103.pdf

Cheers,

Germán



Phrase table shrinking is done :) See Compact Phrase Table in the 

advanced section.


W dniu 27.11.2012 10:54, Miles Osborne pisze:
  For a long time now I've wanted to see Moses on a small device. 
Apart from
  all of the extra functionality that isn't needed, one would 
also need to
  work on shrinking the phrase table and perhaps also the search 
graph.
   KenLM / RandLM already deal with making the language model 
smaller.
An interesting research question would be as follows:  can we frame 
decoding on a
small device in terms of a budget and optimise that budget?  We 
normally don't
bother thinking this way and instead focus entirely on quality.  But 
it might be
possible to instead have a better connection with the amount of space 
/ search
done and quality than we have already.  I'm not sure if this is just 
a matter of
fiddling with the beam size etc.  Evince seems to suggest that this 
doesn't
always give the expected behaviour (ie the relationship between BLEU 
and beam

size isn't linear).

Miles

--
The University of Edinburgh is a charitable body, registered in 
Scotland, with

registration number SC005336.


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support







___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Germán Sanchis Trilles
There are also some works addressing phrase-table size reduction. With 
very limited loss in translation quality (if any), it has been shown that 
the phrase-table can be pruned by up to 97%. See for instance:


http://www.mt-archive.info/EAMT-2011-Sanchis-Trilles.pdf
http://aclweb.org/anthology-new/N/N07/N07-2006.pdf
http://aclweb.org/anthology-new/D/D07/D07-1103.pdf

Cheers,

Germán



Phrase table shrinking is done :) See Compact Phrase Table in the 

advanced section.


W dniu 27.11.2012 10:54, Miles Osborne pisze:
  For a long time now I've wanted to see Moses on a small device. Apart from
  all of the extra functionality that isn't needed, one would also need to
  work on shrinking the phrase table and perhaps also the search graph.
   KenLM / RandLM already deal with making the language model smaller.
An interesting research question would be as follows:  can we frame decoding on 
a
small device in terms of a budget and optimise that budget?  We normally don't
bother thinking this way and instead focus entirely on quality.  But it might be
possible to instead have a better connection with the amount of space / search
done and quality than we have already.  I'm not sure if this is just a matter of
fiddling with the beam size etc.  Evince seems to suggest that this doesn't
always give the expected behaviour (ie the relationship between BLEU and beam
size isn't linear).  

Miles

--
The University of Edinburgh is a charitable body, registered in Scotland, with
registration number SC005336.


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support



___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Kenneth Heafield
Hi,

First thing you'll want is a moses executable compiled for ARM.  There 
are several guides on cross compiling; you'll want one based on gcc, 
clang, or at least something that supports exceptions.  My favorite 
method was just building an entire gentoo system in a chroot with qemu, 
but that may be overkill:

http://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&chap=5

However, the awesome part about that is you can rsync it to an android 
device and have a functional linux system in a chroot on your phone. 
And even ssh into it.  Be sure to choose your compiler flags carefully 
for the chips in question.  This is what Nick Ruiz referenced.

The next bit of fun is finding unaligned accesses where a pointer is 
dereferenced but not a multiple of 4.  qemu will happily lie to you and 
do unaligned accesses.  But some (most?) real ARM chips will segfault. 
So you'll need to be running on-device or somehow tell qemu to not do 
unaligned accesses.  In theory, there shouldn't be any unaligned 
accesses in KenLM anymore.  No idea about the rest of the code.

Once you've gotten a working executable (probably compiled with 
--static), the problem reduces to 1) producing a Moses library 
compatible with the non-chroot android environment and 2) the previously 
discussed problem of calling Moses as a library (paging Wilker Aziz).

Kenneth

On 11/27/12 05:47, myounggun jang wrote:
> I'm trying to port the moses decoder for android
> I'll make tables in linux system. and then I just use it in android
> system. I just need to port moses decoder.
> I'm trying to find article about moses android porting. however I didn't
> find useful article.
> I found data for android
> http://www.mail-archive.com/moses-support@mit.edu/msg06392.html
> however there are missing parts.
> is there any aticle or some ported source for android and ios?
> Thanks in advance.
> MG Jang
>
>
> ___
> Moses-support mailing list
> Moses-support@mit.edu
> http://mailman.mit.edu/mailman/listinfo/moses-support
___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Marcin Junczys-Dowmunt
Phrase table shrinking is done :) See Compact Phrase Table in the 
advanced section.


W dniu 27.11.2012 10:54, Miles Osborne pisze:
For a long time now I've wanted to see Moses on a small device. Apart 
from all of the extra functionality that isn't needed, one would also 
need to work on shrinking the phrase table and perhaps also the search 
graph.  KenLM / RandLM already deal with making the language model 
smaller.


An interesting research question would be as follows:  can we frame 
decoding on a small device in terms of a budget and optimise that 
budget?  We normally don't bother thinking this way and instead focus 
entirely on quality.  But it might be possible to instead have a 
better connection with the amount of space / search done and quality 
than we have already.  I'm not sure if this is just a matter of 
fiddling with the beam size etc.  Evince seems to suggest that this 
doesn't always give the expected behaviour (ie the relationship 
between BLEU and beam size isn't linear).


Miles

--
The University of Edinburgh is a charitable body, registered in 
Scotland, with registration number SC005336.



___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Miles Osborne
For a long time now I've wanted to see Moses on a small device. Apart from
all of the extra functionality that isn't needed, one would also need to
work on shrinking the phrase table and perhaps also the search graph.
 KenLM / RandLM already deal with making the language model smaller.

An interesting research question would be as follows:  can we frame
decoding on a small device in terms of a budget and optimise that budget?
 We normally don't bother thinking this way and instead focus entirely on
quality.  But it might be possible to instead have a better connection with
the amount of space / search done and quality than we have already.  I'm
not sure if this is just a matter of fiddling with the beam size etc.
 Evince seems to suggest that this doesn't always give the expected
behaviour (ie the relationship between BLEU and beam size isn't linear).

Miles

-- 
The University of Edinburgh is a charitable body, registered in Scotland,
with registration number SC005336.
___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-27 Thread Nick Ruiz
Porting Moses to Android would be interesting. I think that the Android 
NDK is improving so it could be more feasible nowadays. There are 
several speech translation apps available on the market (e.g. Jibbigo) 
that demonstrate that MT is certainly viable on Android (and iOS) 
devices without a client/server model. And particularly looking at the 
current generation phones (quad core, 2 gb RAM), it's certainly possible 
to have an Android-specific decoder. However, the Moses decoder has lots 
of built-in functionality that may be a bit heavy to port (and test).


Kenneth Heafield mentioned flashing his phone to Gentoo Linux and 
installing Moses on it about a year ago. While this doesn't address the 
NDK and JNI issues, perhaps he might be able to answer a few questions 
about compiling Moses on ARM architectures.


Nick

On 11/27/2012 07:32 AM, Le Truong Vinh Phu wrote:

Hi MG Jang,

I'm not sure there is a way to port moses decoder to run on Android, 
but I'm curious, why do you need to do that at the first place?


In my opinion, decoding is quite a heavy task, time and memory 
consuming that I'm not sure if an Android device is able to handle. So 
far the translation apps I've seen follow the client-server model, 
where the decoding takes place on server side.


Maybe your task is supposed to be extremely light-weight?

LTVP

On Nov 27, 2012, at 1:47 PM, myounggun jang > wrote:



I'm trying to port the moses decoder for android
I'll make tables in linux system. and then I just use it in android 
system. I just need to port moses decoder.
I'm trying to find article about moses android porting. however I 
didn't find useful article.
I found data for android 
http://www.mail-archive.com/moses-support@mit.edu/msg06392.html

however there are missing parts.
is there any aticle or some ported source for android and ios?
Thanks in advance.
MG Jang
___
Moses-support mailing list
Moses-support@mit.edu 
http://mailman.mit.edu/mailman/listinfo/moses-support



___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


Re: [Moses-support] mosese decoder android and ios porting

2012-11-26 Thread Le Truong Vinh Phu
Hi MG Jang,I'm not sure there is a way to port moses decoder to run on Android, but I'm curious, why do you need to do that at the first place?In my opinion, decoding is quite a heavy task, time and memory consuming that I'm not sure if an Android device is able to handle. So far the translation apps I've seen follow the client-server model, where the decoding takes place on server side.Maybe your task is supposed to be extremely light-weight?LTVPOn Nov 27, 2012, at 1:47 PM, myounggun jang  wrote:I'm trying to port the moses decoder for androidI'll make tables in linux system. and then I just use it in android system. I just need to port moses decoder. I'm trying to find article about moses android porting. however I didn't find useful article.
 I found data for android http://www.mail-archive.com/moses-support@mit.edu/msg06392.htmlhowever there are missing parts.
is there any aticle or some ported source for android and ios? Thanks in advance. MG Jang
___Moses-support mailing listMoses-support@mit.eduhttp://mailman.mit.edu/mailman/listinfo/moses-support___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support


[Moses-support] mosese decoder android and ios porting

2012-11-26 Thread myounggun jang
I'm trying to port the moses decoder for android
I'll make tables in linux system. and then I just use it in android system.
I just need to port moses decoder.

I'm trying to find article about moses android porting. however I didn't
find useful article.

I found data for android
http://www.mail-archive.com/moses-support@mit.edu/msg06392.html
however there are missing parts.
is there any aticle or some ported source for android and ios?

Thanks in advance.

MG Jang
___
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support