Spaces:
Running
Running
Jeff Myers II
commited on
Commit
·
235fd3f
1
Parent(s):
acf540f
Update space
Browse files- Gemma_Model.py +4 -4
- requirements.txt +2 -1
Gemma_Model.py
CHANGED
@@ -8,14 +8,14 @@ class GemmaLLM:
|
|
8 |
|
9 |
def __init__(self):
|
10 |
model_id = "google/gemma-3-1b-it"
|
11 |
-
|
12 |
|
13 |
self.model = Gemma3ForCausalLM.from_pretrained(
|
14 |
model_id,
|
15 |
device_map="cpu",
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
).eval()
|
20 |
|
21 |
self.tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
|
8 |
|
9 |
def __init__(self):
|
10 |
model_id = "google/gemma-3-1b-it"
|
11 |
+
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
12 |
|
13 |
self.model = Gemma3ForCausalLM.from_pretrained(
|
14 |
model_id,
|
15 |
device_map="cpu",
|
16 |
+
quantization_config=quantization_config,
|
17 |
+
low_cpu_mem_usage=True,
|
18 |
+
torch_dtype=torch.float16,
|
19 |
).eval()
|
20 |
|
21 |
self.tokenizer = AutoTokenizer.from_pretrained(model_id)
|
requirements.txt
CHANGED
@@ -4,4 +4,5 @@ newsapi_python==0.2.7
|
|
4 |
newspaper3k==0.2.8
|
5 |
torch==2.6.0
|
6 |
transformers==4.50.0
|
7 |
-
lxml_html_clean==0.4.1
|
|
|
|
4 |
newspaper3k==0.2.8
|
5 |
torch==2.6.0
|
6 |
transformers==4.50.0
|
7 |
+
lxml_html_clean==0.4.1
|
8 |
+
accelerate==1.5.2
|