Spaces:
Sleeping
Sleeping
removed huggingface_hub
Browse files- backend.py +7 -7
backend.py
CHANGED
@@ -13,10 +13,10 @@ from llama_cpp import Llama
|
|
13 |
import spaces
|
14 |
|
15 |
|
16 |
-
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
17 |
|
18 |
|
19 |
-
hf_hub_download(
|
20 |
repo_id="google/gemma-2-2b-it-GGUF",
|
21 |
filename="2b_it_v2.gguf",
|
22 |
local_dir="./models",
|
@@ -29,20 +29,20 @@ llm = Llama(
|
|
29 |
_gpu_layers=81,
|
30 |
n_batch=1024,
|
31 |
n_ctx=8192,
|
32 |
-
)
|
33 |
|
34 |
|
35 |
-
|
36 |
tokenizer = GemmaTokenizerFast.from_pretrained(model_id)
|
37 |
model = AutoModelForCausalLM.from_pretrained(
|
38 |
model_id,
|
39 |
device_map="auto",
|
40 |
torch_dtype= torch.float16 if torch.cuda.is_available() else torch.float32,
|
41 |
-
)
|
42 |
# what models will be used by LlamaIndex:
|
43 |
Settings.embed_model = InstructorEmbedding(model_name="hkunlp/instructor-base")
|
44 |
-
|
45 |
-
Settings.llm = llm
|
46 |
|
47 |
|
48 |
############################---------------------------------
|
|
|
13 |
import spaces
|
14 |
|
15 |
|
16 |
+
#huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
17 |
|
18 |
|
19 |
+
"""hf_hub_download(
|
20 |
repo_id="google/gemma-2-2b-it-GGUF",
|
21 |
filename="2b_it_v2.gguf",
|
22 |
local_dir="./models",
|
|
|
29 |
_gpu_layers=81,
|
30 |
n_batch=1024,
|
31 |
n_ctx=8192,
|
32 |
+
)"""
|
33 |
|
34 |
|
35 |
+
model_id = "google/gemma-2-2b-it"
|
36 |
tokenizer = GemmaTokenizerFast.from_pretrained(model_id)
|
37 |
model = AutoModelForCausalLM.from_pretrained(
|
38 |
model_id,
|
39 |
device_map="auto",
|
40 |
torch_dtype= torch.float16 if torch.cuda.is_available() else torch.float32,
|
41 |
+
)
|
42 |
# what models will be used by LlamaIndex:
|
43 |
Settings.embed_model = InstructorEmbedding(model_name="hkunlp/instructor-base")
|
44 |
+
Settings.llm = GemmaLLMInterface(model=model, tokenizer=tokenizer)
|
45 |
+
#Settings.llm = llm
|
46 |
|
47 |
|
48 |
############################---------------------------------
|