Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Data Generator
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
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
Data Generator
Merge requests
!85
Remove 'split' command
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Remove 'split' command
split-remove-command
into
master
Overview
0
Commits
2
Pipelines
2
Changes
8
Merged
Manon Blanco
requested to merge
split-remove-command
into
master
1 year ago
Overview
0
Commits
2
Pipelines
2
Changes
5
Expand
Refs
#51 (closed)
0
0
Merge request reports
Compare
version 1
version 1
bb5b087f
1 year ago
master (base)
and
latest version
latest version
c2006a3d
2 commits,
1 year ago
version 1
bb5b087f
1 commit,
1 year ago
Show latest version
5 files
+
2
−
30
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
atr_data_generator/split/__init__.py
+
0
−
56
Options
# -*- coding: utf-8 -*-
"""
Split dataset
"""
from
pathlib
import
Path
from
teklia_toolbox.config
import
ConfigParser
from
atr_data_generator.arguments
import
CommonArgs
from
atr_data_generator.split.arguments
import
SplitArgs
from
atr_data_generator.split.main
import
main
def
add_split_subparser
(
subcommands
):
parser
=
subcommands
.
add_parser
(
"
split
"
,
description
=
__doc__
,
help
=
__doc__
,
)
parser
.
add_argument
(
"
--config
"
,
type
=
Path
,
help
=
"
Configuration file
"
)
parser
.
set_defaults
(
func
=
main
,
config_parser
=
config_parser
)
def
get_parser
():
parser
=
ConfigParser
()
# Common
common
=
parser
.
add_subparser
(
"
common
"
)
common
.
add_option
(
"
dataset_name
"
,
type
=
str
)
common
.
add_option
(
"
output_dir
"
,
type
=
Path
,
default
=
None
)
common
.
add_option
(
"
cache_dir
"
,
type
=
Path
,
default
=
None
)
common
.
add_option
(
"
log_parameters
"
,
type
=
bool
,
default
=
True
)
# Split
split
=
parser
.
add_subparser
(
"
split
"
,
default
=
{})
split
.
add_option
(
"
train_ratio
"
,
type
=
float
,
default
=
0.8
)
split
.
add_option
(
"
val_ratio
"
,
type
=
float
,
default
=
0.1
)
split
.
add_option
(
"
test_ratio
"
,
type
=
float
,
default
=
0.1
)
split
.
add_option
(
"
use_existing_split
"
,
type
=
bool
,
default
=
False
)
return
parser
def
config_parser
(
configuration_path
:
Path
):
"""
Returns parsed
- CommonArgs
- SplitArgs
"""
config_data
=
get_parser
().
parse
(
configuration_path
)
return
{
"
common
"
:
CommonArgs
(
**
config_data
[
"
common
"
]),
"
split
"
:
SplitArgs
(
**
config_data
[
"
split
"
]),
}
Loading