Spaces:
Sleeping
Sleeping
LVKinyanjui
commited on
Commit
·
cfd39e4
1
Parent(s):
5158d59
Another attempt to fix the permissions error
Browse files- app_inference.py +1 -1
- examples/techniques/ollama_langchain.py +16 -0
- requirements.txt +2 -1
app_inference.py
CHANGED
@@ -22,7 +22,7 @@ submit = st.button("Submit")
|
|
22 |
|
23 |
# MODEL AREA
|
24 |
# Use the token to authenticate
|
25 |
-
login(token=token)
|
26 |
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
27 |
|
28 |
@st.cache_resource
|
|
|
22 |
|
23 |
# MODEL AREA
|
24 |
# Use the token to authenticate
|
25 |
+
login(token=token, write_permission=True)
|
26 |
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
|
27 |
|
28 |
@st.cache_resource
|
examples/techniques/ollama_langchain.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_core.prompts import ChatPromptTemplate
|
2 |
+
from langchain_ollama.llms import OllamaLLM
|
3 |
+
|
4 |
+
template = """Question: {question}
|
5 |
+
|
6 |
+
Answer: Let's think step by step."""
|
7 |
+
|
8 |
+
prompt = ChatPromptTemplate.from_template(template)
|
9 |
+
|
10 |
+
model = OllamaLLM(model="llama3.2:1b-instruct-q4_K_M")
|
11 |
+
|
12 |
+
chain = prompt | model
|
13 |
+
|
14 |
+
res = chain.invoke({"question": "What is LangChain?"})
|
15 |
+
|
16 |
+
print(res)
|
requirements.txt
CHANGED
@@ -9,5 +9,6 @@ langchain-google-genai==2.0.0
|
|
9 |
langchain-community==0.3.0
|
10 |
python-dotenv==1.0.1
|
11 |
tiktoken==0.7.0
|
12 |
-
torch
|
13 |
huggingface-hub==0.25.1
|
|
|
|
|
|
9 |
langchain-community==0.3.0
|
10 |
python-dotenv==1.0.1
|
11 |
tiktoken==0.7.0
|
|
|
12 |
huggingface-hub==0.25.1
|
13 |
+
torch==2.4.1
|
14 |
+
langchain-ollama==0.2.0
|