VictorSanh commited on
Commit
cacade6
1 Parent(s): 348ad43
Files changed (1) hide show
  1. app_dialogue.py +10 -8
app_dialogue.py CHANGED
@@ -25,13 +25,13 @@ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENT
25
 
26
  DEVICE = torch.device("cuda")
27
  MODELS = {
28
- "284 - neftune - opt 18'500": AutoModelForCausalLM.from_pretrained(
29
- "HuggingFaceM4/idefics2",
30
- trust_remote_code=True,
31
- torch_dtype=torch.bfloat16,
32
- token=os.environ["HF_AUTH_TOKEN"],
33
- revision="1e05755c1c5cb2077a0f60b83ea1368c22a17282",
34
- ).to(DEVICE),
35
  "279bis - baseline - opt 18'500": AutoModelForCausalLM.from_pretrained(
36
  "HuggingFaceM4/idefics2",
37
  trust_remote_code=True,
@@ -61,7 +61,7 @@ PROCESSOR = AutoProcessor.from_pretrained(
61
  FAKE_TOK_AROUND_IMAGE = "<fake_token_around_image>"
62
  BOS_TOKEN = PROCESSOR.tokenizer.bos_token
63
  BAD_WORDS_IDS = PROCESSOR.tokenizer(["<image>", "<fake_token_around_image>"], add_special_tokens=False).input_ids
64
- EOS_WORDS_IDS = PROCESSOR.tokenizer(["<end_of_utterance>", "\nUser:"], add_special_tokens=False).input_ids
65
  IMAGE_SEQ_LEN = list(MODELS.values())[0].config.perceiver_config.resampler_n_latents
66
 
67
  SYSTEM_PROMPT = [
@@ -474,6 +474,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
474
  "max_new_tokens": max_new_tokens,
475
  "repetition_penalty": repetition_penalty,
476
  "bad_words_ids": BAD_WORDS_IDS,
 
477
  "streamer": streamer,
478
  }
479
 
@@ -551,6 +552,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
551
  "max_new_tokens": max_new_tokens,
552
  "repetition_penalty": None,
553
  "bad_words_ids": BAD_WORDS_IDS,
 
554
  "do_sample": False,
555
  }
556
 
 
25
 
26
  DEVICE = torch.device("cuda")
27
  MODELS = {
28
+ # "284 - neftune - opt 18'500": AutoModelForCausalLM.from_pretrained(
29
+ # "HuggingFaceM4/idefics2",
30
+ # trust_remote_code=True,
31
+ # torch_dtype=torch.bfloat16,
32
+ # token=os.environ["HF_AUTH_TOKEN"],
33
+ # revision="1e05755c1c5cb2077a0f60b83ea1368c22a17282",
34
+ # ).to(DEVICE),
35
  "279bis - baseline - opt 18'500": AutoModelForCausalLM.from_pretrained(
36
  "HuggingFaceM4/idefics2",
37
  trust_remote_code=True,
 
61
  FAKE_TOK_AROUND_IMAGE = "<fake_token_around_image>"
62
  BOS_TOKEN = PROCESSOR.tokenizer.bos_token
63
  BAD_WORDS_IDS = PROCESSOR.tokenizer(["<image>", "<fake_token_around_image>"], add_special_tokens=False).input_ids
64
+ EOS_WORDS_IDS = PROCESSOR.tokenizer("<end_of_utterance>", add_special_tokens=False).input_ids + [PROCESSOR.tokenizer.eos_token_id]
65
  IMAGE_SEQ_LEN = list(MODELS.values())[0].config.perceiver_config.resampler_n_latents
66
 
67
  SYSTEM_PROMPT = [
 
474
  "max_new_tokens": max_new_tokens,
475
  "repetition_penalty": repetition_penalty,
476
  "bad_words_ids": BAD_WORDS_IDS,
477
+ "eos_token_id": EOS_WORDS_IDS,
478
  "streamer": streamer,
479
  }
480
 
 
552
  "max_new_tokens": max_new_tokens,
553
  "repetition_penalty": None,
554
  "bad_words_ids": BAD_WORDS_IDS,
555
+ "eos_token_id": EOS_WORDS_IDS,
556
  "do_sample": False,
557
  }
558