Skip to content

Commit

Permalink
[LLM] Fix P-Tuning difference (#2240)
Browse files Browse the repository at this point in the history
* Support multicards

* fix ptuning diff

* Update engine.py
  • Loading branch information
jiangjiajun authored Oct 13, 2023
1 parent 9fa04c3 commit e6a7d4e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llm/fastdeploy_llm/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def _init_predictor(self):
dist_config.enable_dist_model(True)
parent_dir = os.path.abspath(os.path.join(self.model_dir, ".."))
mapping_file = os.path.join(parent_dir, "rank_mapping.csv")

if self.mp_degree > 1 and not os.path.exists(mapping_file):
raise Exception("There's no file {}.".format(mapping_file))
dist_config.set_comm_init_config(mapping_file)
Expand Down Expand Up @@ -383,6 +384,8 @@ def dy_input_preprocess(inputs):

for i in range(bsz):
if stop_flags[i] == 1:
attention_mask[i] = 0
tgt_generation_mask[i] = 0
length = int(enc_length[i, 0])
if args.is_ptuning:
model_id = inputs['model_id'][i]
Expand Down

0 comments on commit e6a7d4e

Please sign in to comment.