      if to_read_nlp:
          print("reading from", NLP_2_DIR)
          nlp_3 = spacy.load(NLP_2_DIR)
  
          if test_from_file:
              dev_limit = 5000
              dev_data = training_set_creator.read_training(nlp=nlp_3,
                                                            training_dir=TRAINING_DIR,
                                                            dev=True,
                                                            limit=dev_limit)
  
              print("Dev testing from file on", len(dev_data), "articles")
              print()
  
              dev_acc_combo, dev_acc_combo_dict = _measure_accuracy(dev_data)
 
</s> remove             print("Dev testing from file on", len(dev_data), "articles")
            print()
 </s> add     # testing performance with an NLP model from file
    if test_from_file:
        nlp_2 = spacy.load(NLP_1_DIR)
        nlp_3 = spacy.load(NLP_2_DIR)
        el_pipe = nlp_3.get_pipe("entity_linker") </s> remove             dev_acc_combo, dev_acc_combo_dict = _measure_accuracy(dev_data)
            print("dev acc combo avg:", round(dev_acc_combo, 3),
                  [(x, round(y, 3)) for x, y in dev_acc_combo_dict.items()])
        else:
            print("running toy example with NLP 3")
            run_el_toy_example(nlp=nlp_3)
 </s> add         dev_limit = 10000
        dev_data = training_set_creator.read_training(nlp=nlp_2,
                                                      training_dir=TRAINING_DIR,
                                                      dev=True,
                                                      limit=dev_limit)

        print("Dev testing from file on", len(dev_data), "articles")
        print()

        dev_acc_combo, dev_acc_combo_dict = _measure_accuracy(dev_data, el_pipe=el_pipe)
        print("dev acc combo avg:", round(dev_acc_combo, 3),
              [(x, round(y, 3)) for x, y in dev_acc_combo_dict.items()]) </s> remove                 context_encoding = self.model([doc])
                context_enc_t = np.transpose(context_encoding)
 </s> add                 context_encoding = context_encodings[i]
                context_enc_t = context_encoding.T
                norm_1 = xp.linalg.norm(context_enc_t) </s> remove             entity_encodings = np.asarray(entity_encodings, dtype=np.float32)
 </s> add             entity_encodings = self.model.ops.asarray(entity_encodings, dtype="float32")
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
      if to_read_nlp:
          print("reading from", NLP_2_DIR)
          nlp_3 = spacy.load(NLP_2_DIR)
  
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
        print("running toy example with NLP 3")
        run_el_toy_example(nlp=nlp_3)
  
              print("Dev testing from file on", len(dev_data), "articles")
              print()
  
              dev_acc_combo, dev_acc_combo_dict = _measure_accuracy(dev_data)
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 improve speed of prediction loop 
examples/pipeline/wikidata_entity_linking.py