Vitrous commited on
Commit
837fd46
·
verified ·
1 Parent(s): 2a75a89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -16,7 +16,6 @@ app = FastAPI(root_path="/api/v1")
16
 
17
  # Load the model and tokenizer
18
  model_name_or_path = "TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ"
19
- mistral_model="mistralai/Mistral-7B-Instruct-v0.2"
20
 
21
  conversations = {}
22
  device = "cuda" # the device to load the model onto
@@ -29,12 +28,9 @@ def mistral_model():
29
  tuple: A tuple containing the loaded model and tokenizer.
30
  """
31
  if torch.cuda.is_available():
32
- print("CUDA is available. GPU will be used.")
33
- else:
34
- print("CUDA is not available. CPU will be used.")
35
-
36
- tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
37
- model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
38
 
39
  return model,tokenizer
40
 
 
16
 
17
  # Load the model and tokenizer
18
  model_name_or_path = "TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ"
 
19
 
20
  conversations = {}
21
  device = "cuda" # the device to load the model onto
 
28
  tuple: A tuple containing the loaded model and tokenizer.
29
  """
30
  if torch.cuda.is_available():
31
+ model_id = "mistralai/Mistral-7B-Instruct-v0.2"
32
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
33
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
 
 
 
34
 
35
  return model,tokenizer
36