Skip to content

build: remove torch cpu e ajusta path #16

build: remove torch cpu e ajusta path

build: remove torch cpu e ajusta path #16

Workflow file for this run

name: extrai_fatos
on: [push, workflow_dispatch]
jobs:
extrai_fatos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build container
run: DOCKER_BUILDKIT=1 docker build --tag dptoie_python .
- name: Run all inputs with all configurations
run: |
set -euo pipefail
mkdir -p outputs
# Define flag combinations to run (same for JSON and CSV)
FLAGS_LIST=("" "-cc" "-sc" "-hs" "-a" "-a -t" "-cc -sc -hs -a -t")
# iterate only over .conll files in the inputs directory
for input_path in inputs/*.conll; do
[ -f "$input_path" ] || continue
filename=$(basename "$input_path")
# strip last extension only (handles names like ceten-200.conll)
name="${filename%.*}"
# detect input type: .txt -> --input-type txt, otherwise assume conll
if [[ "$filename" == *.txt ]]; then
input_args="--input-type txt"
else
input_args="-it conll"
fi
for flags in "${FLAGS_LIST[@]}"; do
# --- JSON ---
echo "[JSON] input=$filename flags=[$flags]"
# remove stale json output if any
rm -f ./outputs/output.json
docker run --rm -v "$(pwd)":/dptoie_python dptoie_python poetry run python3 src/dptoie/main.py -i "$input_path" $input_args $flags || echo "json-run-failed for $filename $flags"
# compute cleaned suffix for filename (empty => base name only)
if [[ -z "$flags" ]]; then
out_json="./outputs/${name}.json"
else
cleaned=$(echo "$flags" | sed -E "s/^\s*-//; s/\s+-/ /g; s/\s+/-/g; s/^-//")
# remove any leading/trailing hyphens/spaces
cleaned=$(echo "$cleaned" | sed -E 's/^[ -]+//; s/[ -]+$//; s/\s+/-/g')
out_json="./outputs/${name}-${cleaned}.json"
fi
if [[ -f ./outputs/output.json ]]; then
mv ./outputs/output.json "$out_json"
else
echo "Warning: JSON output not produced for $filename with flags [$flags]"
fi
# --- CSV ---
echo "[CSV] input=$filename flags=[$flags]"
# remove stale csv output if any
rm -f ./outputs/output.csv
docker run --rm -v "$(pwd)":/dptoie_python dptoie_python poetry run python3 src/dptoie/main.py -i "$input_path" $input_args $flags -o ./outputs/output.csv -ot csv || echo "csv-run-failed for $filename $flags"
if [[ -z "$flags" ]]; then
out_csv="./outputs/${name}.csv"
else
cleaned=$(echo "$flags" | sed -E "s/^\s*-//; s/\s+-/ /g; s/\s+/-/g; s/^-//")
cleaned=$(echo "$cleaned" | sed -E 's/^[ -]+//; s/[ -]+$//; s/\s+/-/g')
out_csv="./outputs/${name}-${cleaned}.csv"
fi
if [[ -f ./outputs/output.csv ]]; then
mv ./outputs/output.csv "$out_csv"
else
echo "Warning: CSV output not produced for $filename with flags [$flags]"
fi
done
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: extrai_fatos_outputs
path: |
./outputs