Set conversion temperature to zero
This commit is contained in:
@@ -101,7 +101,7 @@ The conversion was done page by page:
|
||||
6. Save Gemini's returned Markdown as `converted/<source-folder>/page-####.md`.
|
||||
7. Append the page result to `converted/manifest.jsonl`.
|
||||
|
||||
The default model used by the support script is `gemini-3.1-flash-lite`. The script supports parallel page workers and a global request-per-minute gate.
|
||||
The default model used by the support script is `gemini-3.1-flash-lite` with `temperature=0`. The script supports parallel page workers and a global request-per-minute gate.
|
||||
|
||||
Generated Markdown should be treated as AI-assisted OCR/transcription. Use the original source PDF/image as the authoritative record when exact wording matters.
|
||||
|
||||
@@ -132,6 +132,7 @@ Generate or continue the committed archive:
|
||||
```sh
|
||||
python3 scripts/process_dataset_with_gemini.py \
|
||||
--output-dir converted \
|
||||
--temperature 0 \
|
||||
--workers 16 \
|
||||
--rpm 10000
|
||||
```
|
||||
@@ -142,6 +143,7 @@ Useful options:
|
||||
|
||||
- `--workers N` controls page-level parallelism. It can also be set with `GEMINI_WORKERS`.
|
||||
- `--rpm N` controls the global Gemini request-per-minute gate. It can also be set with `GEMINI_RPM`.
|
||||
- `--temperature N` controls Gemini generation temperature. It defaults to `0`.
|
||||
- `--pages 1,4,9-12` processes selected pages only.
|
||||
- `--max-docs N` and `--max-pages-per-doc N` are useful for smoke tests.
|
||||
- `--local-only` ignores metadata downloads and processes files already present in `downloads/`.
|
||||
|
||||
@@ -25,6 +25,7 @@ from typing import Iterable
|
||||
|
||||
SUPPORTED_EXTENSIONS = {".pdf", ".jpg", ".jpeg", ".png", ".webp", ".tif", ".tiff"}
|
||||
DEFAULT_MODEL = "gemini-3.1-flash-lite"
|
||||
DEFAULT_TEMPERATURE = 0.0
|
||||
DEFAULT_WORKERS = max(1, min(16, (os.cpu_count() or 4) * 2))
|
||||
DEFAULT_RPM = 10_000
|
||||
|
||||
@@ -405,11 +406,12 @@ def gemini_page_markdown(
|
||||
prompt: str,
|
||||
image_bytes: bytes,
|
||||
mime_type: str,
|
||||
temperature: float,
|
||||
retries: int,
|
||||
retry_sleep: float,
|
||||
rate_limiter: RequestRateLimiter | None,
|
||||
) -> str:
|
||||
config_kwargs: dict[str, object] = {}
|
||||
config_kwargs: dict[str, object] = {"temperature": temperature}
|
||||
if thinking_level.lower() != "none":
|
||||
thinking_fields = getattr(types_module.ThinkingConfig, "model_fields", {})
|
||||
if "thinking_level" in thinking_fields:
|
||||
@@ -538,6 +540,7 @@ def process_asset(
|
||||
prompt=prompt,
|
||||
image_bytes=image_bytes,
|
||||
mime_type="image/jpeg",
|
||||
temperature=args.temperature,
|
||||
retries=args.retries,
|
||||
retry_sleep=args.retry_sleep,
|
||||
rate_limiter=rate_limiter,
|
||||
@@ -606,6 +609,7 @@ def process_asset(
|
||||
prompt=prompt,
|
||||
image_bytes=image_bytes,
|
||||
mime_type=mime_type,
|
||||
temperature=args.temperature,
|
||||
retries=args.retries,
|
||||
retry_sleep=args.retry_sleep,
|
||||
rate_limiter=rate_limiter,
|
||||
@@ -708,6 +712,7 @@ def process_page_task(
|
||||
prompt=prompt,
|
||||
image_bytes=image_bytes,
|
||||
mime_type=mime_type,
|
||||
temperature=args.temperature,
|
||||
retries=args.retries,
|
||||
retry_sleep=args.retry_sleep,
|
||||
rate_limiter=rate_limiter,
|
||||
@@ -847,6 +852,12 @@ def build_arg_parser() -> argparse.ArgumentParser:
|
||||
parser.add_argument("--downloads-dir", type=Path, default=Path("downloads/war-gov-ufo-release-1"))
|
||||
parser.add_argument("--output-dir", type=Path, default=Path("converted"))
|
||||
parser.add_argument("--model", default=os.environ.get("GEMINI_MODEL", DEFAULT_MODEL))
|
||||
parser.add_argument(
|
||||
"--temperature",
|
||||
type=float,
|
||||
default=float(os.environ.get("GEMINI_TEMPERATURE", DEFAULT_TEMPERATURE)),
|
||||
help="Gemini generation temperature. Defaults to 0 for deterministic transcription.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--workers",
|
||||
type=int,
|
||||
|
||||
Reference in New Issue
Block a user