-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add training service #225
Merged
Merged
Add training service #225
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
486ad1c
Add training service
thodkatz 563fd18
Add tests for submitting asynchronous requests while the training has…
thodkatz 52551f3
Release devices when training session initialization has failed
thodkatz 99574c7
Splitting time consuming tests to multiple ones
thodkatz faf5e5b
Remove monkeypatching since it doesn't work for spawn process with macos
thodkatz 432ae5e
Add logging for the training
thodkatz b8e78ec
Fix should stop callbacks
thodkatz 23f0791
Add enum for trainer actions
thodkatz 6c1875a
Specify data type as long for unet config
thodkatz 637c4d1
Add utils proto
thodkatz 27b3923
Separate listing devices as an utility for inference and training
thodkatz 1b0f188
Change dtype long to int64
thodkatz c699344
Remove redundant wrapping of training session id in tests
thodkatz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
syntax = "proto3"; | ||
|
||
package training; | ||
|
||
import "utils.proto"; | ||
|
||
|
||
|
||
service Training { | ||
rpc ListDevices(Empty) returns (Devices) {} | ||
|
||
rpc Init(TrainingConfig) returns (TrainingSessionId) {} | ||
|
||
rpc Start(TrainingSessionId) returns (Empty) {} | ||
|
||
rpc Resume(TrainingSessionId) returns (Empty) {} | ||
|
||
rpc Pause(TrainingSessionId) returns (Empty) {} | ||
|
||
rpc StreamUpdates(TrainingSessionId) returns (stream StreamUpdateResponse) {} | ||
|
||
rpc GetLogs(TrainingSessionId) returns (GetLogsResponse) {} | ||
|
||
rpc Save(TrainingSessionId) returns (Empty) {} | ||
|
||
rpc Export(TrainingSessionId) returns (Empty) {} | ||
|
||
rpc Predict(PredictRequest) returns (PredictResponse) {} | ||
|
||
rpc GetStatus(TrainingSessionId) returns (GetStatusResponse) {} | ||
|
||
rpc CloseTrainerSession(TrainingSessionId) returns (Empty) {} | ||
} | ||
|
||
message TrainingSessionId { | ||
string id = 1; | ||
} | ||
|
||
message Logs { | ||
enum ModelPhase { | ||
Train = 0; | ||
Eval = 1; | ||
} | ||
ModelPhase mode = 1; | ||
double eval_score = 2; | ||
double loss = 3; | ||
uint32 iteration = 4; | ||
} | ||
|
||
|
||
message StreamUpdateResponse { | ||
uint32 best_model_idx = 1; | ||
Logs logs = 2; | ||
} | ||
|
||
|
||
message GetLogsResponse { | ||
repeated Logs logs = 1; | ||
} | ||
|
||
|
||
|
||
message PredictRequest { | ||
repeated Tensor tensors = 1; | ||
TrainingSessionId sessionId = 2; | ||
} | ||
|
||
|
||
message PredictResponse { | ||
repeated Tensor tensors = 1; | ||
} | ||
|
||
message ValidationResponse { | ||
double validation_score_average = 1; | ||
} | ||
|
||
message GetStatusResponse { | ||
enum State { | ||
Idle = 0; | ||
Running = 1; | ||
Paused = 2; | ||
Failed = 3; | ||
Finished = 4; | ||
} | ||
State state = 1; | ||
} | ||
|
||
|
||
message GetCurrentBestModelIdxResponse { | ||
uint32 id = 1; | ||
} | ||
|
||
message TrainingConfig { | ||
string yaml_content = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
syntax = "proto3"; | ||
|
||
message Empty {} | ||
|
||
message NamedInt { | ||
uint32 size = 1; | ||
string name = 2; | ||
} | ||
|
||
message NamedFloat { | ||
float size = 1; | ||
string name = 2; | ||
} | ||
|
||
message Tensor { | ||
bytes buffer = 1; | ||
string dtype = 2; | ||
string tensorId = 3; | ||
repeated NamedInt shape = 4; | ||
} | ||
|
||
message Device { | ||
enum Status { | ||
AVAILABLE = 0; | ||
IN_USE = 1; | ||
} | ||
|
||
string id = 1; | ||
Status status = 2; | ||
} | ||
|
||
message Devices { | ||
repeated Device devices = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[pytest] | ||
python_files = test_*.py | ||
addopts = | ||
--timeout 10 | ||
--timeout 60 | ||
-v | ||
-s | ||
--color=yes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference in creating threads, processes using a start method "spawn" instead of "fork" is quite significant, that led me to bump it, so the tests can pass for macos and windows platforms.