lukemelas commited on
Commit
87c9ef8
•
1 Parent(s): 989230c
.gitattributes CHANGED
@@ -27,3 +27,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
  json-files-Jan2016.tar filter=lfs diff=lfs merge=lfs -text
29
  metadata--Jan2016--2021-02-10.feather filter=lfs diff=lfs merge=lfs -text
 
 
 
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
  json-files-Jan2016.tar filter=lfs diff=lfs merge=lfs -text
29
  metadata--Jan2016--2021-02-10.feather filter=lfs diff=lfs merge=lfs -text
30
+ hupd_metadata.csv filter=lfs diff=lfs merge=lfs -text
31
+ metadata--Jan2016--2021-11-07.pkl filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ tmp
test-dataset-debug.py → hupd-subset.py RENAMED
@@ -129,14 +129,14 @@ class Patents(datasets.GeneratorBasedBuilder):
129
  PatentsConfig(
130
  name="sample",
131
  description="Patent data from January 2016, for debugging",
132
- metadata_url="https://huggingface.co/datasets/greeneggsandyaml/test-dataset-debug/resolve/main/metadata--Jan2016--2021-02-10.feather",
133
- data_url="https://huggingface.co/datasets/greeneggsandyaml/test-dataset-debug/resolve/main/json-files-Jan2016.tar",
134
  data_dir="json-files-Jan2016",
135
  ),
136
  PatentsConfig(
137
  name="all",
138
  description="Patent data from January 2016, for debugging",
139
- metadata_url="https://patentdiag.blob.core.windows.net/patent-data/metadata-2021-02-10.feather",
140
  data_url="https://patentdiag.blob.core.windows.net/patent-data/distilled-2021-01-07.tar",
141
  data_dir="distilled",
142
  ),
@@ -164,6 +164,7 @@ class Patents(datasets.GeneratorBasedBuilder):
164
 
165
  # Download metadata
166
  # NOTE: Metadata is stored as a Pandas DataFrame in Apache Feather format
 
167
  metadata_file = dl_manager.download_and_extract(self.config.metadata_url)
168
  print(f'Using metadata file: {metadata_file}')
169
 
@@ -175,7 +176,16 @@ class Patents(datasets.GeneratorBasedBuilder):
175
 
176
  # Load metadata file
177
  print(f'Reading metadata file: {metadata_file}')
178
- df = pd.read_feather(metadata_file)
 
 
 
 
 
 
 
 
 
179
 
180
  # Filter based on ICPR / CPC label
181
  if self.config.ipcr_label:
 
129
  PatentsConfig(
130
  name="sample",
131
  description="Patent data from January 2016, for debugging",
132
+ metadata_url="https://huggingface.co/datasets/HUPD/hupd-subset/resolve/main/metadata--Jan2016--2021-11-07.pkl",
133
+ data_url="https://huggingface.co/datasets/HUPD/hupd-subset/resolve/main/json-files-Jan2016.tar",
134
  data_dir="json-files-Jan2016",
135
  ),
136
  PatentsConfig(
137
  name="all",
138
  description="Patent data from January 2016, for debugging",
139
+ metadata_url="https://patentdiag.blob.core.windows.net/patent-data/metadata-2021-11-07.pkl",
140
  data_url="https://patentdiag.blob.core.windows.net/patent-data/distilled-2021-01-07.tar",
141
  data_dir="distilled",
142
  ),
 
164
 
165
  # Download metadata
166
  # NOTE: Metadata is stored as a Pandas DataFrame in Apache Feather format
167
+ metadata_url = self.config.metadata_url
168
  metadata_file = dl_manager.download_and_extract(self.config.metadata_url)
169
  print(f'Using metadata file: {metadata_file}')
170
 
 
176
 
177
  # Load metadata file
178
  print(f'Reading metadata file: {metadata_file}')
179
+ if metadata_url.endswith('.feather'):
180
+ df = pd.read_feather(metadata_file)
181
+ elif metadata_url.endswith('.csv'):
182
+ df = pd.read_csv(metadata_file)
183
+ elif metadata_url.endswith('.tsv'):
184
+ df = pd.read_csv(metadata_file, delimiter='\t')
185
+ elif metadata_url.endswith('.pickle'):
186
+ df = pd.read_pickle(metadata_file)
187
+ else:
188
+ raise ValueError(f'Metadata file invalid: {metadata_url}')
189
 
190
  # Filter based on ICPR / CPC label
191
  if self.config.ipcr_label:
metadata--Jan2016--2021-02-10.feather → metadata--Jan2016--2021-11-07.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5ce14560b1f610436f0f6810e38b28a71803aa2b995b27220578ed870e8bc620
3
- size 10639266
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ca6d95e51e93d7e6863a9c7ecfc7bec1fca3e8ea43bd117c53e6096059a135e
3
+ size 177811068