Program: 52656
Project: 52656
Buggy source:
/** 
 * Trains a model for the input with given arguments, returns a FastText instance. Input can be a text corpus, or a corpus with text and labels.
 */
public FastText train(Path input,Args args_) throws Exception {
  Dictionary dict_=Dictionary.readFromFile(input,args_);
  Matrix input_=null;
  if (args_.pretrainedVectors.length() != 0) {
  }
 else {
    input_=new Matrix(dict_.nwords() + args_.bucket,args_.dim);
    input_.uniform(1.0f / args_.dim);
  }
  Matrix output_;
  if (args_.model == Args.model_name.supervised) {
    output_=new Matrix(dict_.nlabels(),args_.dim);
  }
 else {
    output_=new Matrix(dict_.nwords(),args_.dim);
  }
  Model model_=new Model(input_,output_,args_,0);
  if (args_.model == Args.model_name.supervised) {
    model_.setTargetCounts(dict_.getCounts(Dictionary.TYPE_LABEL));
  }
 else {
    model_.setTargetCounts(dict_.getCounts(Dictionary.TYPE_WORD));
  }
  Stopwatch stopwatch=Stopwatch.createStarted();
  AtomicLong tokenCount=new AtomicLong(0);
  ExecutorService es=Executors.newFixedThreadPool(args_.thread);
  CompletionService<Model> completionService=new ExecutorCompletionService<>(es);
  long charCount=TextIO.charCount(input,StandardCharsets.UTF_8);
  Log.info("String_Node_Str");
  Stopwatch sw=Stopwatch.createStarted();
  for (int i=0; i < args_.thread; i++) {
    Model threadModel=new Model(model_,i);
    completionService.submit(new TrainTask(i,input,(int)(i * charCount / args_.thread),threadModel,stopwatch,dict_,args_,tokenCount));
  }
  es.shutdown();
  int c=0;
  while (c < args_.thread) {
    completionService.take().get();
    c++;
  }
  Log.info("String_Node_Str",sw.elapsed(TimeUnit.MILLISECONDS) / 1000d);
  return new FastText(args_,dict_,model_);
}

Fixed version (ground truth):
/** 
 * Trains a model for the input with given arguments, returns a FastText instance. Input can be a text corpus, or a corpus with text and labels.
 */
public FastText train(Path input) throws Exception {
  Dictionary dict_=Dictionary.readFromFile(input,args_);
  Matrix input_=null;
  if (args_.pretrainedVectors.length() != 0) {
  }
 else {
    input_=new Matrix(dict_.nwords() + args_.bucket,args_.dim);
    input_.uniform(1.0f / args_.dim);
  }
  Matrix output_;
  if (args_.model == Args.model_name.supervised) {
    output_=new Matrix(dict_.nlabels(),args_.dim);
  }
 else {
    output_=new Matrix(dict_.nwords(),args_.dim);
  }
  Model model_=new Model(input_,output_,args_,0);
  if (args_.model == Args.model_name.supervised) {
    model_.setTargetCounts(dict_.getCounts(Dictionary.TYPE_LABEL));
  }
 else {
    model_.setTargetCounts(dict_.getCounts(Dictionary.TYPE_WORD));
  }
  Stopwatch stopwatch=Stopwatch.createStarted();
  AtomicLong tokenCount=new AtomicLong(0);
  ExecutorService es=Executors.newFixedThreadPool(args_.thread);
  CompletionService<Model> completionService=new ExecutorCompletionService<>(es);
  long charCount=TextIO.charCount(input,StandardCharsets.UTF_8);
  Log.info("String_Node_Str");
  Stopwatch sw=Stopwatch.createStarted();
  for (int i=0; i < args_.thread; i++) {
    Model threadModel=new Model(model_,i);
    completionService.submit(new TrainTask(i,input,(int)(i * charCount / args_.thread),threadModel,stopwatch,dict_,args_,tokenCount));
  }
  es.shutdown();
  int c=0;
  while (c < args_.thread) {
    completionService.take().get();
    c++;
  }
  Log.info("String_Node_Str",sw.elapsed(TimeUnit.MILLISECONDS) / 1000d);
  return new FastText(args_,dict_,model_);
}