mirror of
https://github.com/wassname/pytorch-transformer-ts.git
synced 2026-08-19 12:30:44 +08:00
make samplers configurable
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "8dc0844c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -99,6 +99,7 @@
|
||||
" TestSplitSampler,\n",
|
||||
" ExpectedNumInstanceSampler,\n",
|
||||
" SelectFields,\n",
|
||||
" InstanceSampler,\n",
|
||||
")\n",
|
||||
"from gluonts.torch.util import (\n",
|
||||
" IterableDataset,\n",
|
||||
@@ -345,6 +346,8 @@
|
||||
" batch_size: int = 32,\n",
|
||||
" num_batches_per_epoch: int = 50,\n",
|
||||
" trainer_kwargs: Optional[Dict[str, Any]] = dict(),\n",
|
||||
" train_sampler: Optional[InstanceSampler] = None,\n",
|
||||
" validation_sampler: Optional[InstanceSampler] = None,\n",
|
||||
" ) -> None:\n",
|
||||
" trainer_kwargs = {\n",
|
||||
" \"max_epochs\": 100,\n",
|
||||
@@ -381,10 +384,10 @@
|
||||
" self.batch_size = batch_size\n",
|
||||
" self.num_batches_per_epoch = num_batches_per_epoch\n",
|
||||
"\n",
|
||||
" self.train_sampler = ExpectedNumInstanceSampler(\n",
|
||||
" self.train_sampler = train_sampler or ExpectedNumInstanceSampler(\n",
|
||||
" num_instances=1.0, min_future=prediction_length\n",
|
||||
" )\n",
|
||||
" self.validation_sampler = ValidationSplitSampler(\n",
|
||||
" self.validation_sampler = validation_sampler or ValidationSplitSampler(\n",
|
||||
" min_future=prediction_length\n",
|
||||
" )\n",
|
||||
" \n",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "bc1a0f32",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -56,6 +56,7 @@
|
||||
" TestSplitSampler,\n",
|
||||
" ExpectedNumInstanceSampler,\n",
|
||||
" SelectFields,\n",
|
||||
" InstanceSampler,\n",
|
||||
")\n",
|
||||
"from gluonts.torch.util import (\n",
|
||||
" IterableDataset,\n",
|
||||
@@ -570,6 +571,8 @@
|
||||
" batch_size: int = 32,\n",
|
||||
" num_batches_per_epoch: int = 50,\n",
|
||||
" trainer_kwargs: Optional[Dict[str, Any]] = dict(),\n",
|
||||
" train_sampler: Optional[InstanceSampler] = None,\n",
|
||||
" validation_sampler: Optional[InstanceSampler] = None,\n",
|
||||
" ) -> None:\n",
|
||||
" trainer_kwargs = {\n",
|
||||
" \"max_epochs\": 100,\n",
|
||||
@@ -612,10 +615,10 @@
|
||||
" self.batch_size = batch_size\n",
|
||||
" self.num_batches_per_epoch = num_batches_per_epoch\n",
|
||||
"\n",
|
||||
" self.train_sampler = ExpectedNumInstanceSampler(\n",
|
||||
" self.train_sampler = train_sampler or ExpectedNumInstanceSampler(\n",
|
||||
" num_instances=1.0, min_future=prediction_length\n",
|
||||
" )\n",
|
||||
" self.validation_sampler = ValidationSplitSampler(\n",
|
||||
" self.validation_sampler = validation_sampler or ValidationSplitSampler(\n",
|
||||
" min_future=prediction_length\n",
|
||||
" )\n",
|
||||
" \n",
|
||||
@@ -1002,7 +1005,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.9"
|
||||
"version": "3.9.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user