Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Server Moses dim yn gweithio ar y Pi / Moses Python Server doesn't work on the Pi #6

Open
techiaith opened this issue Mar 21, 2016 · 4 comments

Comments

@techiaith
Copy link
Collaborator

Ar ol adeiladu i'r Pi,

Mewn un ffenest teipio (Ffenestr A):

moses@raspberrypi ~/moses-smt $ python moses.py fetchengine -e Meddalwedd -s en -t cy
moses@raspberrypi ~/moses-smt $ python moses.py start -e Meddalwedd -s en -t cy

Mewn ffenestr arall (Ffenestr B):

moses@raspberrypi ~ $ curl "http://127.0.0.1:8008/translate?q=View+Documents"

yn rhoi'r adroddiad wall yn Ffenestr A:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "python-server.py", line 174, in translate
    result = self._translate(tokenized_src)
  File "python-server.py", line 149, in _translate
    return proxy.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 1292, in single_request
    self.send_content(h, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1439, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python2.7/httplib.py", line 958, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 818, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 780, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 761, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 111] Connection refused
[21/Mar/2016:11:14:04] HTTP
Request Headers:
  HOST: 127.0.0.1:8008
  Remote-Addr: 127.0.0.1
  ACCEPT: */*
  USER-AGENT: curl/7.26.0
@pjrobertson
Copy link

Mae hyn oherwydd di’r python server methu cysylltu â’r gweinydd Moses. Mae’n cael ‘connection refused’ wrth trio neud y galwad xmlrpc

On 21 Mawrth 2016, at 19:35, Uned Technolegau Iaith [email protected] wrote:

Ar ol adeiladu i'r Pi,

Mewn un ffenest teipio (Ffenestr A):

moses@raspberrypi ~/moses-smt $ python moses.py fetchengine -e Meddalwedd -s en -t cy
moses@raspberrypi ~/moses-smt $ python moses.py start -e Meddalwedd -s en -t cy
Mewn ffenestr arall (Ffenestr B):

moses@raspberrypi ~ $ curl "http://127.0.0.1:8008/translate?q=View+Documents"
yn rhoi'r adroddiad wall yn Ffenestr A:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in call
self.body = self.oldhandler(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 60, in call
return self.callable(_self.args, *_self.kwargs)
File "python-server.py", line 174, in translate
result = self._translate(tokenized_src)
File "python-server.py", line 149, in _translate
return proxy.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 1292, in single_request
self.send_content(h, request_body)
File "/usr/lib/python2.7/xmlrpclib.py", line 1439, in send_content
connection.endheaders(request_body)
File "/usr/lib/python2.7/httplib.py", line 958, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 818, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 780, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 761, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused
[21/Mar/2016:11:14:04] HTTP
Request Headers:
HOST: 127.0.0.1:8008
Remote-Addr: 127.0.0.1
ACCEPT: /
USER-AGENT: curl/7.26.0

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub #6

@techiaith
Copy link
Collaborator Author

python python-server.py -pretty -verbose 1 -port 8008 -ip 127.0.0.1 -slang en -tlang cy -mosesurl http://127.0.0.1:8080/RPC2 -recaserurl http://127.0.0.1:8081/RPC2 -moseshome /home/moses

ond dydy moseserver ar port 8080 ddim yn redeg . Hmm.

@techiaith
Copy link
Collaborator Author

Wrth i mosesserver cychwyn (gyda'r model Meddalwedd) :

/home/moses/mosesdecoder/bin/mosesserver -f /home/moses/moses-models/Meddalwedd/en-cy/engine/model/moses.ini --server-port 8080
Defined parameters (per moses.ini or switch):
        config: /home/moses/moses-models/Meddalwedd/en-cy/engine/model/moses.ini
        distortion-limit: 6
        feature: UnknownWordPenalty WordPenalty PhrasePenalty PhraseDictionaryCompact name=TranslationModel0 num-features=4 path=/home/moses/moses-models/Meddalwedd/en-cy/engine/model/phrase-table.minphr input-factor=0 output-factor=0 LexicalReordering name=LexicalReordering0 num-features=6 type=wbe-msd-bidirectional-fe-allff input-factor=0 output-factor=0 path=/home/moses/moses-models/Meddalwedd/en-cy/engine/model/reordering-table.wbe-msd-bidirectional-fe Distortion KENLM lazyken=0 name=LM0 factor=0 path=/home/moses/moses-models/Meddalwedd/lm/Meddalwedd.blm.cy order=3
        input-factors: 0
        mapping: 0 T 0
        weight: UnknownWordPenalty0= 1 WordPenalty0= -1 PhrasePenalty0= 0.2 TranslationModel0= 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
line=UnknownWordPenalty
FeatureFunction: UnknownWordPenalty0 start: 0 end: 0
line=WordPenalty
FeatureFunction: WordPenalty0 start: 1 end: 1
line=PhrasePenalty
FeatureFunction: PhrasePenalty0 start: 2 end: 2
line=PhraseDictionaryCompact name=TranslationModel0 num-features=4 path=/home/moses/moses-models/Meddalwedd/en-cy/engine/model/phrase-table.minphr input-factor=0 output-factor=0
FeatureFunction: TranslationModel0 start: 3 end: 6
line=LexicalReordering name=LexicalReordering0 num-features=6 type=wbe-msd-bidirectional-fe-allff input-factor=0 output-factor=0 path=/home/moses/moses-models/Meddalwedd/en-cy/engine/model/reordering-table.wbe-msd-bidirectional-fe
FeatureFunction: LexicalReordering0 start: 7 end: 12
Initializing LexicalReordering..
line=Distortion
FeatureFunction: Distortion0 start: 13 end: 13
line=KENLM lazyken=0 name=LM0 factor=0 path=/home/moses/moses-models/Meddalwedd/lm/Meddalwedd.blm.cy order=3
FeatureFunction: LM0 start: 14 end: 14
Loading UnknownWordPenalty0
Loading WordPenalty0
Loading PhrasePenalty0
Loading LexicalReordering0
binary file loaded, default OFF_T: -1
Loading Distortion0
Loading LM0
Loading TranslationModel0
terminate called after throwing an instance of 'std::length_error'
  what():  vector::_M_fill_insert
Aborted

@techiaith
Copy link
Collaborator Author

Model binary ar beiriant x86_64 mae'n rhaid ddim yn gweithio ar CPU arch y Pi.

Mae'r weinydd yn gweithio! :) OS ti'n hyfforddi ar y Pi (gyda corpws cyfochrog bach, fel Meddalwedd) hefyd i greu fersiynau lleol o'r modelau ar ffurf ffeiliau binary.

Felly, os ti'n gwneud:

moses@raspberrypi ~/moses-smt $ python moses.py fetchcorpus -e Meddalwedd
moses@raspberrypi ~/moses-smt $ python moses.py train -e Meddalwedd -s en -t cy
moses@raspberrypi ~/moses-smt $ python moses.py start -e Meddalwedd -s en -t cy

Mewn un ffenestr. Ac yna mewn ail-ffenestr:

moses@raspberrypi ~ $ curl http://localhost:8008/translate?q=View+Documents
{ "data": { "translations": [ { "translatedText": "Gweld dogfennau" } ] } }
moses@raspberrypi ~ $

Ieii :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant