Skip to content

Commit 43f6cce

Browse files
author
Hendrik Muhs
authored
[ML] improve model downloader robustness (#97274)
use the resolver from ModelLoaderUtils, fix problems finding the vocabulary file
1 parent 0c8928e commit 43f6cce

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/changelog/97274.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 97274
2+
summary: Improve model downloader robustness
3+
area: Machine Learning
4+
type: bug
5+
issues: []

x-pack/plugin/ml-package-loader/src/main/java/org/elasticsearch/xpack/ml/packageloader/action/TransportLoadTrainedModelPackage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ protected void masterOperation(Task task, Request request, ClusterState state, A
9292
final long relativeStartNanos = System.nanoTime();
9393
logAndWriteNotificationAtInfo(modelId, "starting model upload");
9494

95-
URI uri = new URI(repository).resolve(packagedModelId + ModelLoaderUtils.MODEL_FILE_EXTENSION);
95+
URI uri = ModelLoaderUtils.resolvePackageLocation(repository, packagedModelId + ModelLoaderUtils.MODEL_FILE_EXTENSION);
9696

9797
// Uploading other artefacts of the model first, that way the model is last and a simple search can be used to check if the
9898
// download is complete
9999
if (Strings.isNullOrEmpty(modelPackageConfig.getVocabularyFile()) == false) {
100100
Tuple<List<String>, List<String>> vocabularyAndMerges = ModelLoaderUtils.loadVocabulary(
101-
new URI(repository).resolve(modelPackageConfig.getVocabularyFile())
101+
ModelLoaderUtils.resolvePackageLocation(repository, modelPackageConfig.getVocabularyFile())
102102
);
103103

104104
PutTrainedModelVocabularyAction.Request r2 = new PutTrainedModelVocabularyAction.Request(

0 commit comments

Comments
 (0)