Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -11,18 +11,13 @@ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENT
|
|
11 |
|
12 |
parser = argparse.ArgumentParser()
|
13 |
|
14 |
-
if torch.cuda.is_available():
|
15 |
-
device, dtype = "cuda", torch.float16
|
16 |
-
else:
|
17 |
-
device, dtype = "cpu", torch.float32
|
18 |
-
|
19 |
model_id = "vikhyatk/moondream2"
|
20 |
revision = "2024-04-02"
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
|
22 |
moondream = AutoModelForCausalLM.from_pretrained(
|
23 |
model_id, trust_remote_code=True, revision=revision,
|
24 |
-
attn_implementation="flash_attention_2"
|
25 |
-
)
|
26 |
moondream.eval()
|
27 |
|
28 |
|
|
|
11 |
|
12 |
parser = argparse.ArgumentParser()
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
model_id = "vikhyatk/moondream2"
|
15 |
revision = "2024-04-02"
|
16 |
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
|
17 |
moondream = AutoModelForCausalLM.from_pretrained(
|
18 |
model_id, trust_remote_code=True, revision=revision,
|
19 |
+
attn_implementation="flash_attention_2", torch_dtype=torch.float16
|
20 |
+
)
|
21 |
moondream.eval()
|
22 |
|
23 |
|