Skip to content

Commit

Permalink
Switching to our fork of the repo (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldeutsch authored Oct 7, 2021
1 parent 04ef2cf commit 1c277df
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 174 deletions.
7 changes: 2 additions & 5 deletions models/zhang2021/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ ARG MODELS
WORKDIR /app

# Clone the repository
RUN git clone https://github.com/ZhangShiyue/Lite2-3Pyramid && \
RUN git clone https://github.com/danieldeutsch/Lite2-3Pyramid && \
cd Lite2-3Pyramid && \
git checkout ede30c52fa80a6d80dc2fb32f549ba1f3159860b
git checkout c2a60ff4b42df879ee9be8f0fad1b5ae8160943e

## Install the python dependencies. The Github repo requires torch==1.7.1+cu110, but
## we use torch==1.7.1 with cuda 10.0 instead
Expand All @@ -23,9 +23,6 @@ RUN pip install --no-cache-dir \
# Install nltk dependencies
RUN python -c "import nltk; nltk.download('wordnet'); nltk.download('wordnet_ic'); nltk.download('sentiwordnet')"

# Copy over the scoring code
COPY src/score.py Lite2-3Pyramid/score.py

# Run the warmup code
COPY scripts/warmup.sh warmup.sh
RUN sh warmup.sh
6 changes: 4 additions & 2 deletions models/zhang2021/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ https://github.com/ZhangShiyue/Lite2-3Pyramid


## Docker Information
- Image name: `danieldeutsch/zhang2021:1.0`
- Docker Hub:
- Image name: `danieldeutsch/zhang2021:1.1`
- Docker Hub: https://hub.docker.com/repository/docker/danieldeutsch/zhang2021
- Build command:
```shell script
repro setup zhang2021 [--models <model-name>+]
Expand Down Expand Up @@ -60,3 +60,5 @@ Not tested
- [ ] Predictions exactly replicate results reported in the paper

## Changelog
### v1.1
- Changed to our fork of the repo, which adds support for using the GPU for coref and SRL and saving the results to a file
4 changes: 2 additions & 2 deletions models/zhang2021/scripts/warmup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ echo "This is the reference summary" > references.txt
echo "This is the candidate summary" > summaries.txt
echo "1" > ids.txt
mkdir output
python score.py \
python Lite2-3Pyramid.py \
--extract_stus \
--reference references.txt \
--doc_id ids.txt \
Expand All @@ -13,7 +13,7 @@ python score.py \
# Score the summary using each of the models which
# will pre-cache them
for model_name in ${MODELS}; do
python score.py \
python Lite2-3Pyramid.py \
--unit output/STUs.txt \
--summary summaries.txt \
--model ${model_name} \
Expand Down
Empty file removed models/zhang2021/src/__init__.py
Empty file.
162 changes: 0 additions & 162 deletions models/zhang2021/src/score.py

This file was deleted.

2 changes: 1 addition & 1 deletion repro/models/zhang2021/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

VERSION = "1.0"
VERSION = "1.1"
MODEL_NAME = os.path.basename(os.path.dirname(__file__))
DOCKERHUB_REPO = f"danieldeutsch/{MODEL_NAME}"
DEFAULT_IMAGE = f"{DOCKERHUB_REPO}:{VERSION}"
Expand Down
12 changes: 10 additions & 2 deletions repro/models/zhang2021/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ def extract_stus(
cuda = self.device != -1
if cuda:
commands.append(f"export CUDA_VISIBLE_DEVICES={self.device}")
predict_device = 0
else:
predict_device = -1

extract_command = (
f"python score.py"
f"python Lite2-3Pyramid.py"
f" --extract_stus"
f" --reference {container_summaries_file}"
f" --doc_id {container_ids_file}"
f" --device {predict_device}"
f" --output_dir {container_output_dir}"
)
if use_coref:
Expand Down Expand Up @@ -187,12 +191,16 @@ def predict_batch(
cuda = self.device != -1
if cuda:
commands.append(f"export CUDA_VISIBLE_DEVICES={self.device}")
predict_device = 0
else:
predict_device = -1

score_command = (
f"python score.py"
f"python Lite2-3Pyramid.py"
f" --summary {container_candidates_file}"
f" --unit {container_units_file}"
f" --detail"
f" --device {predict_device}"
f" --output_file {container_output_file}"
)
if self.model is not None:
Expand Down

0 comments on commit 1c277df

Please sign in to comment.