Spaces:
Running
on
A10G
Running
on
A10G
Shanshan Wang
commited on
Commit
•
39b759d
1
Parent(s):
e1bbadf
updated
Browse files
app.py
CHANGED
@@ -6,6 +6,10 @@ from PIL import Image
|
|
6 |
|
7 |
from torchvision.transforms.functional import InterpolationMode
|
8 |
# Define the path to your model
|
|
|
|
|
|
|
|
|
9 |
path = 'h2oai/h2o-mississippi-2b'
|
10 |
|
11 |
# image preprocesing
|
@@ -156,13 +160,15 @@ model = AutoModel.from_pretrained(
|
|
156 |
path,
|
157 |
torch_dtype=torch.bfloat16,
|
158 |
low_cpu_mem_usage=True,
|
159 |
-
trust_remote_code=True
|
|
|
160 |
).eval().cuda()
|
161 |
|
162 |
tokenizer = AutoTokenizer.from_pretrained(
|
163 |
path,
|
164 |
trust_remote_code=True,
|
165 |
-
use_fast=False
|
|
|
166 |
)
|
167 |
tokenizer.pad_token = tokenizer.unk_token
|
168 |
tokenizer.eos_token = "<|end|>"
|
|
|
6 |
|
7 |
from torchvision.transforms.functional import InterpolationMode
|
8 |
# Define the path to your model
|
9 |
+
import os
|
10 |
+
from huggingface_hub import login
|
11 |
+
hf_token = os.environ.get('hf_token', None)
|
12 |
+
|
13 |
path = 'h2oai/h2o-mississippi-2b'
|
14 |
|
15 |
# image preprocesing
|
|
|
160 |
path,
|
161 |
torch_dtype=torch.bfloat16,
|
162 |
low_cpu_mem_usage=True,
|
163 |
+
trust_remote_code=True,
|
164 |
+
use_auth_token=hf_token
|
165 |
).eval().cuda()
|
166 |
|
167 |
tokenizer = AutoTokenizer.from_pretrained(
|
168 |
path,
|
169 |
trust_remote_code=True,
|
170 |
+
use_fast=False,
|
171 |
+
use_auth_token=hf_token
|
172 |
)
|
173 |
tokenizer.pad_token = tokenizer.unk_token
|
174 |
tokenizer.eos_token = "<|end|>"
|