seapoe1809 commited on
Commit
8671130
·
verified ·
1 Parent(s): 23b6f13

Update darnabot.py

Browse files
Files changed (1) hide show
  1. darnabot.py +7 -6
darnabot.py CHANGED
@@ -69,16 +69,17 @@ from threading import Thread
69
  import spaces
70
 
71
  # Initialize device and model
72
- MODEL_LIST = ["mistralai/Mistral-Nemo-Instruct-2407"]
73
- HF_TOKEN = os.environ.get("mistral_ai")
74
- MODEL = os.environ.get("MODEL_ID")
75
 
76
- device = "cuda"
77
 
78
 
79
  # Authenticate if needed
80
- tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407", use_auth_token="mistral_ai")
81
- model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407", use_auth_token="mistral_ai", torch_dtype=torch.bfloat16,
 
 
82
  device_map="auto",
83
  ignore_mismatched_sizes=True)
84
 
 
69
  import spaces
70
 
71
  # Initialize device and model
72
+ HF_TOKEN = os.environ.get("HF_TOKEN")
73
+ MODEL = "mistralai/Mistral-Nemo-Instruct-2407"
 
74
 
75
+ device = "cuda" if torch.cuda.is_available() else "cpu"
76
 
77
 
78
  # Authenticate if needed
79
+ tokenizer = AutoTokenizer.from_pretrained(MODEL)
80
+ model = AutoModelForCausalLM.from_pretrained(
81
+ MODEL,
82
+ torch_dtype=torch.bfloat16,
83
  device_map="auto",
84
  ignore_mismatched_sizes=True)
85