Skip to content

Conversation

@magicheng0816
Copy link
Collaborator

No description provided.

std::lock_guard<std::mutex> lock(instance_map_mutex_);

auto it = instance_map_.find(version);
if (it == instance_map_.end()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need to find twice from instance_map_? Line25 above has already do this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double-checked locking, it is better to change std::mutex to std::shared_mutex

}

bool RecVocabDict::get_items_by_tokens(const RecTokenTriple& rec_token_triple,
std::vector<int64_t>* item_ids) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe use & here is better.

std::vector<int64_t>* item_ids -> const std::vector<int64_t>& item_ids

CHECK(!item_ids.empty());

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the latter method is better, but the interface in front is the former method, so we used it


/**
* @brief initialize instance, parse vocab file
* @param vocab_file vocab file, need full path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe we can align the comment format.

// @brief initialize instance, parse vocab file
// @param vocab_file vocab file, need full path
// ...

std::sort(model_weights_files_.begin(), model_weights_files_.end());

//@todo: 'false' will be replaced with generative recommendation judgment
if (false) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't work yet, shouldn't add this logic for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only send out the review in advance, will not merge now, and will be modified when merging the main process code of the generative recommendation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants