Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
face
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
face
Commits
47a54b57
Unverified
Commit
47a54b57
authored
Aug 13, 2018
by
justadudewhohacks
Committed by
GitHub
Aug 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #69 from bmaguireibm/master
Adding support for external model uris
parents
f81d35ad
35b8913f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
loadWeightMap.ts
src/commons/loadWeightMap.ts
+3
-1
loadWeightMap.test.ts
test/tests/commons/loadWeightMap.test.ts
+8
-0
No files found.
src/commons/loadWeightMap.ts
View file @
47a54b57
...
@@ -16,6 +16,8 @@ export function getModelUris(uri: string | undefined, defaultModelName: string)
...
@@ -16,6 +16,8 @@ export function getModelUris(uri: string | undefined, defaultModelName: string)
manifestUri
:
`/
${
defaultManifestFilename
}
`
manifestUri
:
`/
${
defaultManifestFilename
}
`
}
}
}
}
const
protocol
=
uri
.
startsWith
(
'http://'
)
?
'http://'
:
uri
.
startsWith
(
'https://'
)
?
'https://'
:
''
;
uri
=
uri
.
replace
(
protocol
,
''
);
const
parts
=
uri
.
split
(
'/'
).
filter
(
s
=>
s
)
const
parts
=
uri
.
split
(
'/'
).
filter
(
s
=>
s
)
...
@@ -23,7 +25,7 @@ export function getModelUris(uri: string | undefined, defaultModelName: string)
...
@@ -23,7 +25,7 @@ export function getModelUris(uri: string | undefined, defaultModelName: string)
?
parts
[
parts
.
length
-
1
]
?
parts
[
parts
.
length
-
1
]
:
defaultManifestFilename
:
defaultManifestFilename
let
modelBaseUri
=
(
uri
.
endsWith
(
'.json'
)
?
parts
.
slice
(
0
,
parts
.
length
-
1
)
:
parts
).
join
(
'/'
)
let
modelBaseUri
=
protocol
+
(
uri
.
endsWith
(
'.json'
)
?
parts
.
slice
(
0
,
parts
.
length
-
1
)
:
parts
).
join
(
'/'
)
modelBaseUri
=
uri
.
startsWith
(
'/'
)
?
`/
${
modelBaseUri
}
`
:
modelBaseUri
modelBaseUri
=
uri
.
startsWith
(
'/'
)
?
`/
${
modelBaseUri
}
`
:
modelBaseUri
return
{
return
{
...
...
test/tests/commons/loadWeightMap.test.ts
View file @
47a54b57
...
@@ -59,6 +59,14 @@ describe('loadWeightMap', () => {
...
@@ -59,6 +59,14 @@ describe('loadWeightMap', () => {
expect
(
result
.
modelBaseUri
).
toEqual
(
'/path/to/modelfiles'
)
expect
(
result
.
modelBaseUri
).
toEqual
(
'/path/to/modelfiles'
)
})
})
it
(
'returns correct uris, given external path'
,
()
=>
{
const
uri
=
'https://example.com/path/to/modelfiles/'
;
const
result
=
getModelUris
(
uri
,
FAKE_DEFAULT_MODEL_NAME
)
expect
(
result
.
manifestUri
).
toEqual
(
uri
+
'model-weights_manifest.json'
)
expect
(
result
.
modelBaseUri
).
toEqual
(
uri
)
})
})
})
})
})
Write
Preview
Markdown
is supported
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