Dimitre commited on
Commit
1fd4dc6
1 Parent(s): f8817da

App final update

Browse files
Files changed (2) hide show
  1. app.py +2 -3
  2. requirements.txt +0 -1
app.py CHANGED
@@ -4,7 +4,7 @@ import os
4
  import streamlit as st
5
  import torch
6
  from dotenv import load_dotenv
7
- from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
8
 
9
  from hangman import guess_letter
10
  from hf_utils import query_hint, query_word
@@ -34,7 +34,6 @@ def setup(model_id: str, device: str) -> None:
34
  model_id (str): Model ID used to load the tokenizer and model.
35
  """
36
  logger.info(f"Loading model and tokenizer from model: '{model_id}'")
37
- quantization_config = BitsAndBytesConfig(load_in_4bit=True)
38
 
39
  tokenizer = AutoTokenizer.from_pretrained(
40
  model_id,
@@ -44,7 +43,7 @@ def setup(model_id: str, device: str) -> None:
44
  model_id,
45
  torch_dtype=torch.float16,
46
  token=os.environ["HF_ACCESS_TOKEN"],
47
- quantization_config=quantization_config,
48
  ).to(device)
49
  logger.info("Setup finished")
50
  return {"tokenizer": tokenizer, "model": model}
 
4
  import streamlit as st
5
  import torch
6
  from dotenv import load_dotenv
7
+ from transformers import AutoModelForCausalLM, AutoTokenizer
8
 
9
  from hangman import guess_letter
10
  from hf_utils import query_hint, query_word
 
34
  model_id (str): Model ID used to load the tokenizer and model.
35
  """
36
  logger.info(f"Loading model and tokenizer from model: '{model_id}'")
 
37
 
38
  tokenizer = AutoTokenizer.from_pretrained(
39
  model_id,
 
43
  model_id,
44
  torch_dtype=torch.float16,
45
  token=os.environ["HF_ACCESS_TOKEN"],
46
+ device_map="auto",
47
  ).to(device)
48
  logger.info("Setup finished")
49
  return {"tokenizer": tokenizer, "model": model}
requirements.txt CHANGED
@@ -2,5 +2,4 @@ streamlit
2
  python-dotenv
3
  torch
4
  transformers
5
- bitsandbytes
6
  accelerate
 
2
  python-dotenv
3
  torch
4
  transformers
 
5
  accelerate