Spaces:
Runtime error
Runtime error
mohamedalcafory
commited on
Commit
•
ccba80f
1
Parent(s):
61e4013
Update app.py
Browse files
app.py
CHANGED
@@ -27,9 +27,16 @@ from langchain_core.output_parsers import StrOutputParser
|
|
27 |
from langchain_core.runnables import RunnablePassthrough
|
28 |
|
29 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
from transformers import pipeline
|
35 |
from langchain_huggingface import HuggingFacePipeline
|
|
|
27 |
from langchain_core.runnables import RunnablePassthrough
|
28 |
|
29 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
30 |
+
from transformers import AutoModel, AutoTokenizer
|
31 |
+
|
32 |
+
base_model_name = "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit" # Replace with your actual base model path
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
34 |
+
model = AutoModel.from_pretrained(base_model_name)
|
35 |
+
adapter_path = "mohamedalcafory/PubMed_Llama3.1_Based_model" # Replace with your actual adapter path
|
36 |
+
model.load_adapter(adapter_path)
|
37 |
+
# tokenizer = AutoTokenizer.from_pretrained("mohamedalcafory/PubMed_Llama3.1_Based_model")
|
38 |
+
# model = AutoModelForCausalLM.from_pretrained("mohamedalcafory/PubMed_Llama3.1_Based_model")
|
39 |
+
print(f'Model loaded successfully: {model}')
|
40 |
|
41 |
from transformers import pipeline
|
42 |
from langchain_huggingface import HuggingFacePipeline
|