Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SwissArmyTransformer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
thukeg
SwissArmyTransformer
Commits
16378f14
Commit
16378f14
authored
3 years ago
by
zhuoyiyang
Browse files
Options
Downloads
Patches
Plain Diff
change to RandomMapping
parent
a36b9ca3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
data_utils/configure_data.py
+2
-2
2 additions, 2 deletions
data_utils/configure_data.py
with
2 additions
and
2 deletions
data_utils/configure_data.py
+
2
−
2
View file @
16378f14
...
...
@@ -205,7 +205,7 @@ def split_ds(ds, split=[.8,.2,.0], block_size = 10000):
residual_idx
+=
proportion
%
1
split_
=
int
(
int
(
proportion
)
+
residual_idx
)
rtn_ds
[
i
]
=
BlockedRandomSplitDataset
(
ds
,
indices
[
range
(
start_idx
,
start_idx
+
max
(
split_
,
1
))],
block_size
)
rtn_ds
[
i
]
=
Enlarged
Dataset
(
rtn_ds
[
i
])
rtn_ds
[
i
]
=
RandomMapping
Dataset
(
rtn_ds
[
i
])
start_idx
+=
split_
residual_idx
%=
1
return
rtn_ds
...
...
@@ -308,7 +308,7 @@ class BlockedRandomSplitDataset(data.Dataset):
return
self
.
len
def
__getitem__
(
self
,
index
):
return
self
.
wrapped_data
[(
index
//
len
(
self
.
indices
))
*
self
.
block_size
+
self
.
indices
[
index
%
self
.
block_size
]]
return
self
.
wrapped_data
[(
index
//
len
(
self
.
indices
))
*
self
.
block_size
+
self
.
indices
[
index
%
len
(
self
.
indices
)
]]
class
EnlargedDataset
(
data
.
Dataset
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment