Spaces:
Build error
Build error
Commit
·
d0833c9
1
Parent(s):
cf2dd0e
auth update
Browse files- ChatService.py +4 -2
- requirements.txt +2 -1
ChatService.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import torch
|
3 |
import transformers
|
|
|
4 |
|
5 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
6 |
|
@@ -18,13 +19,14 @@ class ChatService:
|
|
18 |
gpu_count = torch.cuda.device_count()
|
19 |
print('gpu_count', gpu_count)
|
20 |
|
21 |
-
|
|
|
|
|
22 |
pipeline = transformers.pipeline(
|
23 |
task="text-generation",
|
24 |
model=model_name,
|
25 |
torch_dtype=torch.float16,
|
26 |
device_map="auto",
|
27 |
-
use_auth_token="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"
|
28 |
)
|
29 |
|
30 |
@staticmethod
|
|
|
1 |
import os
|
2 |
import torch
|
3 |
import transformers
|
4 |
+
from huggingface_hub import login
|
5 |
|
6 |
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
7 |
|
|
|
19 |
gpu_count = torch.cuda.device_count()
|
20 |
print('gpu_count', gpu_count)
|
21 |
|
22 |
+
login("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")
|
23 |
+
|
24 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
|
25 |
pipeline = transformers.pipeline(
|
26 |
task="text-generation",
|
27 |
model=model_name,
|
28 |
torch_dtype=torch.float16,
|
29 |
device_map="auto",
|
|
|
30 |
)
|
31 |
|
32 |
@staticmethod
|
requirements.txt
CHANGED
@@ -10,4 +10,5 @@ accelerate
|
|
10 |
flask
|
11 |
flask_cors
|
12 |
gunicorn
|
13 |
-
urllib3==1.26.6
|
|
|
|
10 |
flask
|
11 |
flask_cors
|
12 |
gunicorn
|
13 |
+
urllib3==1.26.6
|
14 |
+
huggingface_hub
|