-
Notifications
You must be signed in to change notification settings - Fork 2
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
New validation mode: via sending model #205
base: main
Are you sure you want to change the base?
Conversation
04b5e54
to
1dfc4de
Compare
7913201
to
9dc7cf6
Compare
ae4f954
to
3080a6d
Compare
9dc7cf6
to
0da98e9
Compare
3080a6d
to
8d465dc
Compare
0da98e9
to
2d61059
Compare
1087af2
to
2bdb53b
Compare
becaff2
to
843076a
Compare
b24850b
to
9ef0dca
Compare
bb2a8ea
to
fc3ecf9
Compare
9ef0dca
to
7657a7b
Compare
fc3ecf9
to
cd56d10
Compare
cd56d10
to
0a0a262
Compare
AIAgent/ml/validation/coverage/game_managers/model/process_game_manager.py
Outdated
Show resolved
Hide resolved
AIAgent/ml/validation/coverage/game_managers/model/process_game_manager.py
Outdated
Show resolved
Hide resolved
AIAgent/ml/validation/coverage/game_managers/model/process_game_manager.py
Outdated
Show resolved
Hide resolved
AIAgent/ml/validation/coverage/game_managers/model/process_game_manager.py
Outdated
Show resolved
Hide resolved
AIAgent/ml/validation/coverage/game_managers/model/process_game_manager.py
Outdated
Show resolved
Hide resolved
3b8cedc
to
d345340
Compare
576996c
to
3fe73d1
Compare
@@ -492,6 +492,10 @@ def graphs_are_equal(new_g_v, old_g_v, new_s_v, old_s_v): | |||
return np.array_equal(new_g_v, old_g_v) and np.array_equal(new_s_v, old_s_v) | |||
|
|||
def merge_distributions(old_distribution, new_distribution): | |||
if old_distribution.device != new_distribution.device: |
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.
What is it?
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 data for manipulation must be on the same device
@dataclass(slots=True) | ||
class ModelGameStep: | ||
GameState: GameState | ||
Output: list |
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.
List of what?
game_map_info = ModelGameMapInfo( | ||
total_game_state=None, | ||
total_steps=[], | ||
proc=None, # type: ignore |
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.
Too much problems with types -> design is wrong.
) -> Tuple[int, socket.socket]: | ||
if attempts <= 0: | ||
raise RuntimeError("Failed to occupy port") | ||
logging.debug(f"Looking for port... Attempls left: {attempts}.") |
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.
Why this logic is not in connection manager (utils?)?
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.
Done
game_map_info.proc.wait() | ||
with open(steps, "br") as f: | ||
steps_json = json.load(f) | ||
steps = list(map(lambda v: ModelGameStep.from_dict(v), steps_json)) # type: ignore |
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.
Such tricks with types hint at bad design.
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.
Pyright issue with dataclass_json methods lidatong/dataclasses-json#309
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.
AIAgent/ml/validation/coverage/game_managers/model/process_game_manager.py
Outdated
Show resolved
Hide resolved
step = steps.pop(0) | ||
game_state, nn_output = step.GameState, step.Output | ||
|
||
def get_hetero_data(game_state: GameState, nn_output: list): |
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.
May be moved to dataset?
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.
Done
@@ -256,6 +257,13 @@ def objective( | |||
torch.save(model.state_dict(), CURRENT_MODEL_PATH) | |||
mlflow.log_artifact(CURRENT_MODEL_PATH, str(epoch)) | |||
|
|||
model_kwargs = trial.params.copy() |
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.
What is it?
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.
Model args are required by the onnx converter
Line 154 in becd6e7
help="Path to .yaml-file with model kwargs", |
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.
A lot of TODOs still. Will they be fixed? Or you want to merge them?
SVMConnectionInfo, | ||
) | ||
from ml.validation.coverage.game_managers.utils import set_timeout_if_needed | ||
from onyx import entrypoint, load_gamestate, resolve_import_model |
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.
from onyx import entrypoint, load_gamestate, resolve_import_model | |
from onyx import entrypoint as save_torch_model_to_onnx_file, load_gamestate, resolve_import_model |
self._create_onnx_model() | ||
self._clean_output_folder() |
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.
swap please, if SVMS_OUTPUT_PATH
== CURRENT_ONNX_MODEL_PATH.parent
, then onnx model will be removed
game_map_info.proc.wait() | ||
with open(steps, "br") as f: | ||
steps_json = json.load(f) | ||
steps = list(map(lambda v: ModelGameStep.from_dict(v), steps_json)) # type: ignore |
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.
steps = None | ||
return steps | ||
|
||
def are_steps_required(self, game_map: GameMap, required: bool): |
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.
what is "pollute the class namespace"? If the issue is in duck typing hints, you can create static class and put these functions inside
I am suggesting this change because rn this function is unreadable to the reviewer. Also imagine you need to test convert_steps_to_hetero
function. How would you do it?
@@ -57,12 +64,15 @@ def _evaluate_game_map( | |||
) | |||
map_name = game_map.MapName | |||
if self.dataset.is_update_map_required(map_name, map_result): | |||
self._game_manager.are_steps_required(game_map=game_map, required=True) |
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.
why something is run after alert_svm_about_step_saving
? According to this func documentation, "symbolic execution environment" is "notified", why something else is happening?
No description provided.