coeuslearning
commited on
Commit
•
c1ded61
1
Parent(s):
1a8de41
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,8 @@ import spaces
|
|
7 |
import torch
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
|
|
|
|
|
10 |
MAX_MAX_NEW_TOKENS = 2048
|
11 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
12 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
@@ -31,8 +33,7 @@ if not torch.cuda.is_available():
|
|
31 |
|
32 |
if torch.cuda.is_available():
|
33 |
model_id = "meta-llama/Llama-2-7b-chat-hf"
|
34 |
-
|
35 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto", use_auth_token=auth_token)
|
36 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
37 |
tokenizer.use_default_system_prompt = False
|
38 |
|
|
|
7 |
import torch
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
|
10 |
+
!huggingface-cli login --token "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"
|
11 |
+
|
12 |
MAX_MAX_NEW_TOKENS = 2048
|
13 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
14 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
|
33 |
|
34 |
if torch.cuda.is_available():
|
35 |
model_id = "meta-llama/Llama-2-7b-chat-hf"
|
36 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
|
|
37 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
38 |
tokenizer.use_default_system_prompt = False
|
39 |
|