Skip to content

Commit

Permalink
fix internvl2 error
Browse files Browse the repository at this point in the history
  • Loading branch information
HarmonyHu committed Sep 24, 2024
1 parent 5cb0bd2 commit 3e00a0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions models/InternVL2/python_demo/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class InternVL2 {
uint64_t IMAGE_BYTES;

private:
std::vector<bm_handle_t> handles;
bm_handle_t bm_handle;
void *p_bmrt;
std::vector<const bm_net_info_t *> net_blocks;
Expand Down Expand Up @@ -134,9 +133,7 @@ void InternVL2::init(int dev_id, std::string model_path) {

void InternVL2::deinit() {
bmrt_destroy(p_bmrt);
for (auto h : handles) {
bm_dev_free(h);
}
bm_dev_free(bm_handle);
}

int InternVL2::forward_first(std::vector<int> &tokens,
Expand Down
2 changes: 1 addition & 1 deletion models/InternVL2/python_demo/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def encode(self):
system_ids = self.tokenizer.encode(self.system_prompt + "<img>")
self.image_offset = len(system_ids)
prompt_ids = self.tokenizer.encode(
"</img>{self.input_str}<|end|><|assistant|>\n")
"</img>{}<|end|><|assistant|>\n".format(self.input_str))
self.input_ids = system_ids + self.image_ids + prompt_ids

def chat(self):
Expand Down

0 comments on commit 3e00a0e

Please sign in to comment.