Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
CNNArch2X
Commits
0e383f7f
Commit
0e383f7f
authored
Nov 22, 2021
by
Evgeny Kusmenko
Browse files
Merge branch 'conflang-mc5' into 'master'
Initialize file system before accessing file See merge request
!22
parents
f1ecf43c
1315d3b9
Pipeline
#591311
passed with stage
in 2 minutes and 35 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/generator/CNNTrainGenerator.java
View file @
0e383f7f
...
...
@@ -25,13 +25,11 @@ import schemalang.validation.Violation;
import
schemalang.validation.exception.SchemaLangException
;
import
java.io.IOException
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Optional
;
import
java.nio.file.*
;
import
java.util.*
;
import
static
de
.
monticore
.
lang
.
monticar
.
cnnarch
.
generator
.
validation
.
Constants
.
ROOT_SCHEMA
;
import
static
de
.
monticore
.
lang
.
monticar
.
cnnarch
.
generator
.
validation
.
Constants
.
ROOT_SCHEMA_MODEL_PATH
;
...
...
@@ -55,6 +53,7 @@ public abstract class CNNTrainGenerator {
List
<
SchemaDefinitionSymbol
>
schemaDefinitionSymbols
;
try
{
assert
schemasResource
!=
null
;
FileSystem
fileSystem
=
initFileSystem
(
schemasResource
.
toURI
());
Path
path
=
Paths
.
get
(
schemasResource
.
toURI
());
ModelPath
modelPath
=
new
ModelPath
(
path
);
SchemaDefinitionSymbol
schema
=
resolveSchemaDefinition
(
ROOT_SCHEMA
,
modelPath
);
...
...
@@ -72,10 +71,20 @@ public abstract class CNNTrainGenerator {
}
catch
(
URISyntaxException
e
)
{
throw
new
RuntimeException
(
String
.
format
(
"Generation aborted, since there the path '%s' is not valid."
,
schemasResource
.
toString
()));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
String
.
format
(
"Generation aborted. File system could not be created."
),
e
);
}
return
TrainingConfiguration
.
create
(
configuration
,
schemaDefinitionSymbols
);
}
private
FileSystem
initFileSystem
(
URI
uri
)
throws
IOException
{
try
{
return
FileSystems
.
getDefault
();
}
catch
(
Exception
e
)
{
return
FileSystems
.
newFileSystem
(
uri
,
Collections
.
emptyMap
());
}
}
private
ConfigurationSymbol
resolveTrainingConfiguration
(
Path
modelsDirPath
,
String
rootModelName
)
{
final
ModelPath
mp
=
new
ModelPath
(
modelsDirPath
);
GlobalScope
scope
=
new
GlobalScope
(
mp
,
new
ConfLangLanguage
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment