Re: [Moses-support] problem with weighting translation models using client_multimodel.py

2014-01-02 Thread Rico Sennrich
Hi Alexander

The server still had a stupid/broken assumption that the MultiModel 
phrase table would be first in the config. I updated the code that it is 
now specified by name by the client. This call should work for you (with 
the newest moses commit):

translate(['i have a dream'],server,[0.1,0.2], PhraseDictionaryMultiModel0)



On a related note: the phrase table format has recently changed (the 
constant phrase penalty was removed from the table and is now a separate 
feature function). This broke some assumptions in the MultiModel code, 
and it has now been fixed. This may lead to different results if someone 
wants to use the newest decoder, but has phrase tables with the phrase 
penalty (5 features instead of 4). To restore the original results, they 
need to modify their config file as follows:

add PhrasePenalty to the [feature] section and modify the weight section 
as follows:

before:

[weight]
PhraseDictionaryMultiModel0= 0.00402447059454402 0.0685647475075862 
0.294089113124688 0.0328320356515851 -0.0426081987467227

after:

[weight]
PhrasePenalty0= -0.0426081987467227
PhraseDictionaryMultiModel0= 0.00402447059454402 0.0685647475075862 
0.294089113124688 0.0328320356515851 0


best wishes,
Rico

On 27.12.2013 12:02, Калинин Александр wrote:
 Hello, Rico
   
 I am using version 95a41c44facbfe49962b2b28234d0d0a08183032.
 Previously there were not any messages, but after i rebooted the server it 
 started to respond with the following:

 ~/mosesdecoder/contrib/server$ sudo python ./client_multimodel.py
 Traceback (most recent call last):
File ./client_multimodel.py, line 78, in module
  translate(['i have a dream'],server,[0.1,0.9])
File ./client_multimodel.py, line 27, in translate
  print server.translate(params)
File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
  return self.__send(self.__name, args)
File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
  verbose=self.__verbose
File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
  return self.single_request(host, handler, request_body, verbose)
File /usr/lib/python2.7/xmlrpclib.py, line 1297, in single_request
  return self.parse_response(response)
File /usr/lib/python2.7/xmlrpclib.py, line 1473, in parse_response
  return u.close()
