-
Notifications
You must be signed in to change notification settings - Fork 40
feat: use lru_dedup_dict for rank call #569
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
8da6bdc
47cac14
3410f6e
a6fd7fc
6ef7329
afdce95
98f34fd
7c238ef
de01d5f
ed4cb6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ vw_model::vw_model(i_trace* trace_logger, const utility::configuration& config) | |
| , _initial_command_line(std::string(config.get(name::MODEL_VW_INITIAL_COMMAND_LINE, | ||
| "--cb_explore_adf --json --quiet --epsilon 0.0 --first_only --id N/A")) + | ||
| (_audit ? " --audit" : "")) | ||
| , _vw_pool(safe_vw_factory(_initial_command_line), | ||
| , _vw_pool(safe_vw_factory(_initial_command_line, _dedup_cache), | ||
| config.get_int(name::VW_POOL_INIT_SIZE, value::DEFAULT_VW_POOL_INIT_SIZE), trace_logger) | ||
| , _trace_logger(trace_logger) | ||
| { | ||
|
|
@@ -34,13 +34,13 @@ int vw_model::update(const model_data& data, bool& model_ready, api_status* stat | |
| { | ||
| std::string cmd_line = add_optional_audit_flag(_quiet_commandline_options); | ||
|
|
||
| std::unique_ptr<safe_vw> init_vw(new safe_vw(data.data(), data.data_sz(), cmd_line)); | ||
| std::unique_ptr<safe_vw> init_vw(new safe_vw(data.data(), data.data_sz(), cmd_line, _dedup_cache)); | ||
| if (init_vw->is_CB_to_CCB_model_upgrade(_initial_command_line)) | ||
| { | ||
| cmd_line = add_optional_audit_flag(_upgrade_to_CCB_vw_commandline_options); | ||
| } | ||
|
|
||
| safe_vw_factory factory(data, cmd_line); | ||
| safe_vw_factory factory(data, cmd_line, _dedup_cache); | ||
| std::unique_ptr<safe_vw> test_vw(factory()); | ||
| if (test_vw->is_compatible(_initial_command_line)) | ||
| { | ||
|
|
@@ -67,6 +67,13 @@ int vw_model::update(const model_data& data, bool& model_ready, api_status* stat | |
| return error_code::success; | ||
| } | ||
|
|
||
| int vw_model::add_lru_dedup_cache(uint64_t hash, std::string action_str, api_status* status) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably move the "parse action and populate the cache" functionality into that way whenever you use vw for a rank call we could just do
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the way it is done here the specific action is only passed into one of the vw instances in the object pool
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed lru_cache from safe_vw and constructor etc. Added as an arg to load_action and rank in safe_vw |
||
| { | ||
| auto vw = _vw_pool.get_or_create(); | ||
| vw->add_lru_dedup_cache(hash, action_str); | ||
| return error_code::success; | ||
| } | ||
|
|
||
| int vw_model::choose_rank(const char* event_id, uint64_t rnd_seed, string_view features, std::vector<int>& action_ids, | ||
| std::vector<float>& action_pdf, std::string& model_version, api_status* status) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.