Skip to content

Conversation

@magicheng0816
Copy link
Collaborator

No description provided.

@@ -0,0 +1,96 @@
#pragma once
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: add header like this:

/* Copyright 2025 The xLLM Authors. All Rights Reserved.
Copyright 2024 The ScaleLLM Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://github.com/jd-opensource/xllm/blob/main/LICENSE

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

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.


static void DestroyInstance(const std::string& version) {
std::lock_guard<std::mutex> lock(instance_map_mutex_);
instance_map_.erase(version);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should erase version from instance_version_list_ ?

path.append(tokenizer_args_.vocab_file()).string();

LOG(INFO) << "model_version:" << model_version;
LOG(INFO) << "vocab_full_path:" << vocab_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: :)

LOG(INFO) << "model_version:" << model_version
                    << ", vocab_full_path:" << vocab_full_path;

->initialize(vocab_full_path))
<< "Failed to initialize vocab dict from " << vocab_full_path;
} else {
LOG(INFO) << "vocab file is not set";
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 log(error) or log(fatal) or return false ?

@@ -0,0 +1,138 @@
#include "rec_vocab_dict.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: add xllm header

}

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());

@@ -0,0 +1,94 @@
#pragma once
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: add xllm header


/**
* @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
// ...

@@ -0,0 +1,52 @@
#include "rec_tokenizer.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: add xllm header

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.

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