Spaces:
Running
Running
Jeff Myers II
commited on
Commit
·
49fe584
1
Parent(s):
fea7281
Update space
Browse files- Gemma_Model.py +3 -2
Gemma_Model.py
CHANGED
@@ -2,6 +2,7 @@ from transformers import (
|
|
2 |
AutoTokenizer,
|
3 |
# BitsAndBytesConfig,
|
4 |
Gemma3ForCausalLM,
|
|
|
5 |
)
|
6 |
import torch
|
7 |
import json
|
@@ -20,11 +21,11 @@ class GemmaLLM:
|
|
20 |
device_map="cpu",
|
21 |
# quantization_config=quantization_config,
|
22 |
# low_cpu_mem_usage=True,
|
23 |
-
|
24 |
token=os.environ.get("GEMMA_TOKEN"),
|
25 |
).eval()
|
26 |
|
27 |
-
self.tokenizer =
|
28 |
|
29 |
def generate(self, message) -> str:
|
30 |
print("Generating...")
|
|
|
2 |
AutoTokenizer,
|
3 |
# BitsAndBytesConfig,
|
4 |
Gemma3ForCausalLM,
|
5 |
+
GemmaTokenizerFast
|
6 |
)
|
7 |
import torch
|
8 |
import json
|
|
|
21 |
device_map="cpu",
|
22 |
# quantization_config=quantization_config,
|
23 |
# low_cpu_mem_usage=True,
|
24 |
+
torch_dtype=torch.float16,
|
25 |
token=os.environ.get("GEMMA_TOKEN"),
|
26 |
).eval()
|
27 |
|
28 |
+
self.tokenizer = GemmaTokenizerFast.from_pretrained(model_id, token=os.environ.get("GEMMA_TOKEN"))
|
29 |
|
30 |
def generate(self, message) -> str:
|
31 |
print("Generating...")
|