mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-27 03:49:57 +03:00
Global scope for VW training.
This commit is contained in:
parent
14d7df229f
commit
5282ad667c
@ -51,12 +51,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "hypergraph.pb.h"
|
||||
#endif
|
||||
|
||||
#ifdef PT_UG
|
||||
#include <boost/foreach.hpp>
|
||||
#include "moses/TranslationModel/UG/mmsapt.h"
|
||||
#include "moses/TranslationModel/UG/generic/program_options/ug_splice_arglist.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace Moses;
|
||||
|
||||
@ -76,6 +70,9 @@ void OutputFeatureWeightsForHypergraph(std::ostream &outputSearchGraphStream)
|
||||
/** main function of the command line version of the decoder **/
|
||||
int main(int argc, char const** argv)
|
||||
{
|
||||
//setting in the Staticdata a link between the thread id of this process and a NULL tasksptr
|
||||
// StaticData::InstanceNonConst().SetTask(); // => moved into StaticData constructor
|
||||
|
||||
try {
|
||||
|
||||
#ifdef HAVE_PROTOBUF
|
||||
@ -141,11 +138,13 @@ int main(int argc, char const** argv)
|
||||
}
|
||||
|
||||
#ifdef WITH_THREADS
|
||||
#pragma message ("Compiling with Threads.")
|
||||
ThreadPool pool(staticData.ThreadCount());
|
||||
#endif
|
||||
|
||||
// main loop over set of input sentences
|
||||
|
||||
boost::shared_ptr<ContextScope> scope(new ContextScope);
|
||||
boost::shared_ptr<InputType> source;
|
||||
while ((source = ioWrapper->ReadInput()) != NULL) {
|
||||
IFVERBOSE(1) {
|
||||
@ -154,7 +153,7 @@ int main(int argc, char const** argv)
|
||||
|
||||
// set up task of training one sentence
|
||||
boost::shared_ptr<TrainingTask> task;
|
||||
task = TrainingTask::create(source, ioWrapper);
|
||||
task = TrainingTask::create(source, ioWrapper, scope);
|
||||
|
||||
// execute task
|
||||
#ifdef WITH_THREADS
|
||||
|
@ -39,6 +39,18 @@ public:
|
||||
boost::shared_ptr<IOWrapper> const& ioWrapper) {
|
||||
boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, ioWrapper));
|
||||
ret->m_self = ret;
|
||||
ret->m_scope.reset(new ContextScope);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// factory function
|
||||
static boost::shared_ptr<TrainingTask>
|
||||
create(boost::shared_ptr<InputType> const& source,
|
||||
boost::shared_ptr<IOWrapper> const& ioWrapper,
|
||||
boost::shared_ptr<ContextScope> const& scope) {
|
||||
boost::shared_ptr<TrainingTask> ret(new TrainingTask(source, ioWrapper));
|
||||
ret->m_self = ret;
|
||||
ret->m_scope = scope;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user