Spaces:
Sleeping
Sleeping
debug java error
Browse files- Dockerfile +3 -2
- evaluator.py +6 -2
Dockerfile
CHANGED
|
@@ -16,8 +16,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 16 |
# Pre-download NLTK data
|
| 17 |
RUN python -c "import nltk; nltk.download('wordnet', download_dir='/usr/share/nltk_data'); nltk.download('omw-1.4', download_dir='/usr/share/nltk_data')"
|
| 18 |
|
| 19 |
-
# Download SPICE-1.0 from HF dataset repo
|
| 20 |
-
RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='Gayanukaa/spice-1.0-jar', repo_type='dataset', local_dir='/app/SPICE-1.0')"
|
|
|
|
| 21 |
|
| 22 |
COPY --chown=user:user . .
|
| 23 |
|
|
|
|
| 16 |
# Pre-download NLTK data
|
| 17 |
RUN python -c "import nltk; nltk.download('wordnet', download_dir='/usr/share/nltk_data'); nltk.download('omw-1.4', download_dir='/usr/share/nltk_data')"
|
| 18 |
|
| 19 |
+
# Download SPICE-1.0 from HF dataset repo and fix ownership for non-root user
|
| 20 |
+
RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='Gayanukaa/spice-1.0-jar', repo_type='dataset', local_dir='/app/SPICE-1.0')" \
|
| 21 |
+
&& chown -R user:user /app/SPICE-1.0
|
| 22 |
|
| 23 |
COPY --chown=user:user . .
|
| 24 |
|
evaluator.py
CHANGED
|
@@ -31,12 +31,16 @@ def _run_spice(input_json: str, output_json: str, detailed: bool, log_fn=None) -
|
|
| 31 |
proc = subprocess.Popen(
|
| 32 |
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True
|
| 33 |
)
|
|
|
|
| 34 |
for line in proc.stdout:
|
|
|
|
|
|
|
| 35 |
if log_fn:
|
| 36 |
-
log_fn(
|
| 37 |
ret = proc.wait()
|
| 38 |
if ret != 0:
|
| 39 |
-
|
|
|
|
| 40 |
|
| 41 |
with open(output_json, "r") as f:
|
| 42 |
results = json.load(f)
|
|
|
|
| 31 |
proc = subprocess.Popen(
|
| 32 |
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True
|
| 33 |
)
|
| 34 |
+
output_lines = []
|
| 35 |
for line in proc.stdout:
|
| 36 |
+
stripped = line.rstrip()
|
| 37 |
+
output_lines.append(stripped)
|
| 38 |
if log_fn:
|
| 39 |
+
log_fn(stripped)
|
| 40 |
ret = proc.wait()
|
| 41 |
if ret != 0:
|
| 42 |
+
tail = "\n".join(output_lines[-20:])
|
| 43 |
+
raise RuntimeError(f"SPICE exited {ret}. Output:\n{tail}")
|
| 44 |
|
| 45 |
with open(output_json, "r") as f:
|
| 46 |
results = json.load(f)
|