John6666 commited on
Commit
c0c0901
1 Parent(s): a1abf89

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +0 -1
  2. app.py +2 -2
  3. requirements.txt +1 -0
README.md CHANGED
@@ -5,7 +5,6 @@ colorFrom: yellow
5
  colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.6.0
8
- python_version: 3.11
9
  app_file: app.py
10
  pinned: false
11
  license: mit
 
5
  colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.6.0
 
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -16,7 +16,7 @@ HF_TOKEN = os.environ.get("HF_TOKEN")
16
 
17
  tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
18
  # Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
19
- model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, torch_dtype=torch.float16).eval().to(device)
20
  terminators = [tokenizer.eos_token_id,
21
  tokenizer.convert_tokens_to_ids("<|eot_id|>"),
22
  tokenizer.convert_tokens_to_ids("<|reserved_special_token_26|>")]
@@ -59,4 +59,4 @@ interface = gr.Interface(
59
  )
60
 
61
  # Launch the Gradio app
62
- interface.launch(ssr_mode=False)
 
16
 
17
  tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
18
  # Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
19
+ model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, torch_dtype=torch.float16, device_map="auto").eval()
20
  terminators = [tokenizer.eos_token_id,
21
  tokenizer.convert_tokens_to_ids("<|eot_id|>"),
22
  tokenizer.convert_tokens_to_ids("<|reserved_special_token_26|>")]
 
59
  )
60
 
61
  # Launch the Gradio app
62
+ interface.queue().launch(ssr_mode=False)
requirements.txt CHANGED
@@ -4,3 +4,4 @@ torch
4
  numpy<2
5
  einops
6
  sentencepiece
 
 
4
  numpy<2
5
  einops
6
  sentencepiece
7
+ accelerate