imravi commited on
Commit
46bbd9c
·
verified ·
1 Parent(s): 38ce632

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +1 -38
Dockerfile CHANGED
@@ -131,41 +131,4 @@ ENV MALLOC_TRIM_THRESHOLD_=0
131
 
132
  # Command to run the app
133
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000", "--timeout-keep-alive", "300"]
134
- EOF
135
-
136
- And here's the updated main.py initialization code:
137
-
138
- <antArtifact identifier="updated-init" type="application/vnd.ant.code" language="python" title="Updated PlantChatbot initialization">
139
- def __init__(self, preprocessed_data_path: str):
140
- self.device = "cuda" if torch.cuda.is_available() else "cpu"
141
-
142
- print("Loading sentence transformer model...")
143
- self.embedding_model = SentenceTransformer(
144
- model_name_or_path="/app/models/sentence_transformer",
145
- device=self.device
146
- )
147
-
148
- print("Loading data...")
149
- self.load_data(preprocessed_data_path)
150
-
151
- print("Loading LLM tokenizer...")
152
- self.tokenizer = AutoTokenizer.from_pretrained(
153
- "/app/models/llm",
154
- trust_remote_code=True,
155
- local_files_only=True
156
- )
157
-
158
- print("Loading LLM model...")
159
- self.model = AutoModelForCausalLM.from_pretrained(
160
- "/app/models/llm",
161
- device_map="auto" if torch.cuda.is_available() else None,
162
- trust_remote_code=True,
163
- torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
164
- local_files_only=True,
165
- low_cpu_mem_usage=True
166
- )
167
-
168
- if self.tokenizer.pad_token is None:
169
- self.tokenizer.pad_token = self.tokenizer.eos_token
170
-
171
- print("Initialization complete!")
 
131
 
132
  # Command to run the app
133
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000", "--timeout-keep-alive", "300"]
134
+ EOF