`asset_path_initializer` not fed when saving/reloading model
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Tái hiện lỗi bằng cách sử dụng SavedModelBundle.load, graph và session, cùng với đích saver_filename được hiển thị trong issue, đồng thời so sánh các model TF Hub và HuggingFace. Kiểm tra cách graph và các biến được lưu vào SavedModelPB rồi được tải lại. Hoàn tất khi các model TF Hub có assets có thể được lưu và tải lại mà không gặp lỗi asset_path_initializer.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
---- This is an issue posted by @maziyarpanahi ----
Hi @karllessard
We are experiencing the same issue however in the 0.4.0 release (after this fix https://github.com/tensorflow/java/pull/393 was included). Previously in 0.2.x and 0.3.x, we were able to load a model, save it on disk, and load it back (both models from TF Hub and HuggingFace as SavedModel).
However, now in 0.4.0, we can load any SavedModel from anywhere, but once it's saved on disk we face this similar error when trying to load it back (only TF Hub models):
[ERROR] org.tensorflow.exceptions.TFInvalidArgumentException: You must feed a value for placeholder tensor 'asset_path_initializer' with dtype string [[node asset_path_initializer]]
- Models coming from TF Hub have an extra
asset_path_initializerplaceholder, they used to work in the0.2.xand0.3.xreleases without a need to feed it or deal with it in any way. - Models coming from HuggingFace don't have an
asset_path_initializerplaceholder, so we don't have an issue with those
BERT on TF Hub:

BERT on HuggingFace:

Is there anything we need to do since 0.4.x is on TensorFlow 2.7.x, I am not sure if this is a change in newer TF or in tensorflow-java.
PS: We don't use any exporters, we saved the model differently. A very quick and simple example of how we do this:
val model = SavedModelBundle.load(modelPath, "serve")
/* Save the model */
val graph = model.graph()
val session = model.session()
val exportDir = Files.createDirectory(Paths.get("./saved_model")).toAbsolutePath.toString
val variablesFile = Paths.get(exportDir, "variables").toString
session.runner
.addTarget("StatefulPartitionedCall_1")
.feed("saver_filename", t.createTensor(variablesFile))
.run()
val graphFile = Paths.get(exportDir, TensorflowWrapper.SavedModelPB).toString
FileUtils.writeByteArrayToFile(new File(graphFile), graph.toGraphDef.toByteArray)

We have been doing this since TF v1 and it has been compatible with all the TF v2 up until 0.4.0, but now if we save it like this (only models from TF Hub and I am guessing those with assets) we see that error)
Originally posted by @maziyarpanahi in https://github.com/tensorflow/java/issues/387#issuecomment-1066628248
- Ngôn ngữ chính
- Java
- Star
- 928
- Fork
- 227
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tensorflow/java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
tensorflow/java#653 · 1 bình luận · 4 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
tensorflow/java#621 · 4 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
tensorflow/java#617 · 3 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
tensorflow/java#615 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
tensorflow/java#614 · 1 bình luận ·
Tất cả issue của tensorflow/java
Issue tương tự
-
bug untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
emitter:client:csharp feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Đang mởbug frontend maui-pilot
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100