File /usr/lib/python2.7/xmlrpclib.py, line 793, in close
  raise Fault(**self._stack[0])
 xmlrpclib.Fault: Fault -500: 'Unexpected error executing code for particular 
 method, detected by Xmlrpc-c method registry code.  Method did not fail; 
 rather, it did not complete at all.  boost::lock_error'

 In case when no weights are given, everything is ok.


 PS The OS is  Ubuntu 12.04.2 LTS

 Best regards!

 25.12.2013, 19:07, Rico Sennrich rico.sennr...@gmx.ch:
 I can't immediately see anything wrong with your config. Can you tell me
 which version (git commit) of Moses you're using, and if there is an
 error message on the side of the moses server?

 It's conceivable that the new phrase table format (with the phrase
 penalty being a separate feature function) doesn't yet work well with
 the MultiModel phrase table; I'll do some tests early next year.

 best wishes,
 Rico

 On 24.12.2013 09:46, Калинин Александр wrote:

   Sorry, I provided you with wrong example:

   When I launch function with string parameter ( translate(['i have a 
 dream'],server,'0.1,0.2') ), it returns an error like that:

 Method did not fail; rather, it did not complete at all.  Not array 
 type.  See type() method'

   But if i use list of floats ( translate(['i have a 
 dream'],server,[0.1,0.2]) ), it remains silent, reporting no error and 
 giving no translation as well.
   When I interrupt the script, it returns such log:

   Traceback (most recent call last):
  File client_multimodel.py, line 78, in module
translate(['i have a dream'],server,[0.2,0.2])
  File client_multimodel.py, line 27, in translate
print server.translate(params)
  File /usr/lib/python2.7/xmlrpclib.py, line 1224, in __call__
return self.__send(self.__name, args)
  File /usr/lib/python2.7/xmlrpclib.py, line 1578, in __request
verbose=self.__verbose
  File /usr/lib/python2.7/xmlrpclib.py, line 1264, in request
return self.single_request(host, handler, request_body, verbose)
  File /usr/lib/python2.7/xmlrpclib.py, line 1294, in single_request
response = h.getresponse(buffering=True)
  File /usr/lib/python2.7/httplib.py, line 1030, in getresponse
response.begin()
  File /usr/lib/python2.7/httplib.py, line 407, in begin
version, status, reason = self._read_status()
  File /usr/lib/python2.7/httplib.py, line 365, in _read_status
line = self.fp.readline()
  File /usr/lib/python2.7/socket.py, line 447, in readline
data = self._sock.recv(self._rbufsize)

   Can you please advice upon where the problem could be?

   Kind regards,
   Alexander Kalinin.

   

[Moses-support] problem with weighting translation models using client_multimodel.py

2013-12-23 Thread Калинин Александр
Hi, everyone!

I have a problem with weighting two translation models using 
client_multimodel.py. When I function like that (with no weights):

translate(['i have a dream'],server)

it's ok - Moses responses me with translation via xmlrpc.

But when I try to add weigts like that 

translate(['i have a dream'],server, '0.1,0.1')

it returns nothing, neither translation nor error report.

Can you please advice upon, what the problem can be and what is the syntax of 
setting weights?

My moses.inin file is the following:

[input-factors]
0

# mapping steps
[mapping]
0 T 2

[distortion-limit]
6

# feature functions
[feature]
UnknownWordPenalty
WordPenalty
PhrasePenalty
PhraseDictionaryMemory table-limit=20 tuneable=false  num-features=4 
path=/home/user/corpora/mem/train/model/phrase-table.gz input-factor=0 
output-factor=0
PhraseDictionaryMemory table-limit=20 tuneable=false  num-features=4 
path=/home/user/corpora/pm/train/model/phrase-table.gz   input-factor=0 
output-factor=0
PhraseDictionaryMultiModel num-features=4 input-factor=0 output-factor=0 
table-limit=20 mode=interpolate lambda=0.2,0.8 
components=PhraseDictionaryMemory0,PhraseDictionaryMemory1
LexicalReordering name=LexicalReordering0 num-features=6 
type=wbe-msd-bidirectional-fe-allff input-factor=0 output-factor=0 
path=/home/user/corpora/mem/train/model/reordering-table.wbe-msd-bidirectional-fe.gz
Distortion
KENLM lazyken=0 name=LM0 factor=0 path=/home/user/corpora/mem/blm.ru order=5

# dense weights for feature functions
[weight]
UnknownWordPenalty0= 1
WordPenalty0= -1
PhrasePenalty0= 0.2
PhraseDictionaryMemory0= 0 0 1 0 
PhraseDictionaryMemory1= 0 0 1 0
PhraseDictionaryMultiModel0= 0.2 0.2 0.2 0.2
LexicalReordering0= 0.3 0.3 0.3 0.3 0.3 0.3
Distortion0= 0.3
LM0= 0.5

Many thanx! Kind regards!

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


Re: [Moses-support] problem with weighting translation models using client_multimodel.py

2013-12-23 Thread Rico Sennrich
Калинин Александр verbalab@... writes:

 
 Hi, everyone!
 
 I have a problem with weighting two translation models using
client_multimodel.py. When I function like
 that (with no weights):
 
 translate(['i have a dream'],server)
 
 it's ok - Moses responses me with translation via xmlrpc.
 
 But when I try to add weigts like that 
 
 translate(['i have a dream'],server, '0.1,0.1')
 
 it returns nothing, neither translation nor error report.

Hi Alexander,

'0.1,0.1' is a string, but the function translate expects a list of floats.
Try this:

translate(['i have a dream'],server, [0.1, 0.1])

Tell me if this works; I'll try to better document the arguments early next
year.

-
Rico

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