Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +5 -18
Dockerfile
CHANGED
@@ -10,24 +10,11 @@ COPY requirements.txt /code/requirements.txt
|
|
10 |
# Install any dependencies specified in requirements.txt
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
from transformers.dynamic_module_utils import get_imports; \
|
19 |
-
def fixed_get_imports(filename: os.PathLike) -> list[str]: \
|
20 |
-
if not str(filename).endswith('/modeling_florence2.py'): \
|
21 |
-
return get_imports(filename); \
|
22 |
-
imports = get_imports(filename); \
|
23 |
-
if 'flash_attn' in imports: \
|
24 |
-
imports.remove('flash_attn'); \
|
25 |
-
return imports; \
|
26 |
-
with patch('transformers.dynamic_module_utils.get_imports', fixed_get_imports): \
|
27 |
-
model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base-ft', trust_remote_code=True); \
|
28 |
-
processor = AutoProcessor.from_pretrained('microsoft/Florence-2-base-ft', trust_remote_code=True); \
|
29 |
-
model.save_pretrained('/code/florence_model'); \
|
30 |
-
processor.save_pretrained('/code/florence_processor');"
|
31 |
|
32 |
# Copy the current directory contents into the container at /code
|
33 |
COPY . .
|
|
|
10 |
# Install any dependencies specified in requirements.txt
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
+
# Copy the Python script to download the model
|
14 |
+
COPY download_model.py /code/download_model.py
|
15 |
+
|
16 |
+
# Run the Python script to download the Florence-2-base-ft model and processor
|
17 |
+
RUN python /code/download_model.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
# Copy the current directory contents into the container at /code
|
20 |
COPY . .
|