Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,11 @@ def _get_args():
|
|
| 24 |
type=str,
|
| 25 |
default=DEFAULT_CKPT_PATH,
|
| 26 |
help='Checkpoint name or path, default to %(default)r')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
parser.add_argument('--cpu-only', action='store_true', help='Run demo with CPU only')
|
| 28 |
parser.add_argument('--flash-attn2',
|
| 29 |
action='store_true',
|
|
@@ -54,12 +59,15 @@ def _load_model_processor(args):
|
|
| 54 |
if args.flash_attn2:
|
| 55 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 56 |
args.checkpoint_path,
|
| 57 |
-
use_auth_token=
|
| 58 |
torch_dtype='auto',
|
| 59 |
attn_implementation='flash_attention_2',
|
| 60 |
device_map=device_map)
|
| 61 |
else:
|
| 62 |
-
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
processor = AutoProcessor.from_pretrained(args.checkpoint_path)
|
| 65 |
return model, processor
|
|
|
|
| 24 |
type=str,
|
| 25 |
default=DEFAULT_CKPT_PATH,
|
| 26 |
help='Checkpoint name or path, default to %(default)r')
|
| 27 |
+
parser.add_argument('-t',
|
| 28 |
+
'--auth-token',
|
| 29 |
+
type=str,
|
| 30 |
+
default=AUTH_TOKEN,
|
| 31 |
+
help='Authentication token for model repository, default to %(default)r')
|
| 32 |
parser.add_argument('--cpu-only', action='store_true', help='Run demo with CPU only')
|
| 33 |
parser.add_argument('--flash-attn2',
|
| 34 |
action='store_true',
|
|
|
|
| 59 |
if args.flash_attn2:
|
| 60 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 61 |
args.checkpoint_path,
|
| 62 |
+
use_auth_token=args.auth_token,
|
| 63 |
torch_dtype='auto',
|
| 64 |
attn_implementation='flash_attention_2',
|
| 65 |
device_map=device_map)
|
| 66 |
else:
|
| 67 |
+
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 68 |
+
args.checkpoint_path,
|
| 69 |
+
use_auth_token=args.auth_token,
|
| 70 |
+
device_map=device_map)
|
| 71 |
|
| 72 |
processor = AutoProcessor.from_pretrained(args.checkpoint_path)
|
| 73 |
return model, processor
|