heikowagner commited on
Commit
2a07ef4
2 Parent(s): 21e8045 73d6caa

Merge branch 'main' of https://huggingface.co/spaces/heikowagner/GPT-Docker

Browse files
Files changed (5) hide show
  1. Dockerfile +1 -1
  2. app/load_model.py +1 -1
  3. app/run.py +5 -3
  4. app/utils.py +2 -2
  5. requirements.txt +2 -1
Dockerfile CHANGED
@@ -38,7 +38,6 @@ RUN mkdir /nltk_data
38
  RUN mkdir /VectorStore
39
  RUN mkdir /app/.cache
40
  RUN mkdir /mymodels
41
- RUN mkdir /app/mymodels
42
  RUN ls -la
43
  RUN python run.py
44
  RUN chmod 777 /VectorStore
@@ -47,6 +46,7 @@ RUN chmod 777 /nltk_data
47
  RUN chmod 777 /.cache
48
  RUN chmod 777 /app/.cache
49
  RUN chmod 777 /app/mymodels
 
50
  CMD ["streamlit", "run", "app.py", "--server.port=7860"]
51
  #CMD ls -la
52
  EXPOSE 7860
 
38
  RUN mkdir /VectorStore
39
  RUN mkdir /app/.cache
40
  RUN mkdir /mymodels
 
41
  RUN ls -la
42
  RUN python run.py
43
  RUN chmod 777 /VectorStore
 
46
  RUN chmod 777 /.cache
47
  RUN chmod 777 /app/.cache
48
  RUN chmod 777 /app/mymodels
49
+ RUN chmod 777 /app/VectorStore/
50
  CMD ["streamlit", "run", "app.py", "--server.port=7860"]
51
  #CMD ls -la
52
  EXPOSE 7860
app/load_model.py CHANGED
@@ -89,7 +89,7 @@ def load_openai_model(temperature=0.9):
89
  def load_openai_embedding():
90
  return OpenAIEmbeddings()
91
 
92
- @st.cache_resource
93
  def load_embedding(model_name):
94
  embeddings = HuggingFaceInstructEmbeddings(
95
  query_instruction="Represent the query for retrieval: ",
 
89
  def load_openai_embedding():
90
  return OpenAIEmbeddings()
91
 
92
+ #@st.cache_resource
93
  def load_embedding(model_name):
94
  embeddings = HuggingFaceInstructEmbeddings(
95
  query_instruction="Represent the query for retrieval: ",
app/run.py CHANGED
@@ -1,4 +1,4 @@
1
- # This script inits the models and adds an example collection to the Vectorstore
2
  # %%
3
  import os
4
  import pathlib
@@ -13,7 +13,7 @@ with open(current_path+'/.openaiapikey', 'r') as reader:
13
  import load_model
14
 
15
  # %%
16
- #load_model.load_gpu_model("decapoda-research/llama-7b-hf") #Download local model
17
  llm= load_model.load_openai_model()
18
 
19
  # %%
@@ -26,7 +26,9 @@ metadata= {"loaded_docs":[], "Subject":"Heikos Papers", "model_name": ef.model_n
26
  selected_collection = client.create_collection(collection_name, embedding_function=ef, metadata=metadata)
27
 
28
  docs_tarifs= [
29
- "https://edoc.hu-berlin.de/bitstream/handle/18452/5294/33.pdf",
 
 
30
  ]
31
 
32
  # %%
 
1
+ # This script inits the models and adds an example collection to the Vectorstore
2
  # %%
3
  import os
4
  import pathlib
 
13
  import load_model
14
 
15
  # %%
16
+ load_model.load_gpu_model("decapoda-research/llama-7b-hf") #Download local model
17
  llm= load_model.load_openai_model()
18
 
19
  # %%
 
26
  selected_collection = client.create_collection(collection_name, embedding_function=ef, metadata=metadata)
27
 
28
  docs_tarifs= [
29
+ "https://edoc.hu-berlin.de/bitstream/handle/18452/5294/33.pdf",
30
+ "https://arxiv.org/pdf/1702.03556v3.pdf",
31
+ "https://arxiv.org/pdf/1706.03762"
32
  ]
33
 
34
  # %%
app/utils.py CHANGED
@@ -22,12 +22,12 @@ def format_result_set(result):
22
  for document in source_documents:
23
  st.write(format_document(document))
24
 
25
- @st.cache_resource
26
  def get_chroma_client():
27
  return chromadb.Client(Settings(chroma_db_impl="duckdb+parquet",
28
  persist_directory=persist_directory
29
  ))
30
- @st.cache_data
31
  def retrieve_collections():
32
  client = get_chroma_client()
33
  all_collections = client.list_collections()
 
22
  for document in source_documents:
23
  st.write(format_document(document))
24
 
25
+ #@st.cache_resource
26
  def get_chroma_client():
27
  return chromadb.Client(Settings(chroma_db_impl="duckdb+parquet",
28
  persist_directory=persist_directory
29
  ))
30
+ #@st.cache_data
31
  def retrieve_collections():
32
  client = get_chroma_client()
33
  all_collections = client.list_collections()
requirements.txt CHANGED
@@ -1,7 +1,8 @@
1
  #git+https://github.com/hwchase17/langchain.git
2
  langchain==0.0.154
3
  git+https://github.com/huggingface/transformers.git
4
- git+https://github.com/chroma-core/chroma.git
 
5
  accelerate
6
  bitsandbytes
7
  InstructorEmbedding
 
1
  #git+https://github.com/hwchase17/langchain.git
2
  langchain==0.0.154
3
  git+https://github.com/huggingface/transformers.git
4
+ #git+https://github.com/chroma-core/chroma.git
5
+ chromadb
6
  accelerate
7
  bitsandbytes
8
  InstructorEmbedding