Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pipelines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pipelines
Commits
38860b21
Commit
38860b21
authored
5 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Allowed to set the argument dask.bag.Bag.partition_size
parent
6d4994a8
No related branches found
No related tags found
1 merge request
!31
Make a sampleset work transparently with list of DelayedSamples
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/pipelines/wrappers.py
+9
-4
9 additions, 4 deletions
bob/pipelines/wrappers.py
with
9 additions
and
4 deletions
bob/pipelines/wrappers.py
+
9
−
4
View file @
38860b21
...
@@ -216,12 +216,13 @@ class CheckpointWrapper(BaseWrapper, TransformerMixin):
...
@@ -216,12 +216,13 @@ class CheckpointWrapper(BaseWrapper, TransformerMixin):
features
,
com_feat_index
=
[],
0
features
,
com_feat_index
=
[],
0
for
s
,
p
,
should_compute
in
zip
(
samples
,
paths
,
should_compute_list
):
for
s
,
p
,
should_compute
in
zip
(
samples
,
paths
,
should_compute_list
):
if
should_compute
:
if
should_compute
:
feat
=
computed_features
[
com_feat_index
]
feat
=
computed_features
[
com_feat_index
]
features
.
append
(
feat
)
com_feat_index
+=
1
com_feat_index
+=
1
# save the computed feature
# save the computed feature
if
p
is
not
None
:
if
p
is
not
None
:
self
.
save
(
feat
)
self
.
save
(
feat
)
feat
=
self
.
load
(
s
,
p
)
features
.
append
(
feat
)
else
:
else
:
features
.
append
(
self
.
load
(
s
,
p
))
features
.
append
(
self
.
load
(
s
,
p
))
return
features
return
features
...
@@ -398,16 +399,20 @@ class ToDaskBag(TransformerMixin, BaseEstimator):
...
@@ -398,16 +399,20 @@ class ToDaskBag(TransformerMixin, BaseEstimator):
Number
of
partitions
used
in
:
any
:
`dask.bag.from_sequence`
Number
of
partitions
used
in
:
any
:
`dask.bag.from_sequence`
"""
"""
def
__init__
(
self
,
npartitions
=
None
,
**
kwargs
):
def
__init__
(
self
,
npartitions
=
None
,
partition_size
=
None
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
super
().
__init__
(
**
kwargs
)
self
.
npartitions
=
npartitions
self
.
npartitions
=
npartitions
self
.
partition_size
=
partition_size
def
fit
(
self
,
X
,
y
=
None
):
def
fit
(
self
,
X
,
y
=
None
):
return
self
return
self
def
transform
(
self
,
X
):
def
transform
(
self
,
X
):
logger
.
debug
(
f
"
{
_frmt
(
self
)
}
.transform
"
)
logger
.
debug
(
f
"
{
_frmt
(
self
)
}
.transform
"
)
return
dask
.
bag
.
from_sequence
(
X
,
npartitions
=
self
.
npartitions
)
if
self
.
partition_size
is
None
:
return
dask
.
bag
.
from_sequence
(
X
,
npartitions
=
self
.
npartitions
)
else
:
return
dask
.
bag
.
from_sequence
(
X
,
partition_size
=
self
.
partition_size
)
def
_more_tags
(
self
):
def
_more_tags
(
self
):
return
{
"
stateless
"
:
True
,
"
requires_fit
"
:
False
}
return
{
"
stateless
"
:
True
,
"
requires_fit
"
:
False
}
...
...
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