Do0rMaMu commited on
Commit
2cc21fa
1 Parent(s): 443e409

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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
- # Apply the patch to remove flash-attn dependency and download the Florence-2-base-ft model and processor
14
- RUN python -c "\
15
- import os; \
16
- from unittest.mock import patch; \
17
- from transformers import AutoModelForCausalLM, AutoProcessor; \
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 . .