Browse Source

add this feature totally for yh

tags/v0.2.0^2
yunfan 6 years ago
parent
commit
1421b7dfba
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      fastNLP/core/dataset.py

+ 10
- 0
fastNLP/core/dataset.py View File

@@ -1,3 +1,4 @@
import _pickle as pickle
import numpy as np

from fastNLP.core.fieldarray import FieldArray
@@ -317,3 +318,12 @@ class DataSet(object):
for header, content in zip(headers, contents):
_dict[header].append(content)
return cls(_dict)

def save(self, path):
with open(path, 'wb') as f:
pickle.dump(self, f)

@staticmethod
def load(self, path):
with open(path, 'rb') as f:
return pickle.load(f)

Loading…
Cancel
Save