Spaces:
Sleeping
Sleeping
Commit ·
507cb85
1
Parent(s): b2c482e
Server Deployment
Browse files- Dockerfile +2 -0
- model.py +6 -1
Dockerfile
CHANGED
|
@@ -8,4 +8,6 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
|
|
|
|
|
|
|
| 11 |
CMD ["uvicorn","main:model","--host", "0.0.0.0", "--port", "80"]
|
|
|
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
|
| 11 |
+
RUN mkdir -p /path_to_cache_directory && chmod u+rwx /path_to_cache_directory
|
| 12 |
+
|
| 13 |
CMD ["uvicorn","main:model","--host", "0.0.0.0", "--port", "80"]
|
model.py
CHANGED
|
@@ -6,9 +6,14 @@ repo_id = 'TheBloke/Llama-2-7B-Chat-GGUF'
|
|
| 6 |
# Define the filename you want to download
|
| 7 |
filename = 'llama-2-7b-chat.Q2_K.gguf'
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def model_download():
|
| 10 |
# Download the file
|
| 11 |
file_path = hf_hub_download(
|
| 12 |
repo_id=repo_id,
|
| 13 |
-
filename=filename
|
|
|
|
| 14 |
print(f"File downloaded to: {file_path}")
|
|
|
|
| 6 |
# Define the filename you want to download
|
| 7 |
filename = 'llama-2-7b-chat.Q2_K.gguf'
|
| 8 |
|
| 9 |
+
# Define the cache directory (optional)
|
| 10 |
+
# If not provided, the default cache directory will be used
|
| 11 |
+
cache_dir = './path_to_cache_directory'
|
| 12 |
+
|
| 13 |
def model_download():
|
| 14 |
# Download the file
|
| 15 |
file_path = hf_hub_download(
|
| 16 |
repo_id=repo_id,
|
| 17 |
+
filename=filename,
|
| 18 |
+
cache_dir=cache_dir) # The file_path variable now contains the local path to the downloaded file
|
| 19 |
print(f"File downloaded to: {file_path}")
|