File size: 3,944 Bytes
24aaa76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
#SBATCH --job-name=rel2_decide
#SBATCH --partition=ZEN4
#SBATCH --qos=nu-zen4
#SBATCH --gres=none
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --time=01:00:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# RELEASE2: install the owner decisions of 25 Nov 2026 into the release folders. No weight changes.
#  packages: new model_card.json; LICENSE / NOTICE; licence texts (LICENSE.Apache-2.0 for the readers, LICENSE.base-model for PaddleOCR-VL,
#  LICENSE = AGPL-3.0 text for detector and page pipeline); SHA256SUMS rewritten and verified; weights hashed before and after.
#  data: the updated datasheet.json into rc1_data and rc1_data_parquet; their SHA256SUMS updated and verified in full.
# Backups: DATA/release/rc1_cards_before_decisions/<package>/ (card and SHA256SUMS before this job).
set -u
D=/path/to/TURKIC_OCR_DATA
R=$D/release/rc1
B=$D/release/rc1_cards_before_decisions
S=$D/tmp/release2/decisions
L=$D/tmp/release2/licence_texts
echo "start $(date -u +%FT%TZ) host $(hostname)"
PKGS="turkic-ocr-paddleocr-vl-1.6 turkic-ocr-qwen3-vl-2b turkic-ocr-ppocrv6-medium turkic-line-detector-yolo11s page-pipeline"
for pkg in $PKGS; do
  want=$(grep "^$pkg " $S/cards/expected_before_sha256.txt | cut -d' ' -f2)
  have=$(sha256sum $R/$pkg/model_card.json | cut -d' ' -f1)
  if [ "$want" != "$have" ]; then echo "ABORT $pkg: card on disk $have differs from expected $want; nothing changed"; exit 1; fi
done
mkdir -p $B
for pkg in $PKGS; do
  echo "== $pkg"
  mkdir -p $B/$pkg
  cp -p $R/$pkg/model_card.json $R/$pkg/SHA256SUMS $B/$pkg/
  for w in model/model.safetensors best.pt lm/char6.klm; do
    if [ -f $R/$pkg/$w ]; then echo "weights_before $pkg $w $(sha256sum $R/$pkg/$w | cut -d' ' -f1)"; fi
  done
  cp $S/cards/$pkg/model_card.json $R/$pkg/model_card.json
  cp $S/pkg_files/$pkg/* $R/$pkg/
  case $pkg in
    turkic-ocr-paddleocr-vl-1.6) cp $L/apache-2.0.txt $R/$pkg/LICENSE.Apache-2.0; cp $L/paddleocr_vl_1_6_LICENSE $R/$pkg/LICENSE.base-model ;;
    turkic-ocr-qwen3-vl-2b|turkic-ocr-ppocrv6-medium) cp $L/apache-2.0.txt $R/$pkg/LICENSE.Apache-2.0 ;;
    *) cp $L/agpl-3.0.txt $R/$pkg/LICENSE ;;
  esac
  chmod a+r $R/$pkg/*
  if [ -d $R/$pkg/__pycache__ ]; then echo "removing stray $pkg/__pycache__: $(ls $R/$pkg/__pycache__)"; rm -rf $R/$pkg/__pycache__; fi
  cd $R/$pkg
  rm -f SHA256SUMS
  find . -type f | sort | xargs sha256sum > $D/tmp/release2/dec_sums_$pkg.tmp
  cp $D/tmp/release2/dec_sums_$pkg.tmp SHA256SUMS
  sha256sum -c --quiet SHA256SUMS && echo "sha256sums_ok $pkg files $(wc -l < SHA256SUMS)"
  echo "new_or_changed: $(diff <(sort -k2 $B/$pkg/SHA256SUMS) <(sort -k2 SHA256SUMS) | grep '^>' | cut -c69- | tr '\n' ' ')"
  for w in model/model.safetensors best.pt lm/char6.klm; do
    if [ -f $R/$pkg/$w ]; then echo "weights_after $pkg $w $(sha256sum $R/$pkg/$w | cut -d' ' -f1)"; fi
  done
  echo "card_sha256 $pkg $(sha256sum model_card.json | cut -d' ' -f1)"
done
for P in $D/release/rc1_data $D/release/rc1_data_parquet; do
  echo "== data $P"
  cp $S/datasheet.json $P/datasheet.json
  chmod a+r $P/datasheet.json
  cd $P
  grep -v "  datasheet.json$" SHA256SUMS > $D/tmp/release2/dec_data_sums.tmp
  sha256sum datasheet.json >> $D/tmp/release2/dec_data_sums.tmp
  sort -k2 $D/tmp/release2/dec_data_sums.tmp > SHA256SUMS
  sha256sum -c --quiet SHA256SUMS && echo "data_sha256sums_ok files $(wc -l < SHA256SUMS)"
  echo "files_not_in_sums $(find . -type f ! -name SHA256SUMS -printf '%P\n' | sort | comm -23 - <(cut -c67- SHA256SUMS | sort) | wc -l)"
  echo "datasheet_sha256 $(sha256sum datasheet.json | cut -d' ' -f1)"
done
cp $S/rel2_d5_detector_retrain.sbatch /path/to/TURKIC_OCR_CODE/scripts/release2/rel2_d5_detector_retrain.sbatch
echo "d5 sbatch placed (not submitted): $(sha256sum /path/to/TURKIC_OCR_CODE/scripts/release2/rel2_d5_detector_retrain.sbatch | cut -d' ' -f1)"
chmod -R a+rX $R $D/release/rc1_data $D/release/rc1_data_parquet
echo "end $(date -u +%FT%TZ)"