Purpose: emit Crucible trace events from real Hugging Face Transformers models through PyTorch when Elixir-native providers cannot expose required internals.
tools/python/crucible_torch_trace.py runs a real AutoModelForCausalLM
forward pass and a manual greedy generation loop. It writes bounded summaries,
not raw tensor arrays.
Captured signals:
input_idsattention_maskfinal_logitshidden_stateattention_weightsgeneration_step_logitsgeneration_tokendecoded_text
The worker writes:
tmp/crucible_v5/traces/python/<name>.trace.jsonltmp/crucible_v5/capability_reports/<name>.capability_report.jsontmp/crucible_v5/reports/<name>.python_trace_report.json
Run the tiny GPT-2 control:
python3 tools/python/crucible_torch_trace.py \
--model-id hf-internal-testing/tiny-random-gpt2 \
--model-family gpt2 \
--prompt "Hi" \
--artifact-root tmp/crucible_v5 \
--trace-name python_torch_tiny_random_gpt2_phase15 \
--max-new-tokens 4 \
--top-k 5Run standard GPT-2:
python3 tools/python/crucible_torch_trace.py \
--model-id gpt2 \
--model-family gpt2 \
--prompt "Hi" \
--artifact-root tmp/crucible_v5 \
--trace-name python_torch_gpt2_phase15 \
--max-new-tokens 3 \
--top-k 5Replay through Trinity:
mix trinity.crucible.inspect \
--trace tmp/crucible_v5/traces/python/python_torch_gpt2_phase15.trace.jsonl \
--artifact-root tmp/crucible_v5
mix trinity.crucible.matrix_eval \
--trace tmp/crucible_v5/traces/python \
--artifact-root tmp/crucible_v5For V5, this worker is an external trace provider, not a supervised Python
runtime. snakepit is the candidate long-lived Python process pool and
snakebridge is the candidate higher-level Python binding/contract layer. They
are not inserted into this phase because the acceptance gate is trace proof over
real model internals, and the stable contract is the Crucible JSONL trace plus
capability report.
The next supervised provider phase should put Python worker lifecycle under
self_hosted_inference_core provider behavior after the trace contract has
stayed stable.