Skip to content

Commit

Permalink
修复了过采样bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuansen committed Mar 29, 2023
1 parent d57c24f commit 9a22c2c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
6 changes: 1 addition & 5 deletions configs/debug_configs/dev_tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
"NER": [
{"sampling strategy": "random", "dataset name": "conll2003"}
]
}




}
4 changes: 1 addition & 3 deletions configs/debug_configs/test_tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
"dataset name": "ACE05_coarse-grained"
}
]
}


}
6 changes: 1 addition & 5 deletions configs/debug_configs/train_tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@
"dataset name": "ACE05_coarse-grained"
}
]
}




}
2 changes: 1 addition & 1 deletion src/uie_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def _sampling_dataset(self, instances, sampling_strategy, max_num_instances):
if sampling_strategy == 'random' and max_num_instances is not None and max_num_instances >= 0:
instances = instances[:max_num_instances]
if max_num_instances!=None and self.config.over_sampling and len(instances) < max_num_instances:
origin_instances = instances
origin_instances = instances.copy()
while len(instances) < max_num_instances:
instances.append(random.choice(origin_instances))

Expand Down

0 comments on commit 9a22c2c

Please sign in to comment.