Emmanuel Frimpong Asante
commited on
Commit
·
bd494d1
1
Parent(s):
3abbae6
"Update space"
Browse filesSigned-off-by: Emmanuel Frimpong Asante <[email protected]>
services/llama_service.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# services/llama_service.py
|
2 |
|
3 |
-
|
4 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
|
6 |
# Load Llama model and tokenizer for text generation
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
10 |
|
11 |
# Ensure the tokenizer has a padding token; if not, add a new padding token
|
12 |
if tokenizer.pad_token is None:
|
|
|
1 |
# services/llama_service.py
|
2 |
|
3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
4 |
|
5 |
# Load Llama model and tokenizer for text generation
|
6 |
+
|
7 |
+
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")
|
9 |
+
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B")
|
10 |
|
11 |
# Ensure the tokenizer has a padding token; if not, add a new padding token
|
12 |
if tokenizer.pad_token is None:
|