joaogante HF Staff commited on
Commit
ef2fef1
·
verified ·
1 Parent(s): dc996a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -6,11 +6,11 @@ import gradio as gr
6
  from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer
7
  import time
8
 
9
- model_id = "google/gemma-2-9b-it"
10
- assistant_id = "google/gemma-2-2b-it"
11
 
12
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", load_in_8bit=True, attn_implementation="eager")
13
- assistant_model = AutoModelForCausalLM.from_pretrained(assistant_id, torch_dtype=torch.bfloat16, device_map="auto", attn_implementation="eager")
14
  tokenizer = AutoTokenizer.from_pretrained(model_id)
15
 
16
  @spaces.GPU
@@ -56,9 +56,9 @@ def reset_textbox():
56
  with gr.Blocks() as demo:
57
  gr.Markdown(
58
  "# 🤗 Assisted Generation Demo\n"
59
- f"- Model: {model_id} (quantized to 8 bits with BNB, ~9GB)\n"
60
- f"- Assistant Model: {assistant_id} (BF16, ~4GB)\n"
61
- "- Running on a T4 GPU"
62
  "- Best results are obtained when the model size difference in parameters is >10x"
63
  )
64
 
 
6
  from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamer
7
  import time
8
 
9
+ model_id = "facebook/opt-1.3b"
10
+ assistant_id = "facebook/opt-125m"
11
 
12
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
13
+ assistant_model = AutoModelForCausalLM.from_pretrained(assistant_id, torch_dtype=torch.bfloat16, device_map="auto")
14
  tokenizer = AutoTokenizer.from_pretrained(model_id)
15
 
16
  @spaces.GPU
 
56
  with gr.Blocks() as demo:
57
  gr.Markdown(
58
  "# 🤗 Assisted Generation Demo\n"
59
+ f"- Model: {model_id} (BF16, ~3GB)\n"
60
+ f"- Assistant Model: {assistant_id} (BF16, ~0.3GB)\n"
61
+ "- Running on a T4 GPU\n"
62
  "- Best results are obtained when the model size difference in parameters is >10x"
63
  )
64