File tree Expand file tree Collapse file tree 3 files changed +68
-1
lines changed
src/main/java/org/pytorch/serve/servingsdk/snapshot Expand file tree Collapse file tree 3 files changed +68
-1
lines changed Original file line number Diff line number Diff line change 4
4
<groupId >org.pytorch</groupId >
5
5
<artifactId >torchserve-plugins-sdk</artifactId >
6
6
<packaging >jar</packaging >
7
- <version >0.0.3 </version >
7
+ <version >0.0.4 </version >
8
8
<name >torchserve-plugins-sdk</name >
9
9
<description >
10
10
SDK for PyTorch model server plugins
Original file line number Diff line number Diff line change
1
+ package org .pytorch .serve .servingsdk .snapshot ;
2
+
3
+ import com .google .gson .JsonObject ;
4
+ import java .util .Map ;
5
+
6
+ public class Snapshot {
7
+ private String name ;
8
+ private int modelCount ;
9
+ private long created ;
10
+ private Map <String , Map <String , JsonObject >> models ;
11
+
12
+ public Snapshot (String snaspshotName , int modelCount ) {
13
+ this .name = snaspshotName ;
14
+ this .setModelCount (modelCount );
15
+ this .created = System .currentTimeMillis ();
16
+ }
17
+
18
+ public String getName () {
19
+ return name ;
20
+ }
21
+
22
+ public void setName (String name ) {
23
+ this .name = name ;
24
+ }
25
+
26
+ public Map <String , Map <String , JsonObject >> getModels () {
27
+ return models ;
28
+ }
29
+
30
+ public void setModels (Map <String , Map <String , JsonObject >> models ) {
31
+ this .models = models ;
32
+ }
33
+
34
+ public long getCreated () {
35
+ return created ;
36
+ }
37
+
38
+ public void setCreated (long created ) {
39
+ this .created = created ;
40
+ }
41
+
42
+ @ Override
43
+ public String toString () {
44
+ return "Checkpoint [name=" + name + ", created=" + created + ", models=" + models + "]" ;
45
+ }
46
+
47
+ public int getModelCount () {
48
+ return modelCount ;
49
+ }
50
+
51
+ public void setModelCount (int modelCount ) {
52
+ this .modelCount = modelCount ;
53
+ }
54
+ }
Original file line number Diff line number Diff line change
1
+ package org .pytorch .serve .servingsdk .snapshot ;
2
+
3
+ import java .io .IOException ;
4
+ import java .util .Properties ;
5
+
6
+ public interface SnapshotSerializer {
7
+
8
+ void saveSnapshot (Snapshot snapshot , final Properties prop ) throws IOException ;
9
+
10
+ Snapshot getSnapshot (String modelSnapshot ) throws IOException ;
11
+
12
+ Properties getLastSnapshot ();
13
+ }
You can’t perform that action at this time.
0 commit comments