adityas129 commited on
Commit
7a84261
·
verified ·
1 Parent(s): 3e8392a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -5
Dockerfile CHANGED
@@ -65,11 +65,30 @@ RUN python -m pip install \
65
  # 3) Install seqio without dependencies
66
  RUN python -m pip install --no-deps "seqio==0.0.11"
67
 
68
- # 4) Comment out tensorflow-text import in seqio since it's not used by Magenta RT
69
- RUN sed -i 's/^import tensorflow_text as tf_text$/# import tensorflow_text as tf_text/' \
70
- /usr/local/lib/python3.11/dist-packages/seqio/vocabularies.py && \
71
- grep -n "tensorflow_text" /usr/local/lib/python3.11/dist-packages/seqio/vocabularies.py || \
72
- echo "Successfully commented out tensorflow_text import"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  # 5) Install correct protobuf version for stable TensorFlow
75
  RUN python -m pip install "protobuf>=3.20.3,<6.0.0"
 
65
  # 3) Install seqio without dependencies
66
  RUN python -m pip install --no-deps "seqio==0.0.11"
67
 
68
+ # 4) Patch seqio to remove tensorflow-text dependency (more reliable than sed)
69
+ RUN python << 'EOF'
70
+ file_path = '/usr/local/lib/python3.11/dist-packages/seqio/vocabularies.py'
71
+ with open(file_path, 'r') as f:
72
+ content = f.read()
73
+
74
+ # Comment out the tensorflow_text import
75
+ content = content.replace(
76
+ 'import tensorflow_text as tf_text',
77
+ '# import tensorflow_text as tf_text # Patched: not needed by Magenta RT'
78
+ )
79
+
80
+ with open(file_path, 'w') as f:
81
+ f.write(content)
82
+
83
+ print('✓ Successfully patched seqio/vocabularies.py')
84
+
85
+ # Verify the patch
86
+ with open(file_path, 'r') as f:
87
+ if '# import tensorflow_text' in f.read():
88
+ print('✓ Verification: tensorflow_text import is commented out')
89
+ else:
90
+ print('✗ Warning: patch may not have worked')
91
+ EOF
92
 
93
  # 5) Install correct protobuf version for stable TensorFlow
94
  RUN python -m pip install "protobuf>=3.20.3,<6.0.0"