Unverified Commit 76906372 authored by Thomas Wolf's avatar Thomas Wolf Committed by GitHub
Browse files

Merge pull request #378 from huggingface/absolute_imports

Add absolute imports to GPT, GPT-2, Transfo-XL and and fix empty nbest_predictions.json
parents eecaaa73 a98dfe4c
...@@ -620,7 +620,7 @@ def write_predictions(all_examples, all_features, all_results, n_best_size, ...@@ -620,7 +620,7 @@ def write_predictions(all_examples, all_features, all_results, n_best_size,
all_predictions[example.qas_id] = "" all_predictions[example.qas_id] = ""
else: else:
all_predictions[example.qas_id] = best_non_null_entry.text all_predictions[example.qas_id] = best_non_null_entry.text
all_nbest_json[example.qas_id] = nbest_json all_nbest_json[example.qas_id] = nbest_json
with open(output_prediction_file, "w") as writer: with open(output_prediction_file, "w") as writer:
writer.write(json.dumps(all_predictions, indent=4) + "\n") writer.write(json.dumps(all_predictions, indent=4) + "\n")
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
# limitations under the License. # limitations under the License.
"""PyTorch OpenAI GPT-2 model.""" """PyTorch OpenAI GPT-2 model."""
from __future__ import absolute_import, division, print_function, unicode_literals
import collections import collections
import copy import copy
import json import json
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
# limitations under the License. # limitations under the License.
"""PyTorch OpenAI GPT model.""" """PyTorch OpenAI GPT model."""
from __future__ import absolute_import, division, print_function, unicode_literals
import collections import collections
import copy import copy
import json import json
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
In particular https://github.com/kimiyoung/transformer-xl/blob/master/pytorch/mem_transformer.py In particular https://github.com/kimiyoung/transformer-xl/blob/master/pytorch/mem_transformer.py
""" """
from __future__ import absolute_import, division, print_function, unicode_literals
import os import os
import copy import copy
import json import json
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment