Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Franck Dary
macaon
Commits
764c2fc7
Commit
764c2fc7
authored
5 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Improved error messages in case of trying to use an unknown column
parent
e6ca3164
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
reading_machine/src/BaseConfig.cpp
+4
-1
4 additions, 1 deletion
reading_machine/src/BaseConfig.cpp
reading_machine/src/Config.cpp
+6
-1
6 additions, 1 deletion
reading_machine/src/Config.cpp
trainer/src/Trainer.cpp
+8
-2
8 additions, 2 deletions
trainer/src/Trainer.cpp
with
18 additions
and
4 deletions
reading_machine/src/BaseConfig.cpp
+
4
−
1
View file @
764c2fc7
...
@@ -166,7 +166,10 @@ std::size_t BaseConfig::getNbColumns() const
...
@@ -166,7 +166,10 @@ std::size_t BaseConfig::getNbColumns() const
std
::
size_t
BaseConfig
::
getColIndex
(
const
std
::
string
&
colName
)
const
std
::
size_t
BaseConfig
::
getColIndex
(
const
std
::
string
&
colName
)
const
{
{
return
colName2Index
.
at
(
colName
);
auto
it
=
colName2Index
.
find
(
colName
);
if
(
it
==
colName2Index
.
end
())
util
::
myThrow
(
fmt
::
format
(
"unknown column name '{}'"
,
colName
));
return
it
->
second
;
}
}
bool
BaseConfig
::
hasColIndex
(
const
std
::
string
&
colName
)
const
bool
BaseConfig
::
hasColIndex
(
const
std
::
string
&
colName
)
const
...
...
This diff is collapsed.
Click to expand it.
reading_machine/src/Config.cpp
+
6
−
1
View file @
764c2fc7
...
@@ -476,7 +476,12 @@ bool Config::stateIsDone() const
...
@@ -476,7 +476,12 @@ bool Config::stateIsDone() const
void
Config
::
addPredicted
(
const
std
::
set
<
std
::
string
>
&
predicted
)
void
Config
::
addPredicted
(
const
std
::
set
<
std
::
string
>
&
predicted
)
{
{
this
->
predicted
.
insert
(
predicted
.
begin
(),
predicted
.
end
());
for
(
auto
&
col
:
predicted
)
{
if
(
!
hasColIndex
(
col
))
util
::
myThrow
(
fmt
::
format
(
"unknown column '{}'"
,
col
));
this
->
predicted
.
insert
(
col
);
}
}
}
bool
Config
::
isPredicted
(
const
std
::
string
&
colName
)
const
bool
Config
::
isPredicted
(
const
std
::
string
&
colName
)
const
...
...
This diff is collapsed.
Click to expand it.
trainer/src/Trainer.cpp
+
8
−
2
View file @
764c2fc7
...
@@ -25,8 +25,14 @@ void Trainer::createDataset(SubConfig & config, bool debug)
...
@@ -25,8 +25,14 @@ void Trainer::createDataset(SubConfig & config, bool debug)
util
::
myThrow
(
"No transition appliable !"
);
util
::
myThrow
(
"No transition appliable !"
);
}
}
try
{
auto
context
=
machine
.
getClassifier
()
->
getNN
()
->
extractContext
(
config
,
machine
.
getDict
(
config
.
getState
()));
auto
context
=
machine
.
getClassifier
()
->
getNN
()
->
extractContext
(
config
,
machine
.
getDict
(
config
.
getState
()));
contexts
.
emplace_back
(
torch
::
from_blob
(
context
.
data
(),
{(
long
)
context
.
size
()},
torch
::
TensorOptions
(
at
::
kLong
)).
clone
().
to
(
NeuralNetworkImpl
::
device
));
contexts
.
emplace_back
(
torch
::
from_blob
(
context
.
data
(),
{(
long
)
context
.
size
()},
torch
::
TensorOptions
(
at
::
kLong
)).
clone
().
to
(
NeuralNetworkImpl
::
device
));
}
catch
(
std
::
exception
&
e
)
{
util
::
myThrow
(
fmt
::
format
(
"Failed to extract context : {}"
,
e
.
what
()));
}
int
goldIndex
=
machine
.
getTransitionSet
().
getTransitionIndex
(
transition
);
int
goldIndex
=
machine
.
getTransitionSet
().
getTransitionIndex
(
transition
);
auto
gold
=
torch
::
zeros
(
1
,
torch
::
TensorOptions
(
at
::
kLong
).
device
(
NeuralNetworkImpl
::
device
));
auto
gold
=
torch
::
zeros
(
1
,
torch
::
TensorOptions
(
at
::
kLong
).
device
(
NeuralNetworkImpl
::
device
));
...
...
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