Skip to content
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

reset shared_state when previous AbstractTransformerModelInstance deconstruct #506

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/turbomind/models/llama/LlamaV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class LlamaV2 {

// rank 0 sets flag to true if there are no more tasks in the request_queue
bool should_stop = false;

void reset()
{
request_queue.open();
should_stop = false;
}
};

~LlamaV2();
Expand Down
6 changes: 6 additions & 0 deletions src/turbomind/models/llama/Request.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ class RequestQueue {
cv_.notify_all();
}

void open()
{
std::lock_guard<std::mutex> lock(mutex_);
closed_ = false;
}

private:
std::queue<std::shared_ptr<Request>> stop_queue_;
std::queue<std::shared_ptr<Request>> infer_queue_;
Expand Down
4 changes: 4 additions & 0 deletions src/turbomind/triton_backend/llama/LlamaTritonModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ std::unique_ptr<LlamaTritonSharedModelInstance<T>> LlamaTritonModel<T>::createSh
ft::FT_CHECK(tensor_para.world_size_ == tensor_para_size_);
ft::FT_CHECK(pipeline_para.world_size_ = pipeline_para_size_);

if (rank == 0) {
shared_state_->reset();
}

auto llama = std::make_unique<ft::LlamaV2<T>>(head_num_,
kv_head_num_,
size_per_head_,
Expand Down
Loading