davanstrien HF Staff commited on
Commit
f5c7d6e
·
verified ·
1 Parent(s): b905bf7

Sync from GitHub via hub-sync

Browse files
Files changed (1) hide show
  1. generate-embeddings.py +15 -1
generate-embeddings.py CHANGED
@@ -315,14 +315,28 @@ def main():
315
  effective = prompt_str if prompt_str is not None else next(
316
  (v for k in side_keys if (v := (getattr(model, "prompts", {}) or {}).get(k))), "")
317
  prompt_line = f"`{effective}`" if effective else "(none)"
 
 
 
 
 
 
 
 
 
318
  card = DatasetCard(
 
319
  f"# {args.output_dataset}\n\n"
320
  f"Embeddings of [`{args.input_dataset}`](https://huggingface.co/datasets/{args.input_dataset}) "
321
  f"column `{args.column}`.\n\n"
322
  f"- Model: [`{args.model}`](https://huggingface.co/{args.model}) (dim {dim})\n"
323
  f"- Column: `{args.output_column}` · normalized: {args.normalize}\n"
324
  f"- Prompt prepended ({'query' if args.query_mode else 'document'} side): {prompt_line}\n\n"
325
- f"Produced on Hugging Face Jobs with `uv-scripts/embeddings/generate-embeddings.py`.\n"
 
 
 
 
326
  )
327
  # Retry the push with an XET-disable fallback: a transient upload failure here would
328
  # otherwise lose the whole (paid) embedding run.
 
315
  effective = prompt_str if prompt_str is not None else next(
316
  (v for k in side_keys if (v := (getattr(model, "prompts", {}) or {}).get(k))), "")
317
  prompt_line = f"`{effective}`" if effective else "(none)"
318
+ # Canonical provenance stamp (see AGENTS.md): Jobs claim gated on JOB_ID, set by HF Jobs in-container.
319
+ script_url = "https://huggingface.co/datasets/uv-scripts/embeddings/raw/main/generate-embeddings.py"
320
+ on_jobs = os.environ.get("JOB_ID") is not None
321
+ hw = os.environ.get("ACCELERATOR") or ""
322
+ origin = (
323
+ "Produced on [Hugging Face Jobs](https://huggingface.co/docs/huggingface_hub/guides/jobs)"
324
+ + (f" (`{hw}`)" if hw else "")
325
+ ) if on_jobs else "Generated"
326
+ jobs_tag = "\n- hf-jobs" if on_jobs else ""
327
  card = DatasetCard(
328
+ f"---\ntags:\n- embeddings\n- uv-script\n- generated{jobs_tag}\n---\n\n"
329
  f"# {args.output_dataset}\n\n"
330
  f"Embeddings of [`{args.input_dataset}`](https://huggingface.co/datasets/{args.input_dataset}) "
331
  f"column `{args.column}`.\n\n"
332
  f"- Model: [`{args.model}`](https://huggingface.co/{args.model}) (dim {dim})\n"
333
  f"- Column: `{args.output_column}` · normalized: {args.normalize}\n"
334
  f"- Prompt prepended ({'query' if args.query_mode else 'document'} side): {prompt_line}\n\n"
335
+ f"## Reproduction\n\n"
336
+ f"{origin} with the [`generate-embeddings.py`]({script_url}) recipe "
337
+ f"from [uv-scripts](https://huggingface.co/uv-scripts). Run it yourself:\n\n"
338
+ f"```bash\nhf jobs uv run {script_url} \\\n"
339
+ f" {args.input_dataset} <output-dataset> --column {args.column} --model {args.model}\n```\n"
340
  )
341
  # Retry the push with an XET-disable fallback: a transient upload failure here would
342
  # otherwise lose the whole (paid) embedding run.