Spaces:
Sleeping
Sleeping
Commit ·
95fbfc5
1
Parent(s): 5b0f561
ATPC fixes
Browse files- Dockerfile +2 -2
- src/utils/data_processor.py +9 -14
Dockerfile
CHANGED
|
@@ -17,8 +17,8 @@ COPY . .
|
|
| 17 |
# Install Python dependencies
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
-
# Pre-download PyABSA checkpoint during build
|
| 21 |
-
RUN python -c "
|
| 22 |
|
| 23 |
# Expose port
|
| 24 |
EXPOSE 7860
|
|
|
|
| 17 |
# Install Python dependencies
|
| 18 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# Pre-download PyABSA checkpoint during build (using correct v2.4.2 API)
|
| 21 |
+
RUN python -c "from pyabsa import available_checkpoints; print('Available checkpoints:', available_checkpoints()); from pyabsa import checkpoint_utils; checkpoint_utils.download_all_available_checkpoints()" || echo "PyABSA checkpoint download skipped, will download at runtime"
|
| 22 |
|
| 23 |
# Expose port
|
| 24 |
EXPOSE 7860
|
src/utils/data_processor.py
CHANGED
|
@@ -215,7 +215,6 @@ class ABSAProcessor:
|
|
| 215 |
warnings.filterwarnings('ignore', category=DeprecationWarning)
|
| 216 |
|
| 217 |
import pyabsa
|
| 218 |
-
from pyabsa import ATEPCCheckpointManager
|
| 219 |
|
| 220 |
# Check if git is available
|
| 221 |
try:
|
|
@@ -228,20 +227,16 @@ class ABSAProcessor:
|
|
| 228 |
except Exception as git_err:
|
| 229 |
logger.warning(f"Git not found or not executable: {str(git_err)}")
|
| 230 |
|
| 231 |
-
# Try
|
| 232 |
-
|
|
|
|
|
|
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
# Fallback to downloading checkpoint (requires git)
|
| 240 |
-
logger.info("Local checkpoint not found, downloading multilingual checkpoint...")
|
| 241 |
-
logger.info("This may take a few minutes on first run...")
|
| 242 |
-
checkpoint = ATEPCCheckpointManager.get_checkpoint('multilingual')
|
| 243 |
-
self.model = pyabsa.load_aspect_extractor(checkpoint=checkpoint)
|
| 244 |
-
logger.info("✅ PyABSA model loaded successfully from downloaded checkpoint")
|
| 245 |
|
| 246 |
except Exception as e:
|
| 247 |
import traceback
|
|
|
|
| 215 |
warnings.filterwarnings('ignore', category=DeprecationWarning)
|
| 216 |
|
| 217 |
import pyabsa
|
|
|
|
| 218 |
|
| 219 |
# Check if git is available
|
| 220 |
try:
|
|
|
|
| 227 |
except Exception as git_err:
|
| 228 |
logger.warning(f"Git not found or not executable: {str(git_err)}")
|
| 229 |
|
| 230 |
+
# Try to load aspect extractor with multilingual checkpoint
|
| 231 |
+
# PyABSA v2.4.2 handles checkpoint downloading automatically
|
| 232 |
+
logger.info("Loading PyABSA multilingual model...")
|
| 233 |
+
logger.info("This may take a few minutes on first run (downloading checkpoint)...")
|
| 234 |
|
| 235 |
+
self.model = pyabsa.load_aspect_extractor(
|
| 236 |
+
checkpoint='multilingual',
|
| 237 |
+
auto_device=True # Let PyABSA choose device (CPU in this case)
|
| 238 |
+
)
|
| 239 |
+
logger.info("✅ PyABSA model loaded successfully")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
except Exception as e:
|
| 242 |
import traceback
|