Spaces:
Runtime error
Runtime error
εΊθ°
commited on
Commit
Β·
5971478
1
Parent(s):
8504ac8
add access token
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ from transformers import GenerationConfig
|
|
| 19 |
# from modelscope.hub.api import HubApi
|
| 20 |
from pydub import AudioSegment
|
| 21 |
import os
|
| 22 |
-
|
| 23 |
|
| 24 |
# api = HubApi()
|
| 25 |
# api.login(YOUR_ACCESS_TOKEN)
|
|
@@ -49,7 +49,7 @@ def _get_args():
|
|
| 49 |
|
| 50 |
def _load_model_tokenizer(args):
|
| 51 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 52 |
-
args.checkpoint_path, trust_remote_code=True, resume_download=True,
|
| 53 |
)
|
| 54 |
|
| 55 |
if args.cpu_only:
|
|
@@ -62,9 +62,10 @@ def _load_model_tokenizer(args):
|
|
| 62 |
device_map=device_map,
|
| 63 |
trust_remote_code=True,
|
| 64 |
resume_download=True,
|
|
|
|
| 65 |
).eval()
|
| 66 |
model.generation_config = GenerationConfig.from_pretrained(
|
| 67 |
-
args.checkpoint_path, trust_remote_code=True, resume_download=True,
|
| 68 |
)
|
| 69 |
|
| 70 |
return model, tokenizer
|
|
|
|
| 19 |
# from modelscope.hub.api import HubApi
|
| 20 |
from pydub import AudioSegment
|
| 21 |
import os
|
| 22 |
+
YOUR_ACCESS_TOKEN = os.getenv('YOUR_ACCESS_TOKEN')
|
| 23 |
|
| 24 |
# api = HubApi()
|
| 25 |
# api.login(YOUR_ACCESS_TOKEN)
|
|
|
|
| 49 |
|
| 50 |
def _load_model_tokenizer(args):
|
| 51 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 52 |
+
args.checkpoint_path, trust_remote_code=True, resume_download=True, token=YOUR_ACCESS_TOKEN
|
| 53 |
)
|
| 54 |
|
| 55 |
if args.cpu_only:
|
|
|
|
| 62 |
device_map=device_map,
|
| 63 |
trust_remote_code=True,
|
| 64 |
resume_download=True,
|
| 65 |
+
token=YOUR_ACCESS_TOKEN
|
| 66 |
).eval()
|
| 67 |
model.generation_config = GenerationConfig.from_pretrained(
|
| 68 |
+
args.checkpoint_path, trust_remote_code=True, resume_download=True, token=YOUR_ACCESS_TOKEN
|
| 69 |
)
|
| 70 |
|
| 71 |
return model, tokenizer
|