Daniel Marques commited on
Commit
302fc29
1 Parent(s): 07c4eee

feat: add tranning in start container

Browse files
Files changed (2) hide show
  1. ingest.py +2 -5
  2. run.sh +4 -1
ingest.py CHANGED
@@ -19,7 +19,6 @@ from constants import (
19
  SOURCE_DIRECTORY,
20
  )
21
 
22
-
23
  def load_single_document(file_path: str) -> Document:
24
  # Loads a single document from a file path
25
  file_extension = os.path.splitext(file_path)[1]
@@ -134,8 +133,9 @@ def main(device_type):
134
  # Create embeddings
135
  embeddings = HuggingFaceInstructEmbeddings(
136
  model_name=EMBEDDING_MODEL_NAME,
137
- model_kwargs={"device": device_type},
138
  )
 
139
  # change the embedding type here if you are running into issues.
140
  # These are much smaller embeddings and will work for most appications
141
  # If you use HuggingFaceEmbeddings, make sure to also use the same in the
@@ -159,6 +159,3 @@ if __name__ == "__main__":
159
  format="%(asctime)s - %(levelname)s - %(filename)s:%(lineno)s - %(message)s", level=logging.INFO
160
  )
161
  main()
162
- # run_localGPT_API.main()
163
- # localGPTUI.main()
164
-
 
19
  SOURCE_DIRECTORY,
20
  )
21
 
 
22
  def load_single_document(file_path: str) -> Document:
23
  # Loads a single document from a file path
24
  file_extension = os.path.splitext(file_path)[1]
 
133
  # Create embeddings
134
  embeddings = HuggingFaceInstructEmbeddings(
135
  model_name=EMBEDDING_MODEL_NAME,
136
+ model_kwargs={"device": "cuda"},
137
  )
138
+
139
  # change the embedding type here if you are running into issues.
140
  # These are much smaller embeddings and will work for most appications
141
  # If you use HuggingFaceEmbeddings, make sure to also use the same in the
 
159
  format="%(asctime)s - %(levelname)s - %(filename)s:%(lineno)s - %(message)s", level=logging.INFO
160
  )
161
  main()
 
 
 
run.sh CHANGED
@@ -1,4 +1,7 @@
1
- # Redis Support uncomment this lines
 
2
  nohup redis-server &
3
 
 
 
4
  uvicorn "main:app" --port 7860 --host 0.0.0.0
 
1
+ #!/bin/sh
2
+
3
  nohup redis-server &
4
 
5
+ python ingest.py
6
+
7
  uvicorn "main:app" --port 7860 --host 0.0.0.0