@@ -20,7 +20,7 @@ def get_literal_type(self, t: Type[tf.keras.Model]) -> LiteralType:
2020 return LiteralType (
2121 blob = _core_types .BlobType (
2222 format = self .TENSORFLOW_FORMAT ,
23- dimensionality = _core_types .BlobType .BlobDimensionality .MULTIPART ,
23+ dimensionality = _core_types .BlobType .BlobDimensionality .SINGLE ,
2424 )
2525 )
2626
@@ -34,14 +34,14 @@ async def async_to_literal(
3434 meta = BlobMetadata (
3535 type = _core_types .BlobType (
3636 format = self .TENSORFLOW_FORMAT ,
37- dimensionality = _core_types .BlobType .BlobDimensionality .MULTIPART ,
37+ dimensionality = _core_types .BlobType .BlobDimensionality .SINGLE ,
3838 )
3939 )
4040
41- local_path = ctx .file_access .get_random_local_path ()
41+ local_path = ctx .file_access .get_random_local_path () + ".keras"
4242 pathlib .Path (local_path ).parent .mkdir (parents = True , exist_ok = True )
4343
44- # save model in SavedModel format
44+ # save model in Keras format
4545 tf .keras .models .save_model (python_val , local_path )
4646
4747 remote_path = await ctx .file_access .async_put_raw_data (local_path )
@@ -55,16 +55,16 @@ async def async_to_python_value(
5555 except AttributeError :
5656 TypeTransformerFailedError (f"Cannot convert from { lv } to { expected_python_type } " )
5757
58- local_path = ctx .file_access .get_random_local_path ()
59- await ctx .file_access .async_get_data (uri , local_path , is_multipart = True )
58+ local_path = ctx .file_access .get_random_local_path () + ".keras"
59+ await ctx .file_access .async_get_data (uri , local_path , is_multipart = False )
6060
6161 # load model
6262 return tf .keras .models .load_model (local_path )
6363
6464 def guess_python_type (self , literal_type : LiteralType ) -> Type [tf .keras .Model ]:
6565 if (
6666 literal_type .blob is not None
67- and literal_type .blob .dimensionality == _core_types .BlobType .BlobDimensionality .MULTIPART
67+ and literal_type .blob .dimensionality == _core_types .BlobType .BlobDimensionality .SINGLE
6868 and literal_type .blob .format == self .TENSORFLOW_FORMAT
6969 ):
7070 return tf .keras .Model
0 commit comments