SYMBOL INDEX (2672 symbols across 232 files) FILE: tests/compare_sampling_training_logprobs.py function get_reference_document (line 17) | def get_reference_document(): function get_row (line 25) | async def get_row( class Config (line 95) | class Config: function main (line 105) | async def main(config: Config): FILE: tests/conftest.py function pytest_collection_modifyitems (line 19) | def pytest_collection_modifyitems(config, items): FILE: tests/downstream_compat/conftest.py function pytest_collection_modifyitems (line 15) | def pytest_collection_modifyitems(config, items): FILE: tests/downstream_compat/sig_helpers.py function get_param_names (line 6) | def get_param_names(func) -> list[str]: function assert_params (line 12) | def assert_params(func, expected_params: list[str]) -> None: function assert_params_subset (line 20) | def assert_params_subset(func, required_params: list[str]) -> None: FILE: tests/downstream_compat/test_checkpoint_utils.py class TestCheckpointRecord (line 16) | class TestCheckpointRecord: method test_fields (line 17) | def test_fields(self): method test_constructable_minimal (line 22) | def test_constructable_minimal(self): method test_to_dict (line 28) | def test_to_dict(self): method test_from_dict (line 34) | def test_from_dict(self): method test_roundtrip (line 40) | def test_roundtrip(self): method test_has_method (line 46) | def test_has_method(self): method test_get_method (line 51) | def test_get_method(self): class TestCheckpointFunctions (line 56) | class TestCheckpointFunctions: method test_load_checkpoints_file_signature (line 57) | def test_load_checkpoints_file_signature(self): method test_get_last_checkpoint_signature (line 62) | def test_get_last_checkpoint_signature(self): method test_save_checkpoint_signature (line 67) | def test_save_checkpoint_signature(self): method test_save_checkpoint_async_exists (line 72) | def test_save_checkpoint_async_exists(self): method test_checkpoint_record_has_signature (line 77) | def test_checkpoint_record_has_signature(self): method test_checkpoint_record_get_signature (line 82) | def test_checkpoint_record_get_signature(self): FILE: tests/downstream_compat/test_cli_and_hyperparam.py class TestCliUtils (line 14) | class TestCliUtils: method test_check_log_dir_signature (line 15) | def test_check_log_dir_signature(self): class TestHyperparamUtils (line 21) | class TestHyperparamUtils: method test_get_lr_signature (line 22) | def test_get_lr_signature(self): method test_get_lora_lr_over_full_finetune_lr_signature (line 27) | def test_get_lora_lr_over_full_finetune_lr_signature(self): method test_get_lora_param_count_signature (line 32) | def test_get_lora_param_count_signature(self): method test_get_lr_returns_float (line 37) | def test_get_lr_returns_float(self): FILE: tests/downstream_compat/test_completers.py class TestTokensWithLogprobs (line 17) | class TestTokensWithLogprobs: method test_fields (line 18) | def test_fields(self): method test_logprobs_property (line 23) | def test_logprobs_property(self): method test_logprobs_raises_when_none (line 27) | def test_logprobs_raises_when_none(self): method test_none_logprobs (line 34) | def test_none_logprobs(self): class TestTokenCompleter (line 39) | class TestTokenCompleter: method test_is_callable (line 40) | def test_is_callable(self): method test_call_is_async (line 43) | def test_call_is_async(self): method test_call_signature (line 46) | def test_call_signature(self): class TestMessageCompleter (line 52) | class TestMessageCompleter: method test_is_callable (line 53) | def test_is_callable(self): method test_call_is_async (line 56) | def test_call_is_async(self): method test_call_signature (line 59) | def test_call_signature(self): class TestTinkerTokenCompleter (line 65) | class TestTinkerTokenCompleter: method test_is_subclass_of_token_completer (line 66) | def test_is_subclass_of_token_completer(self): method test_has_expected_fields (line 69) | def test_has_expected_fields(self): class TestStopCondition (line 77) | class TestStopCondition: method test_is_type_alias (line 78) | def test_is_type_alias(self): FILE: tests/downstream_compat/test_model_info.py class TestModelAttributes (line 16) | class TestModelAttributes: method test_fields (line 17) | def test_fields(self): method test_constructable (line 29) | def test_constructable(self): class TestModelInfoFunctions (line 41) | class TestModelInfoFunctions: method test_get_model_attributes_returns_model_attributes (line 42) | def test_get_model_attributes_returns_model_attributes(self): method test_get_recommended_renderer_name_returns_string (line 47) | def test_get_recommended_renderer_name_returns_string(self): method test_get_recommended_renderer_names_returns_list (line 52) | def test_get_recommended_renderer_names_returns_list(self): method test_recommended_renderer_name_is_first_of_names (line 58) | def test_recommended_renderer_name_is_first_of_names(self): class TestModelInfoSignatures (line 64) | class TestModelInfoSignatures: method test_get_model_attributes_signature (line 65) | def test_get_model_attributes_signature(self): method test_get_recommended_renderer_name_signature (line 70) | def test_get_recommended_renderer_name_signature(self): method test_get_recommended_renderer_names_signature (line 75) | def test_get_recommended_renderer_names_signature(self): FILE: tests/downstream_compat/test_recipes.py class TestMathRL (line 14) | class TestMathRL: method test_math_env_importable (line 15) | def test_math_env_importable(self): method test_arithmetic_env_importable (line 20) | def test_arithmetic_env_importable(self): method test_get_math_dataset_builder (line 25) | def test_get_math_dataset_builder(self): method test_math_env_classes (line 30) | def test_math_env_classes(self): method test_math_grading_functions (line 39) | def test_math_grading_functions(self): method test_safe_grade (line 50) | def test_safe_grade(self): class TestCodeRL (line 61) | class TestCodeRL: method test_code_env_importable (line 62) | def test_code_env_importable(self): class TestChatSL (line 73) | class TestChatSL: method test_chat_datasets_importable (line 74) | def test_chat_datasets_importable(self): method test_tulu3_builder_exists (line 79) | def test_tulu3_builder_exists(self): class TestPreference (line 90) | class TestPreference: method test_dpo_train_importable (line 91) | def test_dpo_train_importable(self): method test_preference_datasets_importable (line 97) | def test_preference_datasets_importable(self): class TestBasicRecipes (line 108) | class TestBasicRecipes: method test_rl_basic_build_config (line 109) | def test_rl_basic_build_config(self): method test_sl_basic_build_config (line 114) | def test_sl_basic_build_config(self): class TestEvaluators (line 125) | class TestEvaluators: method test_sampling_client_evaluator_importable (line 126) | def test_sampling_client_evaluator_importable(self): method test_training_client_evaluator_importable (line 131) | def test_training_client_evaluator_importable(self): method test_evaluator_builder_importable (line 136) | def test_evaluator_builder_importable(self): class TestDistillation (line 147) | class TestDistillation: method test_prompt_only_env_importable (line 148) | def test_prompt_only_env_importable(self): method test_load_tulu3_prompts_importable (line 153) | def test_load_tulu3_prompts_importable(self): class TestPreferenceTypes (line 164) | class TestPreferenceTypes: method test_preference_model_builder_importable (line 165) | def test_preference_model_builder_importable(self): class TestSupervisedTrain (line 176) | class TestSupervisedTrain: method test_config_exists (line 177) | def test_config_exists(self): method test_main_exists (line 182) | def test_main_exists(self): method test_main_is_async (line 187) | def test_main_is_async(self): class TestLRScheduling (line 198) | class TestLRScheduling: method test_lr_schedule_importable (line 199) | def test_lr_schedule_importable(self): FILE: tests/downstream_compat/test_renderers.py class TestTypeExports (line 51) | class TestTypeExports: method test_message_is_typed_dict (line 54) | def test_message_is_typed_dict(self): method test_text_part_constructable (line 60) | def test_text_part_constructable(self): method test_thinking_part_constructable (line 64) | def test_thinking_part_constructable(self): method test_tool_call_constructable (line 68) | def test_tool_call_constructable(self): method test_tool_spec_constructable (line 79) | def test_tool_spec_constructable(self): method test_train_on_what_has_expected_values (line 87) | def test_train_on_what_has_expected_values(self): method test_streaming_types_importable (line 91) | def test_streaming_types_importable(self): method test_content_part_types (line 98) | def test_content_part_types(self): method test_utf8_token_decoder_importable (line 103) | def test_utf8_token_decoder_importable(self): method test_render_context_importable (line 106) | def test_render_context_importable(self): class TestUtilityFunctions (line 115) | class TestUtilityFunctions: method test_ensure_text_with_string (line 116) | def test_ensure_text_with_string(self): method test_format_content_as_string (line 119) | def test_format_content_as_string(self): method test_get_text_content (line 123) | def test_get_text_content(self): method test_parse_content_blocks_exists (line 127) | def test_parse_content_blocks_exists(self): method test_ensure_list_importable (line 130) | def test_ensure_list_importable(self): class TestRendererRegistry (line 140) | class TestRendererRegistry: method test_register_and_unregister_roundtrip (line 141) | def test_register_and_unregister_roundtrip(self): method test_unregister_nonexistent_returns_false (line 155) | def test_unregister_nonexistent_returns_false(self): function test_builtin_renderer_name_resolves (line 188) | def test_builtin_renderer_name_resolves(renderer_name): class TestRendererInterface (line 204) | class TestRendererInterface: method test_build_generation_prompt_is_method (line 207) | def test_build_generation_prompt_is_method(self): method test_build_supervised_example_is_method (line 211) | def test_build_supervised_example_is_method(self): method test_build_supervised_examples_is_method (line 215) | def test_build_supervised_examples_is_method(self): method test_parse_response_is_method (line 219) | def test_parse_response_is_method(self): method test_get_stop_sequences_is_abstract (line 222) | def test_get_stop_sequences_is_abstract(self): method test_has_extension_property (line 225) | def test_has_extension_property(self): method test_tokenizer_attribute (line 228) | def test_tokenizer_attribute(self): method test_pickle_metadata_attributes (line 232) | def test_pickle_metadata_attributes(self): class TestSignatures (line 244) | class TestSignatures: method test_get_renderer_signature (line 247) | def test_get_renderer_signature(self): method test_register_renderer_signature (line 254) | def test_register_renderer_signature(self): method test_unregister_renderer_signature (line 259) | def test_unregister_renderer_signature(self): method test_build_generation_prompt_signature (line 264) | def test_build_generation_prompt_signature(self): method test_build_supervised_example_signature (line 269) | def test_build_supervised_example_signature(self): method test_parse_response_signature (line 274) | def test_parse_response_signature(self): method test_ensure_text_signature (line 279) | def test_ensure_text_signature(self): method test_format_content_as_string_signature (line 284) | def test_format_content_as_string_signature(self): method test_get_text_content_signature (line 289) | def test_get_text_content_signature(self): class TestRendererClasses (line 300) | class TestRendererClasses: method test_deepseekv3_thinking_renderer_importable (line 301) | def test_deepseekv3_thinking_renderer_importable(self): method test_qwen3_renderer_importable (line 304) | def test_qwen3_renderer_importable(self): method test_gpt_oss_renderer_importable (line 307) | def test_gpt_oss_renderer_importable(self): method test_kimi_k2_renderer_importable (line 310) | def test_kimi_k2_renderer_importable(self): method test_kimi_k25_renderer_importable (line 313) | def test_kimi_k25_renderer_importable(self): FILE: tests/downstream_compat/test_rl_train.py class TestRLTrainConfig (line 20) | class TestRLTrainConfig: method test_config_exists (line 21) | def test_config_exists(self): method test_main_exists (line 24) | def test_main_exists(self): method test_main_is_async (line 27) | def test_main_is_async(self): method test_main_signature (line 30) | def test_main_signature(self): class TestRLDataProcessing (line 41) | class TestRLDataProcessing: method test_compute_advantages_signature (line 42) | def test_compute_advantages_signature(self): method test_trajectory_to_data_signature (line 47) | def test_trajectory_to_data_signature(self): method test_assemble_training_data_signature (line 52) | def test_assemble_training_data_signature(self): class TestRLMetrics (line 63) | class TestRLMetrics: method test_metrics_importable (line 64) | def test_metrics_importable(self): method test_metric_util_importable (line 73) | def test_metric_util_importable(self): class TestRLRollouts (line 85) | class TestRLRollouts: method test_do_single_rollout_importable (line 86) | def test_do_single_rollout_importable(self): FILE: tests/downstream_compat/test_rl_types.py class TestTypeAliases (line 31) | class TestTypeAliases: method test_action_is_list_int (line 32) | def test_action_is_list_int(self): method test_metrics_is_dict (line 36) | def test_metrics_is_dict(self): method test_logs_is_dict (line 40) | def test_logs_is_dict(self): method test_observation_alias_exists (line 44) | def test_observation_alias_exists(self): class TestStepResult (line 53) | class TestStepResult: method test_fields (line 54) | def test_fields(self): method test_metrics_defaults_to_empty (line 66) | def test_metrics_defaults_to_empty(self): class TestTransition (line 82) | class TestTransition: method test_fields (line 83) | def test_fields(self): method test_constructable (line 88) | def test_constructable(self): class TestEnv (line 103) | class TestEnv: method test_is_abstract (line 104) | def test_is_abstract(self): method test_has_initial_observation (line 107) | def test_has_initial_observation(self): method test_initial_observation_signature (line 111) | def test_initial_observation_signature(self): method test_has_step (line 116) | def test_has_step(self): method test_step_signature (line 120) | def test_step_signature(self): class TestTrajectory (line 131) | class TestTrajectory: method test_fields (line 132) | def test_fields(self): method test_frozen (line 137) | def test_frozen(self): class TestTrajectoryGroup (line 141) | class TestTrajectoryGroup: method test_has_trajectories_field (line 142) | def test_has_trajectories_field(self): method test_get_total_rewards_method (line 147) | def test_get_total_rewards_method(self): class TestEnvGroupBuilder (line 157) | class TestEnvGroupBuilder: method test_is_abstract (line 158) | def test_is_abstract(self): method test_make_envs_signature (line 161) | def test_make_envs_signature(self): method test_compute_group_rewards_signature (line 168) | def test_compute_group_rewards_signature(self): method test_logging_tags_signature (line 175) | def test_logging_tags_signature(self): class TestRLDataset (line 187) | class TestRLDataset: method test_is_abstract (line 188) | def test_is_abstract(self): method test_get_batch_signature (line 191) | def test_get_batch_signature(self): method test_has_len (line 197) | def test_has_len(self): class TestRLDatasetBuilder (line 201) | class TestRLDatasetBuilder: method test_has_call (line 202) | def test_has_call(self): FILE: tests/downstream_compat/test_supervised.py class TestSupervisedTypes (line 20) | class TestSupervisedTypes: method test_supervised_dataset_has_get_batch (line 21) | def test_supervised_dataset_has_get_batch(self): method test_supervised_dataset_has_len (line 24) | def test_supervised_dataset_has_len(self): method test_supervised_dataset_builder_is_callable (line 27) | def test_supervised_dataset_builder_is_callable(self): method test_chat_dataset_builder_is_subclass (line 30) | def test_chat_dataset_builder_is_subclass(self): method test_chat_dataset_builder_common_config_exists (line 33) | def test_chat_dataset_builder_common_config_exists(self): class TestSupervisedData (line 37) | class TestSupervisedData: method test_conversation_to_datum_signature (line 38) | def test_conversation_to_datum_signature(self): method test_from_conversation_file_builder_exists (line 45) | def test_from_conversation_file_builder_exists(self): method test_supervised_dataset_from_hf_exists (line 48) | def test_supervised_dataset_from_hf_exists(self): method test_streaming_supervised_dataset_from_hf_exists (line 51) | def test_streaming_supervised_dataset_from_hf_exists(self): FILE: tests/downstream_compat/test_tokenizer_utils.py class TestTokenizerRegistryAPI (line 16) | class TestTokenizerRegistryAPI: method test_get_tokenizer_signature (line 17) | def test_get_tokenizer_signature(self): method test_register_tokenizer_signature (line 22) | def test_register_tokenizer_signature(self): method test_unregister_tokenizer_signature (line 27) | def test_unregister_tokenizer_signature(self): method test_is_tokenizer_registered_signature (line 32) | def test_is_tokenizer_registered_signature(self): method test_get_registered_tokenizer_names_callable (line 37) | def test_get_registered_tokenizer_names_callable(self): method test_tokenizer_type_alias_exists (line 40) | def test_tokenizer_type_alias_exists(self): method test_register_and_unregister_roundtrip (line 43) | def test_register_and_unregister_roundtrip(self): FILE: tests/downstream_compat/test_utils.py class TestLoggerHierarchy (line 32) | class TestLoggerHierarchy: method test_logger_is_abstract (line 33) | def test_logger_is_abstract(self): method test_json_logger_is_subclass (line 36) | def test_json_logger_is_subclass(self): method test_pretty_print_logger_is_subclass (line 39) | def test_pretty_print_logger_is_subclass(self): method test_multiplex_logger_is_subclass (line 42) | def test_multiplex_logger_is_subclass(self): method test_setup_logging_signature (line 45) | def test_setup_logging_signature(self): method test_configure_logging_module_signature (line 53) | def test_configure_logging_module_signature(self): method test_dump_config_callable (line 58) | def test_dump_config_callable(self): class TestMiscUtils (line 67) | class TestMiscUtils: method test_dict_mean (line 68) | def test_dict_mean(self): method test_all_same_true (line 73) | def test_all_same_true(self): method test_all_same_false (line 76) | def test_all_same_false(self): method test_split_list (line 79) | def test_split_list(self): method test_concat_lists (line 83) | def test_concat_lists(self): method test_not_none (line 87) | def test_not_none(self): method test_safezip (line 90) | def test_safezip(self): method test_timed_is_context_manager (line 94) | def test_timed_is_context_manager(self): class TestTraceImports (line 103) | class TestTraceImports: method test_trace_importable (line 104) | def test_trace_importable(self): method test_logtree_importable (line 111) | def test_logtree_importable(self): FILE: tests/helpers.py function run_recipe (line 17) | def run_recipe( FILE: tests/recipes/test_recipe_chat_sl.py function test_chat_sl (line 10) | def test_chat_sl(): function test_chat_sl_resume (line 23) | def test_chat_sl_resume(): FILE: tests/recipes/test_recipe_dpo.py function test_dpo (line 7) | def test_dpo(): FILE: tests/recipes/test_recipe_guess_number.py function test_guess_number (line 7) | def test_guess_number(): FILE: tests/recipes/test_recipe_math_rl.py function test_math_rl_sync (line 9) | def test_math_rl_sync(): function test_math_rl_async (line 23) | def test_math_rl_async(): function test_math_rl_stream_minibatch (line 38) | def test_math_rl_stream_minibatch(): FILE: tests/recipes/test_recipe_off_policy_reasoning.py function test_off_policy_reasoning (line 7) | def test_off_policy_reasoning(): FILE: tests/recipes/test_recipe_on_policy_distillation.py function test_on_policy_distillation (line 7) | def test_on_policy_distillation(): FILE: tests/recipes/test_recipe_on_policy_multi_teacher.py function test_on_policy_multi_teacher (line 7) | def test_on_policy_multi_teacher(): FILE: tests/recipes/test_recipe_rlhf_pipeline.py function test_rlhf_pipeline (line 7) | def test_rlhf_pipeline(): FILE: tests/recipes/test_recipe_shorter.py function test_shorter (line 7) | def test_shorter(): FILE: tests/recipes/test_recipe_text_arena.py function test_text_arena (line 7) | def test_text_arena(): FILE: tests/recipes/test_recipe_twenty_questions.py function test_twenty_questions (line 7) | def test_twenty_questions(): FILE: tests/recipes/test_recipe_vlm_classifier.py function test_vlm_classifier (line 7) | def test_vlm_classifier(): FILE: tests/test_inspect_eval.py function _create_api (line 42) | def _create_api( function _generate (line 55) | async def _generate(api: InspectAPIFromTinkerSampling) -> InspectAIModel... function _log_response (line 59) | def _log_response(result: InspectAIModelOutput) -> None: function test_thinking_model_include_reasoning (line 79) | def test_thinking_model_include_reasoning(): function test_thinking_model_exclude_reasoning (line 96) | def test_thinking_model_exclude_reasoning(): function test_non_thinking_model_include_reasoning (line 108) | def test_non_thinking_model_include_reasoning(): function test_non_thinking_model_exclude_reasoning (line 124) | def test_non_thinking_model_exclude_reasoning(): FILE: tests/test_modal_sandbox.py function sandbox (line 34) | async def sandbox(): function _timed (line 41) | async def _timed(coro): function test_write_file_latency (line 51) | async def test_write_file_latency(sandbox): function test_write_file_binary (line 81) | async def test_write_file_binary(sandbox): function test_cleanup_after_timeout (line 105) | async def test_cleanup_after_timeout(): function test_cleanup_after_terminate (line 120) | async def test_cleanup_after_terminate(): function test_cleanup_after_command_timeout (line 134) | async def test_cleanup_after_command_timeout(): FILE: tests/third_party/test_litellm.py function tinker_provider (line 18) | def tinker_provider(): function test_acompletion_basic (line 40) | async def test_acompletion_basic(tinker_provider) -> None: function test_acompletion_with_system_message (line 71) | async def test_acompletion_with_system_message(tinker_provider) -> None: function test_acompletion_multi_turn (line 89) | async def test_acompletion_multi_turn(tinker_provider) -> None: function test_completion_sync (line 107) | def test_completion_sync(tinker_provider) -> None: function test_set_client_with_finetuned_checkpoint (line 130) | async def test_set_client_with_finetuned_checkpoint(tinker_provider) -> ... function test_register_idempotent (line 166) | def test_register_idempotent(tinker_provider) -> None: FILE: tests/validate_temperature_logprobs.py function _default_temperatures (line 21) | def _default_temperatures() -> list[float]: class Config (line 26) | class Config: function _sample_next_token (line 42) | async def _sample_next_token( function _collect_sampled_token_logprobs (line 65) | async def _collect_sampled_token_logprobs( function _compute_logp1_for_tokens (line 93) | async def _compute_logp1_for_tokens( function _pairwise_ratio_metrics (line 112) | def _pairwise_ratio_metrics( function _sample_sequence_oneshot (line 152) | async def _sample_sequence_oneshot( function _resample_tokens_individually (line 177) | async def _resample_tokens_individually( function _compare_logprobs (line 221) | def _compare_logprobs( function validate_sequence_consistency (line 243) | async def validate_sequence_consistency( function main (line 308) | async def main(cfg: Config) -> None: FILE: tests/weights/test_download.py class TestDownloadIntegration (line 16) | class TestDownloadIntegration: method _get_test_tinker_path (line 19) | def _get_test_tinker_path(self) -> str: method test_download_and_extract (line 32) | def test_download_and_extract(self): FILE: tests/weights/test_export.py function _save_model_to_disk (line 41) | def _save_model_to_disk( function _save_expert_adapter (line 55) | def _save_expert_adapter( function _save_dense_adapter (line 78) | def _save_dense_adapter( function _run_build_and_reload (line 98) | def _run_build_and_reload( function _make_tiny_gpt_oss_config (line 121) | def _make_tiny_gpt_oss_config() -> PretrainedConfig: class TestGptOssFusedInterleaved (line 135) | class TestGptOssFusedInterleaved: method test_gate_and_up_deltas_in_correct_interleaved_slots (line 140) | def test_gate_and_up_deltas_in_correct_interleaved_slots(self): method test_up_only_does_not_modify_gate_slots (line 170) | def test_up_only_does_not_modify_gate_slots(self): function _make_tiny_qwen3_vl_moe_config (line 214) | def _make_tiny_qwen3_vl_moe_config() -> PretrainedConfig: class TestQwen3VlMoeFusedConcatenated (line 231) | class TestQwen3VlMoeFusedConcatenated: method test_gate_and_up_deltas_in_correct_halves (line 239) | def test_gate_and_up_deltas_in_correct_halves(self): method test_up_only_does_not_modify_gate_half (line 280) | def test_up_only_does_not_modify_gate_half(self): function _make_tiny_qwen3_moe_config (line 332) | def _make_tiny_qwen3_moe_config() -> PretrainedConfig: class TestQwen3MoeSeparateExperts (line 344) | class TestQwen3MoeSeparateExperts: method test_per_expert_weights_updated (line 347) | def test_per_expert_weights_updated(self): function _make_tiny_deepseek_v31_config (line 389) | def _make_tiny_deepseek_v31_config() -> PretrainedConfig: function _copy_hf_files (line 407) | def _copy_hf_files(repo_id: str, output_path: Path, file_names: tuple[st... function _save_mixed_deepseek_adapter (line 414) | def _save_mixed_deepseek_adapter( function _reshard_saved_model (line 454) | def _reshard_saved_model( function _load_saved_state_dict (line 481) | def _load_saved_state_dict(output_path: Path) -> dict[str, torch.Tensor]: class TestDeepSeekV31FP8Export (line 489) | class TestDeepSeekV31FP8Export: method test_dense_weights_change_but_only_routed_experts_are_quantized_to_fp8 (line 495) | def test_dense_weights_change_but_only_routed_experts_are_quantized_to... function _make_tiny_qwen3_dense_config (line 642) | def _make_tiny_qwen3_dense_config() -> PretrainedConfig: class TestQwen3Dense (line 654) | class TestQwen3Dense: method test_dense_linear_merge (line 657) | def test_dense_linear_merge(self): FILE: tests/weights/test_lifecycle.py class TestFullLifecycle (line 29) | class TestFullLifecycle: method _train_and_save (line 38) | def _train_and_save(self, log_path: str) -> str: method test_train_download_build (line 76) | def test_train_download_build(self): FILE: tests/weights/test_publish.py function _hf_username (line 21) | def _hf_username() -> str: function _create_dummy_model_dir (line 34) | def _create_dummy_model_dir(path: Path) -> None: class TestPublishToHfHubIntegration (line 42) | class TestPublishToHfHubIntegration: method test_upload_and_verify (line 43) | def test_upload_and_verify(self): FILE: tests/weights/test_quantized.py function _deepseek_config (line 29) | def _deepseek_config() -> dict: function _deepseek_state_dict (line 44) | def _deepseek_state_dict() -> dict[str, torch.Tensor]: function _split_into_shards (line 95) | def _split_into_shards( function _create_deepseek_model (line 114) | def _create_deepseek_model(model_dir: Path, shards: dict[str, dict[str, ... function _create_deepseek_adapter (line 149) | def _create_deepseek_adapter(adapter_dir: Path) -> None: function deepseek_model (line 177) | def deepseek_model(tmp_path: Path): function _load_output (line 190) | def _load_output(output_dir: Path) -> dict[str, torch.Tensor]: class TestDenseWeights (line 210) | class TestDenseWeights: method test_dense_weights_change_after_merge (line 211) | def test_dense_weights_change_after_merge(self, tmp_path: Path, deepse... method test_dense_weights_stay_bf16 (line 228) | def test_dense_weights_stay_bf16(self, tmp_path: Path, deepseek_model): method test_untargeted_dense_unchanged (line 243) | def test_untargeted_dense_unchanged(self, tmp_path: Path, deepseek_mod... class TestRoutedExperts (line 265) | class TestRoutedExperts: method test_routed_experts_change_after_merge (line 266) | def test_routed_experts_change_after_merge(self, tmp_path: Path, deeps... method test_routed_experts_quantized_to_fp8 (line 287) | def test_routed_experts_quantized_to_fp8(self, tmp_path: Path, deepsee... method test_expert_has_float32_scale (line 303) | def test_expert_has_float32_scale(self, tmp_path: Path, deepseek_model): method test_scale_shape_matches_block_structure (line 320) | def test_scale_shape_matches_block_structure(self, tmp_path: Path, dee... class TestSharedExperts (line 345) | class TestSharedExperts: method test_shared_experts_stay_bf16 (line 346) | def test_shared_experts_stay_bf16(self, tmp_path: Path, deepseek_model): method test_shared_experts_no_scale (line 362) | def test_shared_experts_no_scale(self, tmp_path: Path, deepseek_model): class TestShardLayout (line 383) | class TestShardLayout: method test_two_shard_input_produces_two_shard_output (line 384) | def test_two_shard_input_produces_two_shard_output(self, tmp_path: Pat... method test_index_consistent (line 403) | def test_index_consistent(self, tmp_path: Path, deepseek_model): class TestConfigMetadata (line 434) | class TestConfigMetadata: method test_compression_config_present (line 435) | def test_compression_config_present(self, tmp_path: Path, deepseek_mod... method test_quantization_config_absent (line 453) | def test_quantization_config_absent(self, tmp_path: Path, deepseek_mod... method test_ignore_list_correct (line 472) | def test_ignore_list_correct(self, tmp_path: Path, deepseek_model): method test_model_code_files_copied (line 494) | def test_model_code_files_copied(self, tmp_path: Path, deepseek_model): class TestResume (line 515) | class TestResume: method test_crash_after_shard_1_shows_in_progress (line 516) | def test_crash_after_shard_1_shows_in_progress(self, tmp_path: Path, d... method test_resume_completes (line 552) | def test_resume_completes(self, tmp_path: Path, deepseek_model): class TestApiValidation (line 601) | class TestApiValidation: method test_quantize_none_does_standard_merge (line 602) | def test_quantize_none_does_standard_merge(self, tmp_path: Path, deeps... method test_quantize_without_serving_format_raises (line 621) | def test_quantize_without_serving_format_raises(self, tmp_path: Path): method test_serving_format_without_quantize_raises (line 630) | def test_serving_format_without_quantize_raises(self, tmp_path: Path): method test_quantize_with_wrong_dtype_raises (line 639) | def test_quantize_with_wrong_dtype_raises(self, tmp_path: Path): method test_unknown_quantize_raises (line 650) | def test_unknown_quantize_raises(self, tmp_path: Path): method test_unknown_serving_format_raises (line 660) | def test_unknown_serving_format_raises(self, tmp_path: Path): FILE: tests/weights/test_quantized_equivalence.py function _create_test_model (line 49) | def _create_test_model(model_dir: Path) -> dict[str, torch.Tensor]: function _create_test_adapter (line 161) | def _create_test_adapter(adapter_dir: Path) -> None: function _load_all_output_tensors (line 195) | def _load_all_output_tensors(output_dir: Path) -> dict[str, torch.Tensor]: function equivalence_model (line 204) | def equivalence_model(tmp_path: Path): class TestScaleTensorNaming (line 241) | class TestScaleTensorNaming: method test_routed_expert_scales_use_weight_scale_name (line 242) | def test_routed_expert_scales_use_weight_scale_name(self, equivalence_... method test_no_weight_scale_inv_in_output (line 253) | def test_no_weight_scale_inv_in_output(self, equivalence_model): class TestCompressedTensorsConfig (line 267) | class TestCompressedTensorsConfig: method test_weights_strategy_is_block (line 268) | def test_weights_strategy_is_block(self, equivalence_model): method test_block_structure_present (line 276) | def test_block_structure_present(self, equivalence_model): method test_input_activations_dynamic (line 284) | def test_input_activations_dynamic(self, equivalence_model): method test_quant_method_compressed_tensors (line 293) | def test_quant_method_compressed_tensors(self, equivalence_model): method test_format_float_quantized (line 297) | def test_format_float_quantized(self, equivalence_model): method test_quantization_status_compressed (line 301) | def test_quantization_status_compressed(self, equivalence_model): method test_quantization_config_absent (line 305) | def test_quantization_config_absent(self, equivalence_model): class TestIgnoreList (line 314) | class TestIgnoreList: method test_dense_projections_in_ignore (line 315) | def test_dense_projections_in_ignore(self, equivalence_model): method test_shared_experts_in_ignore (line 323) | def test_shared_experts_in_ignore(self, equivalence_model): method test_routed_experts_not_in_ignore (line 329) | def test_routed_experts_not_in_ignore(self, equivalence_model): method test_lm_head_in_ignore (line 335) | def test_lm_head_in_ignore(self, equivalence_model): class TestWeightDtypes (line 346) | class TestWeightDtypes: method test_dense_weights_bf16 (line 347) | def test_dense_weights_bf16(self, equivalence_model): method test_routed_experts_fp8 (line 351) | def test_routed_experts_fp8(self, equivalence_model): method test_routed_expert_scales_float32 (line 358) | def test_routed_expert_scales_float32(self, equivalence_model): method test_shared_experts_bf16 (line 365) | def test_shared_experts_bf16(self, equivalence_model): method test_dense_weight_changed_after_merge (line 371) | def test_dense_weight_changed_after_merge(self, equivalence_model): method test_untargeted_embedding_unchanged (line 378) | def test_untargeted_embedding_unchanged(self, equivalence_model): class TestScaleShapes (line 389) | class TestScaleShapes: method test_scale_shape_matches_blockwise_quantization (line 390) | def test_scale_shape_matches_blockwise_quantization(self, equivalence_... method test_down_proj_scale_shape (line 398) | def test_down_proj_scale_shape(self, equivalence_model): class TestShardConsistency (line 411) | class TestShardConsistency: method test_two_shard_output (line 412) | def test_two_shard_output(self, equivalence_model): method test_index_covers_all_tensors (line 416) | def test_index_covers_all_tensors(self, equivalence_model): method test_all_shards_referenced_and_exist (line 422) | def test_all_shards_referenced_and_exist(self, equivalence_model): method test_scale_tensors_in_same_shard_as_weights (line 428) | def test_scale_tensors_in_same_shard_as_weights(self, equivalence_model): class TestCustomFiles (line 446) | class TestCustomFiles: method test_configuration_deepseek_copied (line 447) | def test_configuration_deepseek_copied(self, equivalence_model): method test_modeling_deepseek_copied (line 450) | def test_modeling_deepseek_copied(self, equivalence_model): FILE: tests/weights/test_strategy_consistency.py function _make_tiny_qwen3_dense_config (line 23) | def _make_tiny_qwen3_dense_config() -> PretrainedConfig: function _save_model_to_disk (line 35) | def _save_model_to_disk(config: PretrainedConfig, path: Path) -> None: function _save_adapter (line 45) | def _save_adapter(path: Path, *, model_path: Path) -> None: function _load_all_tensors (line 75) | def _load_all_tensors(output_dir: Path) -> dict[str, torch.Tensor]: class TestStrategyConsistency (line 89) | class TestStrategyConsistency: method test_full_and_shard_produce_identical_weights (line 92) | def test_full_and_shard_produce_identical_weights(self): FILE: tinker_cookbook/chat_app/tinker_chat_cli.py class Config (line 28) | class Config: class ChatSession (line 37) | class ChatSession: method __init__ (line 40) | def __init__( method add_user_message (line 55) | def add_user_message(self, content: str): method add_assistant_message (line 59) | def add_assistant_message(self, content: str): method clear_history (line 63) | def clear_history(self): method generate_response (line 67) | async def generate_response(self) -> str: function main (line 101) | async def main(config: Config): FILE: tinker_cookbook/checkpoint_utils.py class CheckpointRecord (line 25) | class CheckpointRecord: method __post_init__ (line 45) | def __post_init__(self) -> None: method to_dict (line 53) | def to_dict(self) -> dict[str, Any]: method from_dict (line 70) | def from_dict(cls, d: dict[str, Any]) -> "CheckpointRecord": method has (line 86) | def has(self, key: str) -> bool: method get (line 92) | def get(self, key: str, default: Any = _MISSING) -> Any: function add_renderer_name_to_user_metadata (line 116) | def add_renderer_name_to_user_metadata( function _handle_checkpoint_renderer_check_result (line 124) | def _handle_checkpoint_renderer_check_result( function get_renderer_name_from_checkpoint (line 147) | def get_renderer_name_from_checkpoint( function get_renderer_name_from_checkpoint_async (line 164) | async def get_renderer_name_from_checkpoint_async( function resolve_renderer_name_from_checkpoint_or_default (line 181) | def resolve_renderer_name_from_checkpoint_or_default( function resolve_renderer_name_from_checkpoint_or_default_async (line 213) | async def resolve_renderer_name_from_checkpoint_or_default_async( function check_renderer_name_for_checkpoint (line 242) | def check_renderer_name_for_checkpoint( function check_renderer_name_for_checkpoint_async (line 262) | async def check_renderer_name_for_checkpoint_async( function load_checkpoints_file (line 291) | def load_checkpoints_file(log_dir: str) -> list[CheckpointRecord]: function get_last_checkpoint (line 303) | def get_last_checkpoint(log_dir: str, required_key: str = "state_path") ... function save_checkpoint_async (line 330) | async def save_checkpoint_async( function save_checkpoint (line 373) | def save_checkpoint( FILE: tinker_cookbook/checkpoint_utils_test.py function _write_checkpoints_jsonl (line 14) | def _write_checkpoints_jsonl(log_dir: str, records: list[dict]) -> None: function test_load_checkpoints_file_missing_dir (line 21) | def test_load_checkpoints_file_missing_dir(): function test_load_checkpoints_file_missing_file (line 27) | def test_load_checkpoints_file_missing_file(): function test_load_checkpoints_file_reads_records (line 34) | def test_load_checkpoints_file_reads_records(): function test_get_last_checkpoint_returns_last (line 51) | def test_get_last_checkpoint_returns_last(): function test_get_last_checkpoint_returns_none_when_empty (line 67) | def test_get_last_checkpoint_returns_none_when_empty(): function test_get_last_checkpoint_returns_none_when_key_missing (line 74) | def test_get_last_checkpoint_returns_none_when_key_missing(): function test_load_checkpoints_file_without_batch (line 85) | def test_load_checkpoints_file_without_batch(): function test_checkpoint_record_extra_round_trips (line 102) | def test_checkpoint_record_extra_round_trips(): function test_checkpoint_record_name_only (line 115) | def test_checkpoint_record_name_only(): function test_checkpoint_record_get_known_field (line 122) | def test_checkpoint_record_get_known_field(): function test_checkpoint_record_get_extra_field (line 133) | def test_checkpoint_record_get_extra_field(): function test_checkpoint_record_has_extra_field (line 142) | def test_checkpoint_record_has_extra_field(): function test_checkpoint_record_extra_overlap_with_known_keys (line 151) | def test_checkpoint_record_extra_overlap_with_known_keys(): FILE: tinker_cookbook/cli_utils.py function check_log_dir (line 13) | def check_log_dir(log_dir: str, behavior_if_exists: LogdirBehavior): FILE: tinker_cookbook/cli_utils_test.py function test_check_log_dir_nonexistent_is_noop (line 11) | def test_check_log_dir_nonexistent_is_noop(): function test_check_log_dir_resume_keeps_directory (line 16) | def test_check_log_dir_resume_keeps_directory(): function test_check_log_dir_delete_removes_directory (line 25) | def test_check_log_dir_delete_removes_directory(): function test_check_log_dir_raise_raises (line 35) | def test_check_log_dir_raise_raises(): FILE: tinker_cookbook/completers.py class TokensWithLogprobs (line 22) | class TokensWithLogprobs: method logprobs (line 27) | def logprobs(self) -> list[float]: class TokenCompleter (line 33) | class TokenCompleter: method __call__ (line 34) | async def __call__( class MessageCompleter (line 40) | class MessageCompleter: method __call__ (line 42) | async def __call__(self, messages: list[renderers.Message]) -> rendere... class TinkerTokenCompleter (line 50) | class TinkerTokenCompleter(TokenCompleter): method __call__ (line 59) | async def __call__( class TinkerMessageCompleter (line 82) | class TinkerMessageCompleter(MessageCompleter): method __init__ (line 85) | def __init__( method __call__ (line 102) | async def __call__(self, messages: list[renderers.Message]) -> rendere... FILE: tinker_cookbook/display.py function to_ints (line 11) | def to_ints(chunk: tinker.ModelInputChunk, tokenizer: Tokenizer): function colorize_example (line 19) | def colorize_example(datum: tinker.Datum, tokenizer: Tokenizer, key: str... function format_trajectory (line 27) | def format_trajectory( FILE: tinker_cookbook/distillation/datasets.py class TeacherConfig (line 32) | class TeacherConfig: class DistillationDatasetConfig (line 40) | class DistillationDatasetConfig: class CompositeDataset (line 48) | class CompositeDataset: method __init__ (line 51) | def __init__(self, datasets: list[RLDataset], groups_per_batch_list: l... method __len__ (line 60) | def __len__(self) -> int: method get_batch (line 63) | def get_batch(self, i_batch: int) -> tuple[list[EnvGroupBuilder], list... class PromptOnlyEnv (line 84) | class PromptOnlyEnv(ProblemEnv): method __init__ (line 87) | def __init__( method get_question (line 97) | def get_question(self) -> str: method check_format (line 100) | def check_format(self, sample_str: str) -> bool: method check_answer (line 104) | def check_answer(self, sample_str: str) -> bool: method get_reference_answer (line 108) | def get_reference_answer(self) -> str: method step (line 112) | async def step(self, action: Action) -> StepResult: class PromptOnlyDataset (line 124) | class PromptOnlyDataset(RLDataset): method __init__ (line 127) | def __init__( method _truncate_prompt (line 147) | def _truncate_prompt(self, prompt: str) -> str: method get_batch (line 158) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 176) | def __len__(self) -> int: function load_deepmath_prompts (line 180) | def load_deepmath_prompts(split: Literal["train", "test"] = "train") -> ... function load_tulu3_prompts (line 192) | def load_tulu3_prompts() -> list[str] | None: class PromptOnlyDatasetBuilder (line 222) | class PromptOnlyDatasetBuilder(RLDatasetBuilder): method __call__ (line 233) | async def __call__(self) -> tuple[PromptOnlyDataset, PromptOnlyDataset... FILE: tinker_cookbook/distillation/train_on_policy.py function incorporate_kl_penalty (line 50) | async def incorporate_kl_penalty( class Config (line 130) | class Config: function prepare_minibatch (line 172) | async def prepare_minibatch( function do_train_step_and_get_sampling_client (line 227) | async def do_train_step_and_get_sampling_client( function do_sync_training (line 279) | async def do_sync_training( function main (line 366) | async def main( FILE: tinker_cookbook/eval/custom_evaluators.py class CustomEvaluator (line 13) | class CustomEvaluator(SamplingClientEvaluator): method __init__ (line 18) | def __init__( method __call__ (line 36) | async def __call__(self, sampling_client: tinker.SamplingClient) -> di... function grader_fn (line 82) | def grader_fn(response: str, target: str) -> bool: function main (line 99) | async def main(): FILE: tinker_cookbook/eval/custom_inspect_task.py function example_lm_as_judge (line 52) | def example_lm_as_judge() -> Task: FILE: tinker_cookbook/eval/evaluators.py class TrainingClientEvaluator (line 10) | class TrainingClientEvaluator: method __call__ (line 15) | async def __call__(self, training_client: tinker.TrainingClient) -> di... class SamplingClientEvaluator (line 19) | class SamplingClientEvaluator: method __call__ (line 24) | async def __call__(self, sampling_client: tinker.SamplingClient) -> di... FILE: tinker_cookbook/eval/inspect_evaluators.py class InspectEvaluatorBuilder (line 19) | class InspectEvaluatorBuilder: method __call__ (line 60) | def __call__(self) -> SamplingClientEvaluator: class InspectEvaluator (line 64) | class InspectEvaluator(SamplingClientEvaluator): method __init__ (line 69) | def __init__(self, config: InspectEvaluatorBuilder): method __call__ (line 77) | async def __call__(self, sampling_client: tinker.SamplingClient) -> di... FILE: tinker_cookbook/eval/inspect_utils.py function get_model_usage (line 36) | def get_model_usage( function convert_inspect_messages (line 51) | def convert_inspect_messages(messages: list[InspectAIChatMessage]) -> li... function _message_to_inspect_content (line 81) | def _message_to_inspect_content( class InspectAPIFromTinkerSampling (line 97) | class InspectAPIFromTinkerSampling(InspectAIModelAPI): method __init__ (line 105) | def __init__( method generate (line 143) | async def generate( FILE: tinker_cookbook/eval/inspect_utils_test.py function test_message_to_inspect_content_with_thinking (line 19) | def test_message_to_inspect_content_with_thinking(): function test_message_to_inspect_content_string_content (line 35) | def test_message_to_inspect_content_string_content(): function test_message_to_inspect_content_text_only_parts (line 43) | def test_message_to_inspect_content_text_only_parts(): function test_message_to_inspect_content_empty_thinking (line 54) | def test_message_to_inspect_content_empty_thinking(): function test_convert_inspect_messages_string_content (line 71) | def test_convert_inspect_messages_string_content(): function test_convert_inspect_messages_structured_assistant (line 84) | def test_convert_inspect_messages_structured_assistant(): function test_convert_inspect_messages_structured_non_assistant_flattens (line 104) | def test_convert_inspect_messages_structured_non_assistant_flattens(): FILE: tinker_cookbook/eval/run_inspect_evals.py class Config (line 15) | class Config(InspectEvaluatorBuilder): function main (line 19) | async def main(config: Config): FILE: tinker_cookbook/exceptions.py class TinkerCookbookError (line 51) | class TinkerCookbookError(Exception): class ConfigurationError (line 64) | class ConfigurationError(TinkerCookbookError, ValueError): class DataError (line 84) | class DataError(TinkerCookbookError, ValueError): class DataFormatError (line 92) | class DataFormatError(DataError): class DataValidationError (line 101) | class DataValidationError(DataError): class RendererError (line 115) | class RendererError(TinkerCookbookError, ValueError): class TrainingError (line 129) | class TrainingError(TinkerCookbookError, RuntimeError): class CheckpointError (line 138) | class CheckpointError(TrainingError): class AllTrajectoriesFailedError (line 146) | class AllTrajectoriesFailedError(TrainingError): class WeightsError (line 159) | class WeightsError(TinkerCookbookError): class WeightsDownloadError (line 168) | class WeightsDownloadError(WeightsError, RuntimeError): class WeightsMergeError (line 177) | class WeightsMergeError(WeightsError, ValueError): class SandboxError (line 192) | class SandboxError(TinkerCookbookError, RuntimeError): FILE: tinker_cookbook/exceptions_test.py function test_all_exceptions_are_tinker_cookbook_errors (line 47) | def test_all_exceptions_are_tinker_cookbook_errors(exc_cls: type[Excepti... function test_stdlib_backward_compatibility (line 75) | def test_stdlib_backward_compatibility(exc_cls: type[Exception], stdlib_... function test_data_subtypes (line 86) | def test_data_subtypes(): function test_training_subtypes (line 91) | def test_training_subtypes(): function test_weights_subtypes (line 95) | def test_weights_subtypes(): function test_sandbox_terminated_error_is_sandbox_error (line 105) | def test_sandbox_terminated_error_is_sandbox_error(): function test_exceptions_are_picklable (line 124) | def test_exceptions_are_picklable(exc_cls: type[Exception]): function test_exceptions_all_is_complete (line 138) | def test_exceptions_all_is_complete(): FILE: tinker_cookbook/hyperparam_utils.py function _list_param_shapes_from_safetensors_remote (line 17) | def _list_param_shapes_from_safetensors_remote( function get_lora_lr_over_full_finetune_lr (line 66) | def get_lora_lr_over_full_finetune_lr(model_name: str, lora_alpha: int =... function _get_hidden_size (line 75) | def _get_hidden_size(model_name: str) -> int: function get_lora_param_count (line 100) | def get_lora_param_count( function get_lr (line 154) | def get_lr(model_name: str, is_lora: bool = True) -> float: function get_full_finetune_param_count (line 184) | def get_full_finetune_param_count(model_name: str) -> float: function get_full_finetune_lr_multiplier (line 191) | def get_full_finetune_lr_multiplier(model_name: str): function get_lora_lr_multiplier (line 195) | def get_lora_lr_multiplier(model_name: str): FILE: tinker_cookbook/image_processing_utils.py function get_image_processor (line 27) | def get_image_processor(model_name: str) -> ImageProcessor: function resize_image (line 44) | def resize_image(image: Image.Image, max_size: int) -> Image.Image: FILE: tinker_cookbook/image_processing_utils_test.py function _clear_cache (line 9) | def _clear_cache() -> None: function test_kimi_k25_trusts_remote_code_without_env (line 15) | def test_kimi_k25_trusts_remote_code_without_env( function test_no_trust_remote_code_by_default (line 30) | def test_no_trust_remote_code_by_default( function test_env_var_enables_trust_remote_code (line 44) | def test_env_var_enables_trust_remote_code( FILE: tinker_cookbook/model_info.py class ModelAttributes (line 33) | class ModelAttributes: function get_llama_info (line 43) | def get_llama_info() -> dict[str, ModelAttributes]: function get_qwen_info (line 58) | def get_qwen_info() -> dict[str, ModelAttributes]: function get_deepseek_info (line 91) | def get_deepseek_info() -> dict[str, ModelAttributes]: function get_gpt_oss_info (line 100) | def get_gpt_oss_info() -> dict[str, ModelAttributes]: function get_moonshot_info (line 109) | def get_moonshot_info() -> dict[str, ModelAttributes]: function get_nvidia_info (line 118) | def get_nvidia_info() -> dict[str, ModelAttributes]: function get_model_attributes (line 130) | def get_model_attributes(model_name: str) -> ModelAttributes: function get_recommended_renderer_names (line 150) | def get_recommended_renderer_names(model_name: str) -> list[str]: function get_recommended_renderer_name (line 159) | def get_recommended_renderer_name(model_name: str) -> str: function warn_if_renderer_not_recommended (line 166) | def warn_if_renderer_not_recommended(model_name: str, renderer_name: str... FILE: tinker_cookbook/model_info_test.py class TestWarnIfRendererNotRecommended (line 8) | class TestWarnIfRendererNotRecommended: method test_no_warning_when_renderer_is_none (line 9) | def test_no_warning_when_renderer_is_none(self, caplog: pytest.LogCapt... method test_no_warning_when_renderer_is_recommended (line 14) | def test_no_warning_when_renderer_is_recommended(self, caplog: pytest.... method test_warning_when_renderer_not_recommended (line 19) | def test_warning_when_renderer_not_recommended(self, caplog: pytest.Lo... method test_no_warning_for_unknown_model (line 28) | def test_no_warning_for_unknown_model(self, caplog: pytest.LogCaptureF... method test_warning_for_thinking_renderer_on_thinking_model_alt (line 33) | def test_warning_for_thinking_renderer_on_thinking_model_alt( method test_warning_for_wrong_family (line 41) | def test_warning_for_wrong_family(self, caplog: pytest.LogCaptureFixtu... FILE: tinker_cookbook/preference/comparison_policy_evaluator.py class ComparisonEvaluator (line 18) | class ComparisonEvaluator(SamplingClientEvaluator): method __init__ (line 23) | def __init__( method __call__ (line 43) | async def __call__(self, sampling_client: tinker.SamplingClient) -> di... FILE: tinker_cookbook/preference/dpo_datasets.py class DPODatasetBuilderFromComparisons (line 16) | class DPODatasetBuilderFromComparisons(ChatDatasetBuilder): method __call__ (line 24) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: FILE: tinker_cookbook/preference/preference_datasets.py class ComparisonDatasetBuilder (line 27) | class ComparisonDatasetBuilder: method get_train_and_test_datasets (line 35) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 39) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... method get_labeled_comparisons (line 43) | def get_labeled_comparisons( class ChatDatasetBuilderFromComparisons (line 71) | class ChatDatasetBuilderFromComparisons(ChatDatasetBuilder): method comparison_renderer (line 81) | def comparison_renderer(self) -> ComparisonRenderer: method __call__ (line 84) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: class ComparisonBuilderFromJsonl (line 126) | class ComparisonBuilderFromJsonl(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 132) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 157) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... FILE: tinker_cookbook/preference/train_dpo.py class Config (line 28) | class Config: function create_dpo_clients (line 80) | def create_dpo_clients( function compute_dpo_loss (line 129) | def compute_dpo_loss( function do_update (line 177) | def do_update( function main (line 346) | def main(config: Config): function print_example (line 444) | def print_example(datum: tinker.Datum, tokenizer: Tokenizer, label: str ... FILE: tinker_cookbook/preference/types.py class Comparison (line 24) | class Comparison: method swap (line 29) | def swap(self) -> "Comparison": class LabeledComparison (line 38) | class LabeledComparison: method swap (line 42) | def swap(self) -> "LabeledComparison": class ComparisonRenderer (line 49) | class ComparisonRenderer: method build_generation_prompt (line 50) | def build_generation_prompt(self, comparison: Comparison) -> types.Mod... method to_model_input_weights (line 53) | def to_model_input_weights( method tokenizer (line 59) | def tokenizer(self) -> Tokenizer: class ComparisonRendererFromChatRenderer (line 63) | class ComparisonRendererFromChatRenderer(ComparisonRenderer): method __init__ (line 65) | def __init__(self, convo_renderer: renderers.Renderer): method _comparison_to_convo (line 68) | def _comparison_to_convo(self, comparison: Comparison) -> list[rendere... method build_generation_prompt (line 78) | def build_generation_prompt(self, comparison: Comparison) -> types.Mod... method to_model_input_weights (line 81) | def to_model_input_weights( method tokenizer (line 99) | def tokenizer(self) -> Tokenizer: class PreferenceModel (line 103) | class PreferenceModel: method __call__ (line 104) | async def __call__(self, comparison: Comparison) -> float: class PreferenceModelBuilder (line 113) | class PreferenceModelBuilder: method __call__ (line 114) | def __call__(self) -> PreferenceModel: class PreferenceModelFromChatRenderer (line 118) | class PreferenceModelFromChatRenderer(PreferenceModel): method __init__ (line 119) | def __init__(self, convo_renderer: renderers.Renderer, sampling_client... method __call__ (line 123) | async def __call__(self, comparison: Comparison) -> float: class PreferenceModelBuilderFromChatRenderer (line 146) | class PreferenceModelBuilderFromChatRenderer(PreferenceModelBuilder): method __call__ (line 152) | def __call__(self) -> PreferenceModel: FILE: tinker_cookbook/recipes/chat_sl/chat_datasets.py class Tulu3Builder (line 24) | class Tulu3Builder(ChatDatasetBuilder): method __call__ (line 25) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset]: class NoRobotsBuilder (line 54) | class NoRobotsBuilder(ChatDatasetBuilder): method __call__ (line 55) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset]: FILE: tinker_cookbook/recipes/chat_sl/train.py class CLIConfig (line 21) | class CLIConfig: function get_dataset_builder (line 60) | def get_dataset_builder( function get_infrequent_evaluator_builders (line 91) | def get_infrequent_evaluator_builders( function cli_main (line 116) | def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/code_rl/code_env.py function _load_deepcoder_split (line 28) | def _load_deepcoder_split(split: Literal["train", "test"]) -> Dataset: function _ensure_dict (line 44) | def _ensure_dict(metadata: Any) -> dict[str, Any]: function _normalize_tests (line 56) | def _normalize_tests(raw_tests: Any, metadata: dict[str, Any]) -> list[d... function _build_question (line 91) | def _build_question(example: dict[str, Any]) -> str | None: function load_deepcoder_tasks (line 102) | def load_deepcoder_tasks( function _initial_messages (line 154) | def _initial_messages( class DeepcoderEnvGroupBuilder (line 171) | class DeepcoderEnvGroupBuilder(EnvGroupBuilder): method make_envs (line 184) | async def make_envs(self) -> Sequence[Env]: method logging_tags (line 212) | def logging_tags(self) -> list[str]: class DeepcoderDataset (line 216) | class DeepcoderDataset(RLDataset): method __init__ (line 219) | def __init__( method get_batch (line 227) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 232) | def __len__(self) -> int: class DeepcoderDatasetBuilder (line 237) | class DeepcoderDatasetBuilder(RLDatasetBuilder): method __call__ (line 250) | async def __call__(self) -> tuple[RLDataset, RLDataset | None]: FILE: tinker_cookbook/recipes/code_rl/code_grading.py function _get_sandboxfusion_client (line 23) | def _get_sandboxfusion_client() -> SandboxFusionClient: function _get_modal_pool (line 31) | def _get_modal_pool(): function extract_code_from_model (line 44) | def extract_code_from_model(model_response: str) -> str | None: function postprocess_lcb_sample (line 52) | def postprocess_lcb_sample(sample: list[dict[str, Any]]) -> dict[str, str]: function _check_with_sandboxfusion (line 74) | async def _check_with_sandboxfusion( function _check_with_modal (line 94) | async def _check_with_modal( function sandbox_check_correctness (line 119) | async def sandbox_check_correctness( function taco_to_lcb_format (line 158) | def taco_to_lcb_format(tests: dict[str, Any]) -> list[dict[str, Any]]: FILE: tinker_cookbook/recipes/code_rl/deepcoder_tool.py class DeepcoderTask (line 19) | class DeepcoderTask: class DeepcoderTool (line 27) | class DeepcoderTool: method __init__ (line 33) | def __init__( method check_solution (line 44) | async def check_solution( class DeepcoderReward (line 69) | class DeepcoderReward: method __call__ (line 85) | async def __call__(self, history: list[Message]) -> tuple[float, dict[... FILE: tinker_cookbook/recipes/code_rl/lcb_utils.py function fetch_live_code_bench_system_prompt (line 809) | def fetch_live_code_bench_system_prompt(prompt: str, starter_code: str |... FILE: tinker_cookbook/recipes/code_rl/train.py class CLIConfig (line 17) | class CLIConfig: function cli_main (line 64) | async def cli_main(cli_config: CLIConfig) -> None: FILE: tinker_cookbook/recipes/distillation/harbor_multiturn.py function zero_reward (line 21) | async def zero_reward(history: list[Message]) -> tuple[float, dict[str, ... class HarborDistillationDatasetBuilder (line 27) | class HarborDistillationDatasetBuilder(HarborDatasetBuilder): method __call__ (line 30) | async def __call__(self) -> tuple[RLDataset, RLDataset | None]: FILE: tinker_cookbook/recipes/distillation/harbor_multiturn_test.py class TestZeroReward (line 11) | class TestZeroReward: method test_zero_reward_returns_zero (line 12) | def test_zero_reward_returns_zero(self): method test_zero_reward_ignores_history_content (line 20) | def test_zero_reward_ignores_history_content(self): method test_env_group_builder_compute_group_rewards_returns_zeros (line 29) | def test_env_group_builder_compute_group_rewards_returns_zeros(self): FILE: tinker_cookbook/recipes/distillation/off_policy_reasoning.py class OpenThoughts3Builder (line 44) | class OpenThoughts3Builder(ChatDatasetBuilder): method __call__ (line 50) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: class CLIConfig (line 91) | class CLIConfig: function cli_main (line 128) | def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/distillation/on_policy_distillation.py class CLIConfig (line 49) | class CLIConfig: function cli_main (line 100) | async def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/distillation/on_policy_distillation_harbor_multi_turn.py class CLIConfig (line 56) | class CLIConfig: function cli_main (line 109) | async def cli_main(cli_config: CLIConfig, tasks: list[HarborTask]): FILE: tinker_cookbook/recipes/distillation/on_policy_multi_teacher.py class CLIConfig (line 41) | class CLIConfig: function cli_main (line 94) | async def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/harbor_rl/eval.py class EvalConfig (line 44) | class EvalConfig: class TaskResult (line 62) | class TaskResult: function evaluate_task (line 72) | async def evaluate_task( function run_eval (line 169) | async def run_eval( FILE: tinker_cookbook/recipes/harbor_rl/harbor_env.py function default_sandbox_factory (line 37) | async def default_sandbox_factory(image: modal.Image, timeout: int) -> S... class HarborTask (line 42) | class HarborTask: function load_harbor_tasks (line 51) | def load_harbor_tasks(dataset: str) -> list[HarborTask]: function _initial_messages (line 69) | def _initial_messages( class HarborEnvGroupBuilder (line 83) | class HarborEnvGroupBuilder(EnvGroupBuilder): method __init__ (line 86) | def __init__( method make_envs (line 113) | async def make_envs(self) -> Sequence[Env]: method cleanup (line 153) | async def cleanup(self) -> None: method logging_tags (line 161) | def logging_tags(self) -> list[str]: class HarborDataset (line 165) | class HarborDataset(RLDataset): method __init__ (line 168) | def __init__( method get_batch (line 176) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 181) | def __len__(self) -> int: class HarborDatasetBuilder (line 186) | class HarborDatasetBuilder(RLDatasetBuilder): method _make_env_group_builders (line 202) | def _make_env_group_builders(self, group_size: int) -> list[HarborEnvG... method __call__ (line 220) | async def __call__(self) -> tuple[RLDataset, RLDataset | None]: FILE: tinker_cookbook/recipes/harbor_rl/harbor_tools.py class HarborBashTool (line 20) | class HarborBashTool: method __init__ (line 26) | def __init__(self, sandbox: SandboxInterface, command_timeout: int = 1... method bash (line 31) | async def bash( class HarborReward (line 49) | class HarborReward: method __call__ (line 62) | async def __call__(self, history: list[Message]) -> tuple[float, dict[... method _upload_tests (line 90) | async def _upload_tests(self) -> None: method _parse_reward (line 100) | async def _parse_reward(self) -> float: FILE: tinker_cookbook/recipes/harbor_rl/harbor_tools_test.py class FakeSandbox (line 18) | class FakeSandbox: method __init__ (line 21) | def __init__(self) -> None: method sandbox_id (line 29) | def sandbox_id(self) -> str: method set_command_result (line 32) | def set_command_result(self, command: str, result: SandboxResult) -> N... method send_heartbeat (line 35) | async def send_heartbeat(self) -> None: method run_command (line 38) | async def run_command( method read_file (line 50) | async def read_file( method write_file (line 57) | async def write_file( method cleanup (line 65) | async def cleanup(self) -> None: class TestHarborReward (line 74) | class TestHarborReward: method _make_reward (line 75) | def _make_reward(self, tmp_path: Path, sandbox: FakeSandbox, **kwargs)... method test_reward_from_txt (line 78) | def test_reward_from_txt(self, tmp_path: Path) -> None: method test_reward_from_json (line 87) | def test_reward_from_json(self, tmp_path: Path) -> None: method test_no_reward_file (line 96) | def test_no_reward_file(self, tmp_path: Path) -> None: method test_zero_reward (line 104) | def test_zero_reward(self, tmp_path: Path) -> None: method test_grading_error (line 113) | def test_grading_error(self, tmp_path: Path) -> None: method test_upload_tests (line 133) | def test_upload_tests(self, tmp_path: Path) -> None: class TestHarborBashTool (line 158) | class TestHarborBashTool: method test_bash_tool_basic (line 159) | def test_bash_tool_basic(self) -> None: method test_bash_tool_truncation (line 175) | def test_bash_tool_truncation(self) -> None: class TestHarborEnvGroupBuilderPickle (line 199) | class TestHarborEnvGroupBuilderPickle: method _make_task (line 200) | def _make_task(self, tmp_path: Path) -> HarborTask: method test_pickle_roundtrip (line 208) | def test_pickle_roundtrip(self, tmp_path: Path) -> None: method test_pickle_with_custom_params (line 231) | def test_pickle_with_custom_params(self, tmp_path: Path) -> None: FILE: tinker_cookbook/recipes/harbor_rl/train.py class CLIConfig (line 20) | class CLIConfig: function cli_main (line 61) | async def cli_main( FILE: tinker_cookbook/recipes/math_rl/arithmetic_env.py class ArithmeticEnv (line 13) | class ArithmeticEnv(ProblemEnv): method __init__ (line 18) | def __init__( method get_question (line 29) | def get_question(self) -> str: method check_answer (line 32) | def check_answer(self, sample_str: str) -> bool: method check_format (line 40) | def check_format(self, sample_str: str) -> bool: method get_reference_answer (line 43) | def get_reference_answer(self) -> str: method standard_fewshot_prefix (line 47) | def standard_fewshot_prefix() -> list[renderers.Message]: class ArithmeticDataset (line 54) | class ArithmeticDataset(RLDataset): method __init__ (line 55) | def __init__( method get_batch (line 70) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method _make_env_group_builder (line 74) | def _make_env_group_builder(self, rng: np.random.RandomState) -> Probl... method __len__ (line 85) | def __len__(self) -> int: class ArithmeticDatasetBuilder (line 90) | class ArithmeticDatasetBuilder(RLDatasetBuilder): method __call__ (line 98) | async def __call__(self) -> tuple[ArithmeticDataset, None]: FILE: tinker_cookbook/recipes/math_rl/math_env.py class MathEnv (line 22) | class MathEnv(ProblemEnv): method __init__ (line 23) | def __init__( method question_suffix (line 39) | def question_suffix(cls) -> str: method get_question (line 42) | def get_question(self) -> str: method check_format (line 45) | def check_format(self, sample_str: str) -> bool: method check_answer (line 52) | def check_answer(self, sample_str: str) -> bool: method get_reference_answer (line 59) | def get_reference_answer(self) -> str: method standard_fewshot_prefix (line 63) | def standard_fewshot_prefix() -> list[renderers.Message]: function safe_grade (line 76) | def safe_grade(given_answer: str, ground_truth: str, grader: str = "symp... function extract_gsm8k_final_answer (line 92) | def extract_gsm8k_final_answer(text: str) -> str: function _get_hendrycks_math_test (line 113) | def _get_hendrycks_math_test() -> Dataset: function _get_hendrycks_math_train (line 118) | def _get_hendrycks_math_train() -> Dataset: class MathDataset (line 143) | class MathDataset(RLDataset): method __init__ (line 144) | def __init__( method get_batch (line 162) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 172) | def __len__(self) -> int: method _make_env_group_builder (line 175) | def _make_env_group_builder( class MathDatasetBuilder (line 192) | class MathDatasetBuilder(RLDatasetBuilder): method __call__ (line 200) | async def __call__(self) -> tuple[MathDataset, MathDataset]: class PolarisDataset (line 221) | class PolarisDataset(MathDataset): method __init__ (line 222) | def __init__( method _make_env_group_builder (line 239) | def _make_env_group_builder( class PolarisDatasetBuilder (line 257) | class PolarisDatasetBuilder(RLDatasetBuilder): method __call__ (line 264) | async def __call__(self) -> tuple[PolarisDataset, None]: class DeepMathDataset (line 274) | class DeepMathDataset(MathDataset): method __init__ (line 275) | def __init__( method _make_env_group_builder (line 290) | def _make_env_group_builder( class DeepMathDatasetBuilder (line 308) | class DeepMathDatasetBuilder(RLDatasetBuilder): method __call__ (line 315) | async def __call__(self) -> tuple[DeepMathDataset, None]: class Gsm8kDataset (line 325) | class Gsm8kDataset(RLDataset): method __init__ (line 326) | def __init__( method question_suffix (line 346) | def question_suffix(cls) -> str: method get_batch (line 349) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 359) | def __len__(self) -> int: method _make_env_group_builder (line 362) | def _make_env_group_builder( class Gsm8kDatasetBuilder (line 380) | class Gsm8kDatasetBuilder(RLDatasetBuilder): method __call__ (line 388) | async def __call__(self) -> tuple[Gsm8kDataset, Gsm8kDataset]: function get_math_dataset_builder (line 418) | def get_math_dataset_builder( FILE: tinker_cookbook/recipes/math_rl/math_env_test.py function test_math_dataset_builder (line 6) | def test_math_dataset_builder(): FILE: tinker_cookbook/recipes/math_rl/math_grading.py function normalize_answer (line 36) | def normalize_answer(answer: str | None) -> str | None: function _fix_fracs (line 50) | def _fix_fracs(string: str) -> str: function _fix_a_slash_b (line 82) | def _fix_a_slash_b(string: str) -> str: function _remove_right_units (line 97) | def _remove_right_units(string: str) -> str: function _fix_sqrt (line 107) | def _fix_sqrt(string: str) -> str: function _strip_string (line 122) | def _strip_string(string: str) -> str: function extract_boxed (line 191) | def extract_boxed(text: str) -> str: function _sympy_parse (line 229) | def _sympy_parse(expr: str): function _parse_latex (line 241) | def _parse_latex(expr: str) -> str: function _is_float (line 259) | def _is_float(num: str) -> bool: function _is_int (line 267) | def _is_int(x: float) -> bool: function _is_frac (line 274) | def _is_frac(expr: str) -> bool: function _str_is_int (line 278) | def _str_is_int(x_str: str) -> bool: function _str_to_int (line 287) | def _str_to_int(x_str: str) -> int: function _inject_implicit_mixed_number (line 293) | def _inject_implicit_mixed_number(step: str): function _strip_properly_formatted_commas (line 303) | def _strip_properly_formatted_commas(expr: str): function _normalize (line 314) | def _normalize(expr: str) -> str: function count_unknown_letters_in_expr (line 385) | def count_unknown_letters_in_expr(expr: str): function should_allow_eval (line 392) | def should_allow_eval(expr: str): function are_equal_under_sympy (line 404) | def are_equal_under_sympy(ground_truth_normalized: str, given_normalized... function split_tuple (line 418) | def split_tuple(expr: str): function grade_answer (line 437) | def grade_answer(given_answer: str, ground_truth: str) -> bool: function grade_answer_math_verify (line 496) | def grade_answer_math_verify(given_answer: str, ground_truth: str) -> bool: class TimeoutException (line 522) | class TimeoutException(Exception): function run_with_timeout_signal (line 526) | def run_with_timeout_signal( FILE: tinker_cookbook/recipes/math_rl/train.py class CLIConfig (line 21) | class CLIConfig: function get_dataset_builder (line 77) | def get_dataset_builder( function cli_main (line 107) | async def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/multiplayer_rl/guess_number/env.py class GuessNumberEnv (line 32) | class GuessNumberEnv(Env): method __init__ (line 33) | def __init__(self, gold_answer: int, renderer: Renderer): method stop_condition (line 40) | def stop_condition(self) -> StopCondition: method _obs (line 44) | def _obs(self) -> ModelInput: method initial_observation (line 49) | async def initial_observation(self) -> tuple[ModelInput, StopCondition]: method _get_user_turn (line 52) | def _get_user_turn(self, action_text: str) -> tuple[Message, float]: method step (line 71) | async def step(self, action: Action) -> StepResult: class GuessNumberEnvGroupBuilder (line 103) | class GuessNumberEnvGroupBuilder(EnvGroupBuilder): method make_envs (line 108) | async def make_envs(self) -> Sequence[Env]: class GuessNumberDataset (line 116) | class GuessNumberDataset(RLDataset): method get_batch (line 122) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 132) | def __len__(self) -> int: class GuessNumberDatasetBuilder (line 137) | class GuessNumberDatasetBuilder(RLDatasetBuilder): method __call__ (line 146) | async def __call__(self) -> tuple[RLDataset, RLDataset]: method _get_train_and_test_numbers (line 164) | def _get_train_and_test_numbers(self) -> tuple[list[int], list[int]]: FILE: tinker_cookbook/recipes/multiplayer_rl/guess_number/train.py class CLIConfig (line 12) | class CLIConfig: function build_config (line 30) | def build_config(cli_config: CLIConfig) -> train.Config: FILE: tinker_cookbook/recipes/multiplayer_rl/text_arena/env.py class TwoPlayerCoordinator (line 38) | class TwoPlayerCoordinator: method __init__ (line 41) | def __init__(self, shared_env: ta.Env): method state (line 47) | def state(self) -> ta.State: method current_player_id (line 51) | def current_player_id(self) -> int: method game_done (line 56) | def game_done(self) -> bool: method rewards (line 61) | def rewards(self) -> dict | None: method wait_across_env (line 65) | async def wait_across_env(self, player_id: int) -> None: method make_move (line 72) | async def make_move(self, player_id: int, move: str) -> None: class TwoPlayerEnv (line 97) | class TwoPlayerEnv(Env): method __post_init__ (line 106) | def __post_init__(self): method stop_condition (line 112) | def stop_condition(self) -> StopCondition: method wait_for_turn (line 115) | async def wait_for_turn(self) -> None: method initial_observation (line 123) | async def initial_observation(self) -> tuple[Observation, StopCondition]: method opponent_step (line 128) | async def opponent_step(self) -> None: method step (line 141) | async def step(self, action: Action) -> StepResult: method get_done_step (line 164) | def get_done_step(self) -> StepResult: method compute_reward (line 173) | def compute_reward(self) -> float: method get_observation (line 180) | def get_observation(self) -> types.ModelInput: class TwoPlayerEnvGroupBuilder (line 191) | class TwoPlayerEnvGroupBuilder(EnvGroupBuilder): method make_envs (line 201) | async def make_envs(self) -> Sequence[Env]: class TwoPlayerTextArenaDataset (line 235) | class TwoPlayerTextArenaDataset(RLDataset): method __init__ (line 238) | def __init__(self, batch_size: int, builder: TwoPlayerEnvGroupBuilder,... method get_batch (line 246) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 253) | def __len__(self) -> int: class TwoPlayerTextArenaDatasetBuilder (line 258) | class TwoPlayerTextArenaDatasetBuilder(RLDatasetBuilder): method _construct_opponent_policy (line 267) | def _construct_opponent_policy(self, renderer: Renderer) -> TinkerMess... method __call__ (line 278) | async def __call__(self) -> tuple[TwoPlayerTextArenaDataset, TwoPlayer... FILE: tinker_cookbook/recipes/multiplayer_rl/text_arena/train.py class CLIConfig (line 12) | class CLIConfig: function build_config (line 32) | def build_config(cli_config: CLIConfig) -> train.Config: FILE: tinker_cookbook/recipes/multiplayer_rl/twenty_questions/env.py class TwentyQuestionsEnv (line 40) | class TwentyQuestionsEnv(Env): method __init__ (line 41) | def __init__(self, answerer: MessageCompleter, answer: str, renderer: ... method stop_condition (line 56) | def stop_condition(self) -> StopCondition: method _convo_for_player (line 59) | def _convo_for_player(self) -> list[Message]: method _get_obs (line 67) | def _get_obs(self) -> ModelInput: method _convo_for_answerer (line 71) | def _convo_for_answerer(self) -> list[Message]: method initial_observation (line 84) | async def initial_observation(self) -> tuple[ModelInput, StopCondition]: method _compute_reward (line 87) | def _compute_reward(self, content: str) -> float: method step (line 98) | async def step(self, action: Action) -> StepResult: function _load_words_from_file (line 145) | def _load_words_from_file() -> list[str]: class TwentyQuestionsEnvGroupBuilder (line 157) | class TwentyQuestionsEnvGroupBuilder(EnvGroupBuilder): method make_envs (line 163) | async def make_envs(self) -> Sequence[Env]: class TwentyQuestionsDataset (line 174) | class TwentyQuestionsDataset(RLDataset): method get_batch (line 181) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 192) | def __len__(self) -> int: class TwentyQuestionsDatasetBuilder (line 197) | class TwentyQuestionsDatasetBuilder(RLDatasetBuilder): method __call__ (line 207) | async def __call__(self) -> tuple[RLDataset, RLDataset]: method _construct_answer_completer (line 231) | def _construct_answer_completer(self, service_client: tinker.ServiceCl... method _get_train_and_test_words (line 248) | def _get_train_and_test_words(self) -> tuple[list[str], list[str]]: function construct_minimal_20q_env (line 257) | def construct_minimal_20q_env(answer: str) -> TwentyQuestionsEnv: FILE: tinker_cookbook/recipes/multiplayer_rl/twenty_questions/train.py class CLIConfig (line 14) | class CLIConfig: function build_config (line 33) | def build_config(cli_config: CLIConfig) -> train.Config: FILE: tinker_cookbook/recipes/preference/datasets.py function _hhh_parse_conversation (line 24) | def _hhh_parse_conversation(text: str) -> list[renderers.Message]: function hhh_example_to_comparison (line 49) | def hhh_example_to_comparison(example: dict[str, str]) -> LabeledCompari... function _arena_parse_conversation (line 71) | def _arena_parse_conversation(conversation: list) -> list[renderers.Mess... class Tulu38BComparisonBuilder (line 105) | class Tulu38BComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 108) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 118) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... class HHHComparisonBuilder (line 134) | class HHHComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 139) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 146) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... class HelpSteer3ComparisonBuilder (line 151) | class HelpSteer3ComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 154) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 161) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... class UltraFeedbackComparisonBuilder (line 183) | class UltraFeedbackComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 186) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 196) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... class ArenaComparisonBuilder (line 212) | class ArenaComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 215) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 224) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... class HelpSteer2ComparisonBuilder (line 261) | class HelpSteer2ComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 264) | def get_train_and_test_datasets(self) -> tuple[datasets.Dataset, datas... method example_to_labeled_comparison (line 304) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... FILE: tinker_cookbook/recipes/preference/dpo/train.py class CLIConfig (line 24) | class CLIConfig: function get_dataset_builder (line 53) | def get_dataset_builder( function cli_main (line 84) | def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/preference/rlhf/rlhf_pipeline.py class CLIConfig (line 22) | class CLIConfig: function sft_stage (line 49) | def sft_stage( function train_rm (line 102) | def train_rm( function train_rl (line 157) | async def train_rl( function cli_main (line 243) | def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/preference/shorter/env.py class PreferenceModelShorter (line 28) | class PreferenceModelShorter(PreferenceModel): method _get_completion_length (line 33) | def _get_completion_length(self, completion: list[Message]) -> int: method __call__ (line 39) | async def __call__(self, comparison: Comparison) -> float: class ShorterComparisonBuilder (line 51) | class ShorterComparisonBuilder(ComparisonDatasetBuilder): method get_train_and_test_datasets (line 52) | def get_train_and_test_datasets(self) -> tuple[Dataset, Dataset | None]: method example_to_labeled_comparison (line 55) | def example_to_labeled_comparison(self, example: dict) -> LabeledCompa... class ShorterPreferenceModelBuilder (line 60) | class ShorterPreferenceModelBuilder(PreferenceModelBuilder): method __call__ (line 61) | def __call__(self) -> PreferenceModel: FILE: tinker_cookbook/recipes/preference/shorter/train.py class CLIConfig (line 16) | class CLIConfig: function cli_main (line 37) | def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/prompt_distillation/create_data.py class Config (line 79) | class Config: function setup_clients (line 83) | def setup_clients(): function create_data_async (line 99) | async def create_data_async(cfg: Config, sampling_client: Any, tokenizer... function main (line 156) | def main(cfg: Config): FILE: tinker_cookbook/recipes/prompt_distillation/train.py class CLIConfig (line 20) | class CLIConfig: function cli_main (line 57) | def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/rl_basic.py function build_config_blueprint (line 11) | def build_config_blueprint() -> chz.Blueprint[train.Config]: function main (line 34) | def main(config: train.Config): FILE: tinker_cookbook/recipes/rl_loop.py class Config (line 37) | class Config: function get_reward (line 50) | def get_reward(response: str, answer: str) -> float: function main (line 59) | def main(config: Config): FILE: tinker_cookbook/recipes/rubric/data.py class Rubric (line 19) | class Rubric: method _convert_role (line 30) | def _convert_role(self, role: Role) -> str: method _flatten_convo (line 33) | def _flatten_convo(self, convo: Conversation) -> str: method get_grader_prompt (line 45) | def get_grader_prompt(self, convo: Conversation) -> Conversation: method extract_score (line 80) | def extract_score(self, response: str) -> float: method to_dict (line 92) | def to_dict(self) -> dict[str, str]: method to_json (line 99) | def to_json(self) -> str: method from_dict (line 103) | def from_dict(d: dict[str, str]) -> "Rubric": method from_json (line 111) | def from_json(json_str: str) -> "Rubric": class RubricBasedDatapoint (line 116) | class RubricBasedDatapoint: method to_json (line 125) | def to_json(self) -> str: method from_json (line 134) | def from_json(json_str: str) -> "RubricBasedDatapoint": class RubricDatapointListBuilder (line 143) | class RubricDatapointListBuilder: method __call__ (line 144) | def __call__(self) -> Sequence[RubricBasedDatapoint]: class RubricDatapointListBuilderFromJsonl (line 150) | class RubricDatapointListBuilderFromJsonl(RubricDatapointListBuilder): method __call__ (line 153) | def __call__(self) -> Sequence[RubricBasedDatapoint]: class PrometheusDatapointListBuilder (line 168) | class PrometheusDatapointListBuilder(RubricDatapointListBuilder): method __call__ (line 171) | def __call__(self) -> Sequence[RubricBasedDatapoint]: method build_rubric_datapoint (line 177) | def build_rubric_datapoint(self, item: dict[str, Any]) -> RubricBasedD... FILE: tinker_cookbook/recipes/rubric/debug_env.py function get_addition_datapoint (line 13) | def get_addition_datapoint() -> RubricBasedDatapoint: function get_prometheus_datapoint (line 29) | def get_prometheus_datapoint() -> RubricBasedDatapoint: function main (line 37) | async def main(datapoint: RubricBasedDatapoint): FILE: tinker_cookbook/recipes/rubric/env.py class RubricGradedEnv (line 33) | class RubricGradedEnv(Env): method __init__ (line 34) | def __init__( method rubric_items (line 53) | def rubric_items(self) -> Sequence[Rubric]: method convo (line 57) | def convo(self) -> Conversation: method stop_condition (line 61) | def stop_condition(self) -> StopCondition: method initial_observation (line 64) | async def initial_observation(self) -> tuple[ModelInput, StopCondition]: method _grade_with_rubric (line 67) | async def _grade_with_rubric(self, convo: Conversation, rubric: Rubric... method step (line 90) | async def step(self, action: Action) -> StepResult: class RubricGradedEnvGroupBuilder (line 173) | class RubricGradedEnvGroupBuilder(EnvGroupBuilder): method make_envs (line 179) | async def make_envs(self) -> Sequence[RubricGradedEnv]: class RubricGradedDataset (line 191) | class RubricGradedDataset(RLDataset): method get_batch (line 198) | def get_batch(self, index: int) -> Sequence[RubricGradedEnvGroupBuilder]: method __len__ (line 210) | def __len__(self) -> int: class RubricGradedDatasetBuilder (line 215) | class RubricGradedDatasetBuilder(RLDatasetBuilder): method _get_grader_llm (line 228) | def _get_grader_llm(self) -> MessageCompleter: method __call__ (line 238) | async def __call__(self) -> tuple[RubricGradedDataset, RubricGradedDat... FILE: tinker_cookbook/recipes/rubric/generate_data.py function generate_one (line 7) | def generate_one(rng: random.Random) -> RubricBasedDatapoint: function generate_dataset (line 19) | def generate_dataset( FILE: tinker_cookbook/recipes/rubric/prometheus_experimental.py class CLIConfig (line 15) | class CLIConfig: function get_dataset_builder (line 62) | def get_dataset_builder( function cli_main (line 82) | async def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/rubric/train.py class CLIConfig (line 15) | class CLIConfig: function get_dataset_builder (line 65) | def get_dataset_builder( function cli_main (line 91) | async def cli_main(cli_config: CLIConfig): FILE: tinker_cookbook/recipes/search_tool/chroma_pickle_test.py class TestChromatoolPickle (line 14) | class TestChromatoolPickle: method test_pickle_excludes_clients (line 15) | def test_pickle_excludes_clients(self) -> None: FILE: tinker_cookbook/recipes/search_tool/embedding.py function get_gemini_client (line 20) | def get_gemini_client( function get_gemini_embedding (line 52) | async def get_gemini_embedding( FILE: tinker_cookbook/recipes/search_tool/offline_eval.py class CLIConfig (line 31) | class CLIConfig: class EvaluationResult (line 45) | class EvaluationResult(TypedDict): function split_data_by_source (line 51) | def split_data_by_source(data: list[SearchR1Datum]) -> dict[str, list[Se... function sample_k_from_each_source (line 59) | def sample_k_from_each_source( function evaluate_single_item (line 79) | async def evaluate_single_item( function evaluate_one_dataset (line 109) | async def evaluate_one_dataset(data: list[SearchR1Datum], config: CLICon... function cli_main (line 158) | async def cli_main(config: CLIConfig): FILE: tinker_cookbook/recipes/search_tool/search_env.py class SearchR1Datum (line 44) | class SearchR1Datum(TypedDict): function process_single_row (line 50) | def process_single_row(row_series: pd.Series) -> SearchR1Datum: function download_search_r1_dataset (line 90) | def download_search_r1_dataset(split: Literal["train", "test"]) -> list[... function _initial_messages (line 111) | def _initial_messages( class SearchEnvGroupBuilder (line 125) | class SearchEnvGroupBuilder(EnvGroupBuilder): method __init__ (line 128) | def __init__( method make_envs (line 148) | async def make_envs(self) -> Sequence[Env]: method logging_tags (line 173) | def logging_tags(self) -> list[str]: class SearchRLDataset (line 177) | class SearchRLDataset(RLDataset): method __init__ (line 180) | def __init__( method get_batch (line 188) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 193) | def __len__(self) -> int: class SearchR1DatasetBuilder (line 198) | class SearchR1DatasetBuilder(RLDatasetBuilder): method __call__ (line 216) | async def __call__(self) -> tuple[RLDataset, RLDataset | None]: FILE: tinker_cookbook/recipes/search_tool/tools.py function normalize_answer (line 27) | def normalize_answer(s: str) -> str: class EmbeddingConfig (line 54) | class EmbeddingConfig: class RetrievalConfig (line 61) | class RetrievalConfig: class ChromaTool (line 66) | class ChromaTool: method __init__ (line 75) | def __init__( method __getstate__ (line 97) | def __getstate__(self) -> dict: method _ensure_clients (line 104) | async def _ensure_clients(self) -> tuple[AsyncClientAPI, genai.Client]: method build (line 122) | async def build( method _get_embeddings_with_retry (line 164) | async def _get_embeddings_with_retry( method _query_chroma_with_retry (line 176) | async def _query_chroma_with_retry( method search (line 201) | async def search( class TextAnswerReward (line 227) | class TextAnswerReward: method __call__ (line 236) | async def __call__(self, history: list[Message]) -> tuple[float, dict[... method _extract_answer (line 257) | def _extract_answer(self, text: str) -> str | None: method _check_answer (line 265) | def _check_answer(self, text: str) -> bool: FILE: tinker_cookbook/recipes/search_tool/train.py class CLIConfig (line 19) | class CLIConfig: function cli_main (line 60) | async def cli_main(cli_config: CLIConfig) -> None: FILE: tinker_cookbook/recipes/sl_basic.py function build_config_blueprint (line 14) | def build_config_blueprint() -> chz.Blueprint[train.Config]: function main (line 45) | def main(config: train.Config): FILE: tinker_cookbook/recipes/sl_loop.py class Config (line 24) | class Config: function main (line 37) | def main(config: Config): FILE: tinker_cookbook/recipes/verifiers_rl/evaluate.py function log_results (line 18) | def log_results( function evaluate (line 64) | async def evaluate( class CLIConfig (line 136) | class CLIConfig: function cli_main (line 148) | async def cli_main(cfg: CLIConfig): FILE: tinker_cookbook/recipes/verifiers_rl/tinker_openai.py class TinkerAsyncOpenAIClient (line 29) | class TinkerAsyncOpenAIClient(AsyncOpenAI): method __init__ (line 34) | def __init__( method set_sampling_client (line 45) | def set_sampling_client(self, sampling_client: tinker.SamplingClient) ... method chat (line 49) | def chat(self) -> OpenAIAsyncChat: method completions (line 53) | def completions(self) -> OpenAIAsyncCompletions: class TinkerChatCompletions (line 57) | class TinkerChatCompletions(OpenAIAsyncChatCompletions): method __init__ (line 58) | def __init__(self, parent: TinkerAsyncOpenAIClient) -> None: method create (line 62) | async def create( method create (line 67) | async def create( method create (line 72) | async def create(self, *args: Any, stream: bool, **kwargs: Any) -> Cha... method create (line 74) | async def create(self, *args: Any, **kwargs: Any) -> ChatCompletion | ... class TinkerCompletions (line 160) | class TinkerCompletions(OpenAIAsyncCompletions): method __init__ (line 161) | def __init__(self, parent: TinkerAsyncOpenAIClient) -> None: method create (line 165) | async def create( method create (line 170) | async def create( method create (line 175) | async def create( method create (line 179) | async def create(self, *args: Any, **kwargs: Any) -> Completion | Asyn... class TinkerAsyncChat (line 236) | class TinkerAsyncChat(OpenAIAsyncChat): method __init__ (line 237) | def __init__(self, parent: TinkerAsyncOpenAIClient) -> None: method completions (line 241) | def completions(self) -> OpenAIAsyncChatCompletions: class TinkerAsyncCompletionStream (line 245) | class TinkerAsyncCompletionStream(AsyncStream[Completion]): method __init__ (line 246) | def __init__(self, final: Completion) -> None: method __aiter__ (line 249) | def __aiter__(self): method __anext__ (line 253) | async def __anext__(self) -> Completion: method __await__ (line 256) | def __await__(self): method get_final_response (line 262) | async def get_final_response(self) -> Completion: FILE: tinker_cookbook/recipes/verifiers_rl/train.py class CLIConfig (line 28) | class CLIConfig: function cli_main (line 61) | async def cli_main(cli_config: CLIConfig, env: Any | None): FILE: tinker_cookbook/recipes/verifiers_rl/verifiers_env.py function set_vf_env (line 23) | def set_vf_env(env: vf.Environment) -> None: function get_vf_env (line 28) | def get_vf_env() -> vf.Environment | None: function convert_states_to_trajectory_group (line 33) | def convert_states_to_trajectory_group(states: list[vf.State]) -> Trajec... class VerifiersRLDataset (line 80) | class VerifiersRLDataset(RLDataset): method __init__ (line 81) | def __init__( method __len__ (line 91) | def __len__(self) -> int: method get_batch (line 94) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: class VerifiersRLDatasetBuilder (line 114) | class VerifiersRLDatasetBuilder(RLDatasetBuilder): method __call__ (line 121) | async def __call__(self) -> tuple[RLDataset, RLDataset | None]: class VerifiersEnvGroupBuilder (line 140) | class VerifiersEnvGroupBuilder(EnvGroupBuilder): method __init__ (line 151) | def __init__( method __getstate__ (line 167) | def __getstate__(self) -> dict: method __setstate__ (line 173) | def __setstate__(self, state: dict) -> None: method get_rollout_inputs (line 190) | def get_rollout_inputs(self, group_size: int) -> list[vf.RolloutInput]: method make_envs (line 202) | async def make_envs(self): method logging_tags (line 205) | def logging_tags(self) -> list[str]: FILE: tinker_cookbook/recipes/verifiers_rl/verifiers_pickle_test.py class TestVerifiersEnvGroupBuilderPickle (line 14) | class TestVerifiersEnvGroupBuilderPickle: method test_pickle_excludes_vf_env (line 15) | def test_pickle_excludes_vf_env(self) -> None: FILE: tinker_cookbook/recipes/vlm_classifier/data.py class ClassifierDatasetConfig (line 36) | class ClassifierDatasetConfig: class ClassifierDataset (line 64) | class ClassifierDataset(SupervisedDataset): method __init__ (line 65) | def __init__(self, config: ClassifierDatasetConfig): method get_shuffled_indices (line 90) | def get_shuffled_indices(self, seed: int = 0) -> list[int]: method _sample_per_class (line 108) | def _sample_per_class(self, dataset: datasets.Dataset) -> datasets.Dat... method get_class_name (line 135) | def get_class_name(self, label: str) -> str: method build_supervised_example (line 142) | def build_supervised_example( method get_batch (line 191) | def get_batch(self, index: int) -> list[tinker.Datum]: method __len__ (line 207) | def __len__(self) -> int: method set_epoch (line 214) | def set_epoch(self, seed: int = 0): class Caltech101DatasetBuilder (line 223) | class Caltech101DatasetBuilder(SupervisedDatasetBuilder): method __call__ (line 245) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: class Flowers102DatasetBuilder (line 289) | class Flowers102DatasetBuilder(SupervisedDatasetBuilder): method __call__ (line 311) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: class OxfordPetsDatasetBuilder (line 355) | class OxfordPetsDatasetBuilder(SupervisedDatasetBuilder): method __call__ (line 377) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: class StanfordCarsDatasetBuilder (line 421) | class StanfordCarsDatasetBuilder(SupervisedDatasetBuilder): method __call__ (line 443) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: function get_dataset_builder (line 494) | def get_dataset_builder( FILE: tinker_cookbook/recipes/vlm_classifier/eval.py class ClassifierEvaluatorConfig (line 25) | class ClassifierEvaluatorConfig: class ClassifierOutput (line 50) | class ClassifierOutput(TypedDict): class ClassifierEvaluator (line 58) | class ClassifierEvaluator(SamplingClientEvaluator): method __init__ (line 63) | def __init__( method get_class_name (line 89) | def get_class_name(self, label: str) -> str: method build_generation_prompt (line 96) | def build_generation_prompt( method generate_output (line 132) | async def generate_output( method get_metrics_for_output (line 153) | def get_metrics_for_output( method __call__ (line 166) | async def __call__(self, sampling_client: tinker.SamplingClient) -> di... class Caltech101EvaluatorBuilder (line 237) | class Caltech101EvaluatorBuilder: method __call__ (line 255) | def __call__(self) -> ClassifierEvaluator: class Flowers102EvaluatorBuilder (line 276) | class Flowers102EvaluatorBuilder: method __call__ (line 294) | def __call__(self) -> ClassifierEvaluator: class OxfordPetsEvaluatorBuilder (line 315) | class OxfordPetsEvaluatorBuilder: method __call__ (line 333) | def __call__(self) -> ClassifierEvaluator: class StanfordCarsEvaluatorBuilder (line 354) | class StanfordCarsEvaluatorBuilder: method __call__ (line 372) | def __call__(self) -> ClassifierEvaluator: function get_evaluator_builder (line 400) | def get_evaluator_builder( class EvalConfig (line 430) | class EvalConfig: function run_eval (line 455) | def run_eval(eval_config: EvalConfig): FILE: tinker_cookbook/recipes/vlm_classifier/eval_sweep.py function get_checkpoint_at_step (line 42) | def get_checkpoint_at_step( function parse_hyperparams_from_experiment_name (line 67) | def parse_hyperparams_from_experiment_name(experiment_name: str) -> dict... class EvalConfig (line 110) | class EvalConfig: function evaluate_experiment (line 140) | async def evaluate_experiment( function evaluate_sweep (line 202) | async def evaluate_sweep( function run_eval_sweep (line 235) | def run_eval_sweep(eval_config: EvalConfig): FILE: tinker_cookbook/recipes/vlm_classifier/sweep.py class ExperimentConfig (line 30) | class ExperimentConfig: function run_experiment (line 82) | def run_experiment(experiment_config: ExperimentConfig): class SweepConfig (line 154) | class SweepConfig: function run_sweep (line 191) | def run_sweep(sweep_config: SweepConfig): FILE: tinker_cookbook/recipes/vlm_classifier/train.py class ExperimentConfig (line 29) | class ExperimentConfig: function run_experiment (line 85) | def run_experiment(experiment_config: ExperimentConfig): FILE: tinker_cookbook/renderers/__init__.py function register_renderer (line 52) | def register_renderer( function get_registered_renderer_names (line 71) | def get_registered_renderer_names() -> list[str]: function is_renderer_registered (line 76) | def is_renderer_registered(name: str) -> bool: function unregister_renderer (line 81) | def unregister_renderer(name: str) -> bool: function get_renderer (line 96) | def get_renderer( FILE: tinker_cookbook/renderers/base.py class StrictBase (line 40) | class StrictBase(pydantic.BaseModel): method __str__ (line 47) | def __str__(self) -> str: class ToolCall (line 51) | class ToolCall(StrictBase): class FunctionBody (line 68) | class FunctionBody(pydantic.BaseModel): class UnparsedToolCall (line 91) | class UnparsedToolCall(StrictBase): class TextPart (line 113) | class TextPart(TypedDict): class ImagePart (line 121) | class ImagePart(TypedDict): class ThinkingPart (line 130) | class ThinkingPart(TypedDict): class StreamingMessageHeader (line 146) | class StreamingMessageHeader: class StreamingTextDelta (line 157) | class StreamingTextDelta: class StreamingThinkingDelta (line 170) | class StreamingThinkingDelta: class Utf8TokenDecoder (line 194) | class Utf8TokenDecoder: method __post_init__ (line 214) | def __post_init__(self) -> None: method _is_valid_decode (line 223) | def _is_valid_decode(self, text: str) -> bool: method decode (line 232) | def decode(self, tokens: list[int]) -> str | None: method flush (line 274) | def flush(self) -> str: method reset (line 291) | def reset(self) -> None: method has_pending (line 295) | def has_pending(self) -> bool: function _longest_matching_suffix_prefix (line 305) | def _longest_matching_suffix_prefix(text: str, tag: str) -> int: class StreamingParser (line 337) | class StreamingParser: method __post_init__ (line 371) | def __post_init__(self) -> None: method feed (line 380) | def feed(self, token: int) -> Iterator["MessageDelta"]: method _emit_deltas (line 403) | def _emit_deltas(self) -> Iterator["MessageDelta"]: method _emit_remaining (line 417) | def _emit_remaining(self) -> Iterator["MessageDelta"]: method finish (line 430) | def finish(self) -> Iterator["MessageDelta"]: method reset (line 448) | def reset(self) -> None: class ReasoningStreamingParser (line 465) | class ReasoningStreamingParser(StreamingParser): method __post_init__ (line 479) | def __post_init__(self) -> None: method _emit_deltas (line 483) | def _emit_deltas(self) -> Iterator["MessageDelta"]: method _emit_remaining (line 549) | def _emit_remaining(self) -> Iterator["MessageDelta"]: method reset (line 564) | def reset(self) -> None: class Message (line 578) | class Message(TypedDict): class RenderContext (line 621) | class RenderContext: class ToolSpec (line 648) | class ToolSpec(TypedDict): function ensure_text (line 677) | def ensure_text(content: Content) -> str: function ensure_list (line 692) | def ensure_list(content: Content) -> list[ContentPart]: function content_to_jsonable (line 699) | def content_to_jsonable(content: Content) -> str | list[dict[str, Any]]: function message_to_jsonable (line 721) | def message_to_jsonable(message: Message) -> dict[str, Any]: function remove_thinking (line 742) | def remove_thinking(parts: list[ContentPart]) -> list[ContentPart]: function get_text_content (line 747) | def get_text_content(message: Message) -> str: function format_content_as_string (line 759) | def format_content_as_string(content: Content, separator: str = "\n") ->... function _parse_tool_call_json (line 791) | def _parse_tool_call_json(tool_call_str: str, raw_text: str) -> ToolCall... function parse_content_blocks (line 823) | def parse_content_blocks( function parse_think_blocks (line 891) | def parse_think_blocks(content: str) -> list[ContentPart] | None: function _tool_call_payload (line 931) | def _tool_call_payload(tool_call: ToolCall) -> dict[str, object]: class RenderedMessage (line 941) | class RenderedMessage: class TrainOnWhat (line 985) | class TrainOnWhat(StrEnum): function _unpickle_renderer (line 995) | def _unpickle_renderer( class Renderer (line 1015) | class Renderer(ABC): method __init__ (line 1045) | def __init__(self, tokenizer: Tokenizer): method __reduce__ (line 1048) | def __reduce__(self) -> tuple: method has_extension_property (line 1069) | def has_extension_property(self) -> bool: method _bos_tokens (line 1088) | def _bos_tokens(self) -> list[int]: method get_stop_sequences (line 1092) | def get_stop_sequences(self) -> list[str] | list[int]: method render_message (line 1097) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method parse_response (line 1117) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method _normalize_response_tokens (line 1138) | def _normalize_response_tokens(self, response: list[int]) -> list[int]: method _end_message_token (line 1150) | def _end_message_token(self) -> int: method _parse_response_for_streaming (line 1159) | def _parse_response_for_streaming(self, response: list[int]) -> tuple[... method parse_response_streaming (line 1172) | def parse_response_streaming(self, response: list[int]) -> Iterator[Me... method to_openai_message (line 1205) | def to_openai_message(self, message: Message) -> dict: method create_conversation_prefix_with_tools (line 1277) | def create_conversation_prefix_with_tools( method _get_generation_suffix (line 1298) | def _get_generation_suffix(self, role: Role, ctx: RenderContext) -> li... method build_generation_prompt (line 1322) | def build_generation_prompt( method build_supervised_examples (line 1378) | def build_supervised_examples( method build_supervised_example (line 1400) | def build_supervised_example( function tokens_weights_from_strings_weights (line 1526) | def tokens_weights_from_strings_weights( function parse_response_for_stop_token (line 1540) | def parse_response_for_stop_token( class ImageProcessorProtocol (line 1567) | class ImageProcessorProtocol(Protocol): method get_number_of_image_patches (line 1571) | def get_number_of_image_patches( method get_resize_config (line 1576) | def get_resize_config(self, image_data: dict[str, Any]) -> dict[str, A... function image_to_chunk (line 1580) | def image_to_chunk( FILE: tinker_cookbook/renderers/deepseek_v3.py class _DeepSeekV3BaseRenderer (line 32) | class _DeepSeekV3BaseRenderer(Renderer): method __init__ (line 49) | def __init__( method has_extension_property (line 69) | def has_extension_property(self) -> bool: method render_message (line 80) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method _get_special_token (line 193) | def _get_special_token(self, name: str) -> int: method _bos_tokens (line 201) | def _bos_tokens(self) -> list[int]: method _end_message_token (line 205) | def _end_message_token(self) -> int: method get_stop_sequences (line 208) | def get_stop_sequences(self) -> list[int]: method _parse_deepseek_tool_calls (line 211) | def _parse_deepseek_tool_calls( method _parse_response_content (line 254) | def _parse_response_content( method parse_response (line 297) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method _parse_response_for_streaming (line 301) | def _parse_response_for_streaming(self, response: list[int]) -> tuple[... method to_openai_message (line 313) | def to_openai_message(self, message: Message) -> dict: method create_conversation_prefix_with_tools (line 360) | def create_conversation_prefix_with_tools( class DeepSeekV3ThinkingRenderer (line 404) | class DeepSeekV3ThinkingRenderer(_DeepSeekV3BaseRenderer): method render_message (line 420) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method build_generation_prompt (line 448) | def build_generation_prompt( method _normalize_response_tokens (line 467) | def _normalize_response_tokens(self, response: list[int]) -> list[int]: class DeepSeekV3DisableThinkingRenderer (line 483) | class DeepSeekV3DisableThinkingRenderer(_DeepSeekV3BaseRenderer): method has_extension_property (line 497) | def has_extension_property(self) -> bool: method render_message (line 501) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... FILE: tinker_cookbook/renderers/deepseek_v3_test.py function test_deepseek_parse_response_extracts_thinking (line 29) | def test_deepseek_parse_response_extracts_thinking(): function test_deepseek_parse_response_no_thinking_returns_string (line 53) | def test_deepseek_parse_response_no_thinking_returns_string(): function test_deepseek_parse_response_multiple_think_blocks (line 68) | def test_deepseek_parse_response_multiple_think_blocks(): function test_deepseek_thinking_preserved_with_tool_calls (line 94) | def test_deepseek_thinking_preserved_with_tool_calls(): function test_deepseek_post_tool_formatting (line 135) | def test_deepseek_post_tool_formatting(): function _is_message (line 197) | def _is_message(obj) -> bool: function _assert_deepseek_streaming_matches_batch (line 201) | def _assert_deepseek_streaming_matches_batch(renderer, response_str: str): class TestDeepSeekStreamingBatchEquivalence (line 220) | class TestDeepSeekStreamingBatchEquivalence: method thinking_renderer (line 224) | def thinking_renderer(self): method non_thinking_renderer (line 229) | def non_thinking_renderer(self): method test_simple_text (line 233) | def test_simple_text(self, thinking_renderer): method test_thinking_then_text (line 238) | def test_thinking_then_text(self, thinking_renderer): method test_multiple_think_blocks (line 244) | def test_multiple_think_blocks(self, thinking_renderer): method test_empty_response (line 250) | def test_empty_response(self, thinking_renderer): method test_non_thinking_renderer (line 253) | def test_non_thinking_renderer(self, non_thinking_renderer): method test_no_end_token (line 258) | def test_no_end_token(self, thinking_renderer): FILE: tinker_cookbook/renderers/gpt_oss.py function _json_type_to_typescript (line 35) | def _json_type_to_typescript(schema: dict) -> str: function _json_schema_to_typescript (line 68) | def _json_schema_to_typescript(schema: dict) -> str: function _schema_comments (line 85) | def _schema_comments(schema: dict) -> list[str]: function _format_parameters_block (line 103) | def _format_parameters_block(schema: dict) -> str: function _format_tool_definition (line 132) | def _format_tool_definition(tool: ToolSpec) -> str: class GptOssRenderer (line 144) | class GptOssRenderer(Renderer): method __init__ (line 193) | def __init__( method render_message (line 211) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method _render_tool_calls (line 285) | def _render_tool_calls(self, tool_calls: list[ToolCall]) -> str: method _render_tool_result_message (line 305) | def _render_tool_result_message(self, message: Message, ctx: RenderCon... method _get_system_message (line 351) | def _get_system_message(self) -> Message | None: method _bos_tokens (line 370) | def _bos_tokens(self) -> list[int]: method _warn_if_user_system_message (line 374) | def _warn_if_user_system_message(self, messages: list[Message]) -> None: method build_generation_prompt (line 385) | def build_generation_prompt( method build_supervised_example (line 395) | def build_supervised_example( method _return_token (line 408) | def _return_token(self) -> int: method _call_token (line 414) | def _call_token(self) -> int: method get_stop_sequences (line 419) | def get_stop_sequences(self) -> list[int]: method parse_response (line 424) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method to_openai_message (line 460) | def to_openai_message(self, message: Message) -> dict: method _parse_harmony_output (line 508) | def _parse_harmony_output( method _parse_harmony_messages (line 549) | def _parse_harmony_messages(self, content: str) -> list[dict[str, str ... method create_conversation_prefix_with_tools (line 613) | def create_conversation_prefix_with_tools( FILE: tinker_cookbook/renderers/gpt_oss_test.py function test_gptoss_parse_response_extracts_thinking (line 15) | def test_gptoss_parse_response_extracts_thinking(): function test_gptoss_parse_response_multiple_analysis (line 39) | def test_gptoss_parse_response_multiple_analysis(): function test_gptoss_parse_response_final_only (line 59) | def test_gptoss_parse_response_final_only(): function test_gptoss_parse_response_no_channels (line 76) | def test_gptoss_parse_response_no_channels(): function test_gptoss_parse_response_tool_call (line 92) | def test_gptoss_parse_response_tool_call(): function test_gptoss_parse_response_tool_call_with_analysis (line 110) | def test_gptoss_parse_response_tool_call_with_analysis(): function test_gptoss_parse_response_invalid_tool_call_json (line 135) | def test_gptoss_parse_response_invalid_tool_call_json(): function test_gptoss_parse_response_tool_call_recipient_before_channel (line 151) | def test_gptoss_parse_response_tool_call_recipient_before_channel(): function test_gptoss_parse_response_commentary_preamble (line 167) | def test_gptoss_parse_response_commentary_preamble(): FILE: tinker_cookbook/renderers/kimi_k2.py function _split_tool_calls_section (line 41) | def _split_tool_calls_section(content: str) -> tuple[str, str | None]: function _extract_tool_name (line 49) | def _extract_tool_name(tool_id: str) -> str: function _parse_tool_calls_section (line 58) | def _parse_tool_calls_section( class KimiK2Renderer (line 86) | class KimiK2Renderer(Renderer): method __init__ (line 105) | def __init__(self, tokenizer: Tokenizer, strip_thinking_from_history: ... method _ensure_system_message (line 109) | def _ensure_system_message(self, messages: list[Message]) -> list[Mess... method render_message (line 139) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method _encode_multipart_content (line 229) | def _encode_multipart_content(self, content: list[ContentPart]) -> lis... method build_generation_prompt (line 234) | def build_generation_prompt( method build_supervised_examples (line 274) | def build_supervised_examples( method build_supervised_example (line 321) | def build_supervised_example( method _end_message_token (line 410) | def _end_message_token(self) -> int: method get_stop_sequences (line 415) | def get_stop_sequences(self) -> list[int]: method parse_response (line 418) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method _parse_response_for_streaming (line 443) | def _parse_response_for_streaming(self, response: list[int]) -> tuple[... method to_openai_message (line 470) | def to_openai_message(self, message: Message) -> dict: method create_conversation_prefix_with_tools (line 517) | def create_conversation_prefix_with_tools( FILE: tinker_cookbook/renderers/kimi_k25.py class KimiK25Renderer (line 22) | class KimiK25Renderer(KimiK2Renderer): method __init__ (line 43) | def __init__( method _encode_multipart_content (line 54) | def _encode_multipart_content(self, content: list[ContentPart]) -> lis... method _image_prefix (line 81) | def _image_prefix(self) -> str: method _image_suffix (line 85) | def _image_suffix(self) -> str: method build_generation_prompt (line 88) | def build_generation_prompt( method _normalize_response_tokens (line 97) | def _normalize_response_tokens(self, response: list[int]) -> list[int]: method create_conversation_prefix_with_tools (line 107) | def create_conversation_prefix_with_tools( class KimiK25DisableThinkingRenderer (line 133) | class KimiK25DisableThinkingRenderer(KimiK25Renderer): method build_generation_prompt (line 145) | def build_generation_prompt( FILE: tinker_cookbook/renderers/kimi_k25_test.py function kimi_tokenizer (line 41) | def kimi_tokenizer(): function kimi_renderer (line 52) | def kimi_renderer(kimi_tokenizer): function kimi_renderer_disable_thinking (line 58) | def kimi_renderer_disable_thinking(kimi_tokenizer): function hf_generation_prompt_length (line 64) | def hf_generation_prompt_length(kimi_tokenizer): function get_hf_tokens (line 84) | def get_hf_tokens( function get_tool_spec (line 111) | def get_tool_spec() -> ToolSpec: function get_basic_conversation_for_generation (line 139) | def get_basic_conversation_for_generation() -> list[Message]: function get_basic_conversation_for_supervised (line 149) | def get_basic_conversation_for_supervised() -> list[Message]: function get_tool_call_conversation_for_generation (line 158) | def get_tool_call_conversation_for_generation() -> tuple[list[Message], ... function get_tool_call_conversation_for_supervised (line 189) | def get_tool_call_conversation_for_supervised() -> tuple[list[Message], ... function get_multi_tool_call_conversation_for_generation (line 227) | def get_multi_tool_call_conversation_for_generation() -> tuple[list[Mess... function get_multi_step_tool_conversation_for_generation (line 273) | def get_multi_step_tool_conversation_for_generation() -> tuple[list[Mess... function test_typescript_tool_declaration_basic (line 332) | def test_typescript_tool_declaration_basic(): function test_typescript_tool_declaration_with_enum (line 346) | def test_typescript_tool_declaration_with_enum(): function test_typescript_tool_declaration_description (line 355) | def test_typescript_tool_declaration_description(): function test_typescript_tool_declaration_empty (line 363) | def test_typescript_tool_declaration_empty(): function test_typescript_tool_declaration_multiple_tools (line 369) | def test_typescript_tool_declaration_multiple_tools(): function test_kimi_k25_generation_prompt_has_think_prefill (line 410) | def test_kimi_k25_generation_prompt_has_think_prefill(kimi_tokenizer, ki... function test_kimi_k25_disable_thinking_generation_prompt (line 419) | def test_kimi_k25_disable_thinking_generation_prompt( function test_kimi_k25_custom_prefill_overrides_default (line 430) | def test_kimi_k25_custom_prefill_overrides_default(kimi_tokenizer, kimi_... function test_kimi_k25_basic_conversation_matches_hf (line 446) | def test_kimi_k25_basic_conversation_matches_hf( function test_kimi_k25_tool_call_conversation_matches_hf (line 464) | def test_kimi_k25_tool_call_conversation_matches_hf( function test_kimi_k25_multi_tool_calls_matches_hf (line 494) | def test_kimi_k25_multi_tool_calls_matches_hf( function test_kimi_k25_multi_step_tool_calls_matches_hf (line 524) | def test_kimi_k25_multi_step_tool_calls_matches_hf( function test_kimi_k25_tool_declaration_is_typescript (line 559) | def test_kimi_k25_tool_declaration_is_typescript(kimi_renderer): function test_kimi_k25_tool_declaration_matches_hf (line 578) | def test_kimi_k25_tool_declaration_matches_hf( function test_kimi_k25_thinking_preserved_in_suffix (line 625) | def test_kimi_k25_thinking_preserved_in_suffix(build_mode: str, kimi_tok... function test_kimi_k25_thinking_stripped_in_history (line 662) | def test_kimi_k25_thinking_stripped_in_history(build_mode: str, kimi_tok... function test_kimi_k25_eot_parsing (line 708) | def test_kimi_k25_eot_parsing(kimi_tokenizer, kimi_renderer): function test_kimi_k25_parse_response_restores_prefilled_think_tag (line 729) | def test_kimi_k25_parse_response_restores_prefilled_think_tag(kimi_token... function test_kimi_k25_parse_response_streaming_restores_prefilled_think_tag (line 744) | def test_kimi_k25_parse_response_streaming_restores_prefilled_think_tag( function test_kimi_k25_image_content (line 775) | def test_kimi_k25_image_content(image_dimensions_and_expected_tokens: tu... FILE: tinker_cookbook/renderers/kimi_k2_5_tool_declaration_ts.py class _SchemaRegistry (line 19) | class _SchemaRegistry: method __init__ (line 22) | def __init__(self): method register_definitions (line 26) | def register_definitions(self, defs: dict[str, Any]): method resolve_ref (line 33) | def resolve_ref(self, ref: str) -> dict[str, Any]: function _format_description (line 47) | def _format_description(description: str, indent: str = "") -> str: class _BaseType (line 51) | class _BaseType: method __init__ (line 55) | def __init__( method to_typescript_style (line 64) | def to_typescript_style(self, indent: str = "") -> str: method format_docstring (line 67) | def format_docstring(self, indent: str) -> str: class _ParameterTypeScalar (line 80) | class _ParameterTypeScalar(_BaseType): method __init__ (line 83) | def __init__(self, type: str, extra_props: dict[str, Any] | None = None): method to_typescript_style (line 94) | def to_typescript_style(self, indent: str = "") -> str: class _ParameterTypeObject (line 101) | class _ParameterTypeObject(_BaseType): method __init__ (line 105) | def __init__(self, json_schema_object: dict[str, Any], registry: _Sche... method to_typescript_style (line 139) | def to_typescript_style(self, indent: str = "") -> str: class _ParameterTypeArray (line 177) | class _ParameterTypeArray(_BaseType): method __init__ (line 180) | def __init__(self, json_schema_object: dict[str, Any], registry: _Sche... method to_typescript_style (line 187) | def to_typescript_style(self, indent: str = "") -> str: class _ParameterTypeEnum (line 204) | class _ParameterTypeEnum(_BaseType): method __init__ (line 208) | def __init__(self, json_schema_object: dict[str, Any]): method to_typescript_style (line 237) | def to_typescript_style(self, indent: str = "") -> str: class _ParameterTypeAnyOf (line 241) | class _ParameterTypeAnyOf(_BaseType): method __init__ (line 244) | def __init__( method to_typescript_style (line 252) | def to_typescript_style(self, indent: str = "") -> str: class _ParameterTypeUnion (line 256) | class _ParameterTypeUnion(_BaseType): method __init__ (line 259) | def __init__(self, json_schema_object: dict[str, Any]): method to_typescript_style (line 273) | def to_typescript_style(self, indent: str = "") -> str: class _ParameterTypeRef (line 277) | class _ParameterTypeRef(_BaseType): method __init__ (line 281) | def __init__(self, json_schema_object: dict[str, Any], registry: _Sche... method to_typescript_style (line 293) | def to_typescript_style(self, indent: str = "") -> str: class _Parameter (line 309) | class _Parameter: method parse_extended (line 321) | def parse_extended(cls, attributes: dict[str, Any]) -> "_Parameter": method to_typescript_style (line 332) | def to_typescript_style(self, indent: str = "") -> str: function _parse_parameter_type (line 349) | def _parse_parameter_type( function _openai_function_to_typescript_style (line 384) | def _openai_function_to_typescript_style( function encode_tools_to_typescript_style (line 436) | def encode_tools_to_typescript_style( FILE: tinker_cookbook/renderers/kimi_k2_test.py function _is_message (line 23) | def _is_message(obj) -> TypeGuard[Message]: function _get_basic_4turn (line 33) | def _get_basic_4turn() -> list[Message]: function _get_tool_call_conversation (line 42) | def _get_tool_call_conversation() -> list[Message]: function test_kimi_streaming_simple_text (line 73) | def test_kimi_streaming_simple_text(): function test_kimi_streaming_with_thinking (line 93) | def test_kimi_streaming_with_thinking(): function test_kimi_streaming_matches_batch (line 116) | def test_kimi_streaming_matches_batch(): function test_kimi_streaming_content_index_increments (line 135) | def test_kimi_streaming_content_index_increments(): function test_kimi_streaming_multiple_think_blocks (line 152) | def test_kimi_streaming_multiple_think_blocks(): function test_kimi_streaming_empty_response (line 177) | def test_kimi_streaming_empty_response(): function test_kimi_streaming_no_unnecessary_buffering (line 191) | def test_kimi_streaming_no_unnecessary_buffering(): function test_kimi_streaming_with_emoji (line 205) | def test_kimi_streaming_with_emoji(): function _assert_streaming_matches_batch (line 245) | def _assert_streaming_matches_batch(renderer, response_str: str): class TestKimiK2StreamingBatchEquivalence (line 285) | class TestKimiK2StreamingBatchEquivalence: method renderer (line 289) | def renderer(self): method test_simple_text (line 293) | def test_simple_text(self, renderer): method test_thinking_then_text (line 296) | def test_thinking_then_text(self, renderer): method test_empty_thinking (line 303) | def test_empty_thinking(self, renderer): method test_long_thinking (line 306) | def test_long_thinking(self, renderer): method test_multiple_think_blocks (line 316) | def test_multiple_think_blocks(self, renderer): method test_empty_response (line 322) | def test_empty_response(self, renderer): method test_whitespace_only (line 325) | def test_whitespace_only(self, renderer): method test_special_characters (line 328) | def test_special_characters(self, renderer): method test_emoji (line 334) | def test_emoji(self, renderer): method test_code_blocks (line 339) | def test_code_blocks(self, renderer): method test_html_like_content (line 346) | def test_html_like_content(self, renderer): method test_tool_call_with_thinking (line 352) | def test_tool_call_with_thinking(self, renderer): method test_tool_call_without_thinking (line 363) | def test_tool_call_without_thinking(self, renderer): method test_text_then_tool_call (line 373) | def test_text_then_tool_call(self, renderer): method test_multiple_tool_calls (line 384) | def test_multiple_tool_calls(self, renderer): method test_multiline_thinking (line 398) | def test_multiline_thinking(self, renderer): method test_no_end_token (line 404) | def test_no_end_token(self, renderer): method test_content_index_ordering (line 422) | def test_content_index_ordering(self, renderer): function test_kimi_k2_thinking_stripped_when_no_suffix_messages (line 448) | def test_kimi_k2_thinking_stripped_when_no_suffix_messages(): function test_kimi_k2_thinking_preserved_in_suffix_after_last_non_tool_call (line 499) | def test_kimi_k2_thinking_preserved_in_suffix_after_last_non_tool_call(): function test_kimi_k2_thinking_preserved_when_no_non_tool_call_assistant (line 553) | def test_kimi_k2_thinking_preserved_when_no_non_tool_call_assistant(): function test_kimi_k2_build_supervised_examples_last_assistant_matches (line 592) | def test_kimi_k2_build_supervised_examples_last_assistant_matches(): function test_kimi_k2_build_supervised_examples_all_assistant_matches (line 610) | def test_kimi_k2_build_supervised_examples_all_assistant_matches(): function test_kimi_k2_build_supervised_examples_warns_on_non_assistant_mode (line 652) | def test_kimi_k2_build_supervised_examples_warns_on_non_assistant_mode(): function test_kimi_k2_build_supervised_examples_all_assistant_matches_with_tool_calls (line 683) | def test_kimi_k2_build_supervised_examples_all_assistant_matches_with_to... FILE: tinker_cookbook/renderers/kimi_k2_tool_declaration_test.py function test_tool_declaration_message_order (line 50) | def test_tool_declaration_message_order(tools, expected_order): function test_tool_declaration_no_duplicate_system (line 64) | def test_tool_declaration_no_duplicate_system(): function test_tool_json_keys_are_sorted (line 87) | def test_tool_json_keys_are_sorted(): function test_tool_declaration_matches_hf_tokens (line 135) | def test_tool_declaration_matches_hf_tokens(): function test_tool_declaration_string_matches_hf (line 192) | def test_tool_declaration_string_matches_hf(): function test_empty_tools_list (line 228) | def test_empty_tools_list(): function test_custom_system_prompt_with_tools (line 240) | def test_custom_system_prompt_with_tools(): function _find_first_diff_index (line 259) | def _find_first_diff_index(list1, list2): FILE: tinker_cookbook/renderers/llama3.py class Llama3Renderer (line 15) | class Llama3Renderer(Renderer): method has_extension_property (line 38) | def has_extension_property(self) -> bool: method render_message (line 42) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method _bos_tokens (line 58) | def _bos_tokens(self) -> list[int]: method _end_message_token (line 62) | def _end_message_token(self) -> int: method get_stop_sequences (line 66) | def get_stop_sequences(self) -> list[int]: method parse_response (line 69) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: FILE: tinker_cookbook/renderers/nemotron3.py function _render_extra_keys (line 49) | def _render_extra_keys(obj: Mapping[str, object], handled_keys: set[str]... function _format_nemotron3_tool_declaration (line 65) | def _format_nemotron3_tool_declaration(tool: ToolSpec) -> str: class Nemotron3Renderer (line 102) | class Nemotron3Renderer(Qwen3_5Renderer): method _normalize_messages (line 122) | def _normalize_messages(self, messages: list[Message]) -> list[Message]: method build_generation_prompt (line 133) | def build_generation_prompt(self, messages: list[Message], *args: obje... method build_supervised_example (line 136) | def build_supervised_example(self, messages: list[Message], *args: obj... method _assistant_header_suffix (line 139) | def _assistant_header_suffix(self, message: Message, ctx: RenderContex... method render_message (line 177) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method _format_thinking_text (line 191) | def _format_thinking_text(self, thinking: str) -> str: method _wrap_qwen_tool_response_chunks (line 195) | def _wrap_qwen_tool_response_chunks( method _format_tool_calls_chunks (line 209) | def _format_tool_calls_chunks(self, message: Message) -> list[ImagePar... method _postprocess_parsed_message (line 233) | def _postprocess_parsed_message(self, message: Message) -> None: method create_conversation_prefix_with_tools (line 256) | def create_conversation_prefix_with_tools( class Nemotron3DisableThinkingRenderer (line 317) | class Nemotron3DisableThinkingRenderer(Nemotron3Renderer): method _get_generation_suffix (line 325) | def _get_generation_suffix(self, role: Role, ctx: RenderContext) -> li... FILE: tinker_cookbook/renderers/nemotron3_test.py function nemotron_tokenizer (line 36) | def nemotron_tokenizer(): function nemotron_renderer (line 41) | def nemotron_renderer(nemotron_tokenizer): function nemotron_renderer_disable_thinking (line 46) | def nemotron_renderer_disable_thinking(nemotron_tokenizer): function _hf_generation_tokens (line 50) | def _hf_generation_tokens(tokenizer, hf_messages, tools=None, enable_thi... function _hf_supervised_tokens (line 62) | def _hf_supervised_tokens(tokenizer, hf_messages, tools=None, enable_thi... function get_basic_conversation_for_generation (line 79) | def get_basic_conversation_for_generation() -> list[Message]: function get_basic_conversation_for_supervised (line 89) | def get_basic_conversation_for_supervised() -> list[Message]: function get_thinking_conversation_for_supervised (line 98) | def get_thinking_conversation_for_supervised() -> list[Message]: function get_multiturn_thinking_conversation (line 113) | def get_multiturn_thinking_conversation() -> list[Message]: function get_tool_spec (line 136) | def get_tool_spec() -> ToolSpec: function get_rich_tool_spec (line 158) | def get_rich_tool_spec() -> ToolSpec: function get_tool_call_conversation_for_generation (line 189) | def get_tool_call_conversation_for_generation() -> tuple[list[Message], ... function get_historical_tool_call_with_nonempty_text_conversation (line 218) | def get_historical_tool_call_with_nonempty_text_conversation() -> tuple[ function get_tool_call_conversation_for_supervised (line 270) | def get_tool_call_conversation_for_supervised() -> tuple[list[Message], ... function test_tool_declaration_xml_format (line 311) | def test_tool_declaration_xml_format(): function test_tool_declaration_not_json_per_line (line 331) | def test_tool_declaration_not_json_per_line(): function test_tool_declaration_minimal_tool (line 339) | def test_tool_declaration_minimal_tool(): function test_tool_declaration_extra_schema_keys_match_hf (line 349) | def test_tool_declaration_extra_schema_keys_match_hf(nemotron_tokenizer,... function test_create_conversation_prefix_system_before_tools (line 377) | def test_create_conversation_prefix_system_before_tools(nemotron_renderer): function test_create_conversation_prefix_without_system_prompt (line 393) | def test_create_conversation_prefix_without_system_prompt(nemotron_rende... function test_create_conversation_prefix_xml_tool_format (line 402) | def test_create_conversation_prefix_xml_tool_format(nemotron_renderer): function test_create_conversation_prefix_no_tools (line 415) | def test_create_conversation_prefix_no_tools(nemotron_renderer): function test_generation_prompt_ends_with_think (line 428) | def test_generation_prompt_ends_with_think(nemotron_tokenizer, nemotron_... function test_disable_thinking_generation_prompt (line 437) | def test_disable_thinking_generation_prompt(nemotron_tokenizer, nemotron... function test_custom_prefill_overrides_think (line 446) | def test_custom_prefill_overrides_think(nemotron_tokenizer, nemotron_ren... function test_basic_conversation_generation_matches_hf (line 461) | def test_basic_conversation_generation_matches_hf(nemotron_tokenizer, ne... function test_disable_thinking_generation_matches_hf (line 474) | def test_disable_thinking_generation_matches_hf( function test_basic_conversation_supervised_matches_hf (line 501) | def test_basic_conversation_supervised_matches_hf(nemotron_tokenizer, ne... function test_thinking_conversation_supervised_matches_hf (line 514) | def test_thinking_conversation_supervised_matches_hf(nemotron_tokenizer,... function test_multiturn_thinking_supervised_matches_hf (line 527) | def test_multiturn_thinking_supervised_matches_hf(nemotron_tokenizer, ne... function test_think_block_added_to_all_assistant_history (line 544) | def test_think_block_added_to_all_assistant_history(nemotron_tokenizer, ... function test_tool_declaration_matches_hf (line 560) | def test_tool_declaration_matches_hf(build_mode: str, nemotron_tokenizer... function test_tool_call_conversation_generation_matches_hf (line 592) | def test_tool_call_conversation_generation_matches_hf(nemotron_tokenizer... function test_tool_call_conversation_supervised_matches_hf (line 614) | def test_tool_call_conversation_supervised_matches_hf(nemotron_tokenizer... function test_historical_tool_call_with_nonempty_text_generation_matches_hf (line 636) | def test_historical_tool_call_with_nonempty_text_generation_matches_hf( function test_historical_tool_call_with_nonempty_text_supervised_matches_hf (line 666) | def test_historical_tool_call_with_nonempty_text_supervised_matches_hf( function test_parse_response_plain_text (line 695) | def test_parse_response_plain_text(nemotron_tokenizer, nemotron_renderer): function test_parse_response_with_thinking (line 705) | def test_parse_response_with_thinking(nemotron_tokenizer, nemotron_rende... function test_parse_response_for_streaming_with_thinking (line 723) | def test_parse_response_for_streaming_with_thinking(nemotron_tokenizer, ... function test_parse_response_tool_call (line 752) | def test_parse_response_tool_call(nemotron_tokenizer, nemotron_renderer): function test_renderer_types (line 780) | def test_renderer_types(nemotron_renderer, nemotron_renderer_disable_thi... function test_renderer_is_not_qwen35 (line 785) | def test_renderer_is_not_qwen35(nemotron_renderer): FILE: tinker_cookbook/renderers/parsing_test.py function test_parse_content_blocks_no_special_tags (line 36) | def test_parse_content_blocks_no_special_tags(): function test_parse_content_blocks_single_think_block (line 42) | def test_parse_content_blocks_single_think_block(): function test_parse_content_blocks_multiple_think_blocks (line 56) | def test_parse_content_blocks_multiple_think_blocks(): function test_parse_content_blocks_empty_blocks_omitted (line 71) | def test_parse_content_blocks_empty_blocks_omitted(): function test_parse_content_blocks_whitespace_handling (line 83) | def test_parse_content_blocks_whitespace_handling(): function test_parse_content_blocks_tool_call_only (line 96) | def test_parse_content_blocks_tool_call_only(): function test_parse_content_blocks_interleaved (line 110) | def test_parse_content_blocks_interleaved(): function test_parse_content_blocks_invalid_tool_call (line 129) | def test_parse_content_blocks_invalid_tool_call(): function test_format_content_as_string_roundtrip (line 146) | def test_format_content_as_string_roundtrip(): function test_longest_matching_suffix_prefix (line 166) | def test_longest_matching_suffix_prefix(): function test_utf8_decoder_non_monotonic_decodability (line 200) | def test_utf8_decoder_non_monotonic_decodability(): function test_utf8_decoder_with_real_tokenizer_ascii (line 244) | def test_utf8_decoder_with_real_tokenizer_ascii(): function test_utf8_decoder_handles_replacement_chars (line 278) | def test_utf8_decoder_handles_replacement_chars(): function test_utf8_decoder_mixed_ascii_and_emoji (line 317) | def test_utf8_decoder_mixed_ascii_and_emoji(): function test_thinking_generation_parse_correspondence (line 364) | def test_thinking_generation_parse_correspondence(model_name, renderer_c... FILE: tinker_cookbook/renderers/qwen3.py function _merge_consecutive_text_parts (line 38) | def _merge_consecutive_text_parts( class Qwen3Renderer (line 60) | class Qwen3Renderer(Renderer): method __init__ (line 88) | def __init__(self, tokenizer: Tokenizer, strip_thinking_from_history: ... method has_extension_property (line 107) | def has_extension_property(self) -> bool: method _get_qwen_role_for_message (line 118) | def _get_qwen_role_for_message(self, message: Message) -> str: method _wrap_qwen_tool_response (line 128) | def _wrap_qwen_tool_response(self, content: str) -> str: method render_message (line 132) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method _end_message_token (line 191) | def _end_message_token(self) -> int: method get_stop_sequences (line 196) | def get_stop_sequences(self) -> list[int]: method parse_response (line 199) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method _parse_response_for_streaming (line 233) | def _parse_response_for_streaming(self, response: list[int]) -> tuple[... method to_openai_message (line 269) | def to_openai_message(self, message: Message) -> dict: method _to_openai_tool_arguments (line 321) | def _to_openai_tool_arguments(self, arguments: str) -> str | dict: method create_conversation_prefix_with_tools (line 329) | def create_conversation_prefix_with_tools( class Qwen3DisableThinkingRenderer (line 375) | class Qwen3DisableThinkingRenderer(Qwen3Renderer): method render_message (line 388) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... class Qwen3InstructRenderer (line 414) | class Qwen3InstructRenderer(Qwen3Renderer): method has_extension_property (line 424) | def has_extension_property(self) -> bool: class Qwen3VLRenderer (line 433) | class Qwen3VLRenderer(Qwen3Renderer): method __init__ (line 453) | def __init__( method _format_thinking_text (line 465) | def _format_thinking_text(self, thinking: str) -> str: method _assistant_header_suffix (line 469) | def _assistant_header_suffix(self, message: Message, ctx: RenderContex... method _preprocess_message_parts (line 473) | def _preprocess_message_parts( method _wrap_qwen_tool_response_chunks (line 512) | def _wrap_qwen_tool_response_chunks( method _format_tool_calls_chunks (line 522) | def _format_tool_calls_chunks(self, message: Message) -> list[ImagePar... method render_message (line 539) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... class Qwen3VLInstructRenderer (line 589) | class Qwen3VLInstructRenderer(Qwen3VLRenderer): FILE: tinker_cookbook/renderers/qwen3_5.py class Qwen3_5Renderer (line 45) | class Qwen3_5Renderer(Qwen3VLRenderer): method _get_generation_suffix (line 57) | def _get_generation_suffix(self, role: Role, ctx: RenderContext) -> li... method _assistant_header_suffix (line 67) | def _assistant_header_suffix(self, message: Message, ctx: RenderContex... method _format_thinking_text (line 81) | def _format_thinking_text(self, thinking: str) -> str: method _to_openai_tool_arguments (line 85) | def _to_openai_tool_arguments(self, arguments: str) -> str | dict: method _parse_qwen3_5_tool_call_xml (line 89) | def _parse_qwen3_5_tool_call_xml(self, raw_text: str) -> ToolCall | Un... method _normalize_response_tokens (line 135) | def _normalize_response_tokens(self, response: list[int]) -> list[int]: method _postprocess_parsed_message (line 154) | def _postprocess_parsed_message(self, message: Message) -> None: method parse_response (line 199) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method _parse_response_for_streaming (line 208) | def _parse_response_for_streaming(self, response: list[int]) -> tuple[... method _format_tool_call_xml (line 214) | def _format_tool_call_xml(self, tool_call: ToolCall) -> str: method _format_tool_calls_chunks (line 227) | def _format_tool_calls_chunks(self, message: Message) -> list[ImagePar... method create_conversation_prefix_with_tools (line 238) | def create_conversation_prefix_with_tools( class Qwen3_5DisableThinkingRenderer (line 291) | class Qwen3_5DisableThinkingRenderer(Qwen3_5Renderer): method _get_generation_suffix (line 300) | def _get_generation_suffix(self, role: Role, ctx: RenderContext) -> li... FILE: tinker_cookbook/renderers/qwen3_test.py function _is_message (line 28) | def _is_message(obj) -> TypeGuard[Message]: function test_qwen3_parse_response_extracts_thinking (line 38) | def test_qwen3_parse_response_extracts_thinking(): function test_qwen3_parse_response_multiple_think_blocks (line 64) | def test_qwen3_parse_response_multiple_think_blocks(): function test_qwen3_parse_response_no_thinking_returns_string (line 85) | def test_qwen3_parse_response_no_thinking_returns_string(): function test_qwen3_parse_response_with_tool_calls (line 101) | def test_qwen3_parse_response_with_tool_calls(): function test_qwen3_parse_response_tool_call_only (line 128) | def test_qwen3_parse_response_tool_call_only(): function _get_basic_2turn (line 156) | def _get_basic_2turn() -> list[Message]: function _get_basic_3turn (line 163) | def _get_basic_3turn() -> list[Message]: function _get_basic_4turn (line 171) | def _get_basic_4turn() -> list[Message]: function test_qwen3_disable_thinking_supervised (line 180) | def test_qwen3_disable_thinking_supervised(): function test_qwen3_disable_thinking_generation (line 213) | def test_qwen3_disable_thinking_generation(): function test_qwen3_disable_thinking_4turn (line 238) | def test_qwen3_disable_thinking_4turn(): function test_qwen3_streaming_simple_text (line 271) | def test_qwen3_streaming_simple_text(): function test_qwen3_streaming_with_thinking (line 291) | def test_qwen3_streaming_with_thinking(): function test_qwen3_streaming_matches_batch (line 314) | def test_qwen3_streaming_matches_batch(): function test_qwen3_streaming_content_index_increments (line 333) | def test_qwen3_streaming_content_index_increments(): function test_qwen3_streaming_empty_response (line 350) | def test_qwen3_streaming_empty_response(): function test_qwen3_streaming_multiple_think_blocks (line 364) | def test_qwen3_streaming_multiple_think_blocks(): function test_qwen3_streaming_no_unnecessary_buffering (line 389) | def test_qwen3_streaming_no_unnecessary_buffering(): function test_qwen3_streaming_with_emoji (line 403) | def test_qwen3_streaming_with_emoji(): function test_qwen3_streaming_supported_by_text_variants (line 427) | def test_qwen3_streaming_supported_by_text_variants(renderer_name): function _assert_streaming_matches_batch (line 446) | def _assert_streaming_matches_batch(renderer, response_str: str): class TestQwen3StreamingBatchEquivalence (line 486) | class TestQwen3StreamingBatchEquivalence: method renderer (line 490) | def renderer(self): method test_simple_text (line 494) | def test_simple_text(self, renderer): method test_thinking_then_text (line 497) | def test_thinking_then_text(self, renderer): method test_empty_thinking (line 504) | def test_empty_thinking(self, renderer): method test_long_thinking (line 507) | def test_long_thinking(self, renderer): method test_multiple_think_blocks (line 517) | def test_multiple_think_blocks(self, renderer): method test_empty_response (line 523) | def test_empty_response(self, renderer): method test_whitespace_only (line 526) | def test_whitespace_only(self, renderer): method test_special_characters (line 529) | def test_special_characters(self, renderer): method test_emoji (line 535) | def test_emoji(self, renderer): method test_code_blocks (line 540) | def test_code_blocks(self, renderer): method test_html_like_content (line 547) | def test_html_like_content(self, renderer): method test_tool_call_with_thinking (line 553) | def test_tool_call_with_thinking(self, renderer): method test_tool_call_without_thinking (line 561) | def test_tool_call_without_thinking(self, renderer): method test_multiline_thinking (line 568) | def test_multiline_thinking(self, renderer): method test_no_end_token (line 574) | def test_no_end_token(self, renderer): method test_content_index_ordering (line 591) | def test_content_index_ordering(self, renderer): function qwen3_5_tokenizer (line 622) | def qwen3_5_tokenizer(): function qwen3_5_renderer (line 627) | def qwen3_5_renderer(qwen3_5_tokenizer): function test_qwen3_5_parse_response_restores_prefilled_think_tag (line 631) | def test_qwen3_5_parse_response_restores_prefilled_think_tag(qwen3_5_tok... function test_qwen3_5_parse_response_streaming_restores_prefilled_think_tag (line 649) | def test_qwen3_5_parse_response_streaming_restores_prefilled_think_tag( function test_qwen3_5_streaming_matches_batch_with_prefilled_think (line 675) | def test_qwen3_5_streaming_matches_batch_with_prefilled_think(qwen3_5_to... function test_qwen3_5_normalize_noop_when_think_present (line 693) | def test_qwen3_5_normalize_noop_when_think_present(qwen3_5_tokenizer, qw... FILE: tinker_cookbook/renderers/qwen3_tool_declaration_test.py function _hf_tools_for_model (line 33) | def _hf_tools_for_model( function _hf_template_kwargs (line 42) | def _hf_template_kwargs(renderer_name: str) -> dict: function test_qwen3_tool_json_formatting (line 50) | def test_qwen3_tool_json_formatting(model_name: str, renderer_name: str): function test_qwen3_tool_declaration_matches_hf_tokens (line 112) | def test_qwen3_tool_declaration_matches_hf_tokens(model_name: str, rende... function test_qwen3_tool_declaration_string_matches_hf (line 163) | def test_qwen3_tool_declaration_string_matches_hf(model_name: str, rende... function test_qwen3_multiple_tools (line 208) | def test_qwen3_multiple_tools(model_name: str, renderer_name: str): function test_qwen3_empty_tools_list (line 253) | def test_qwen3_empty_tools_list(model_name: str, renderer_name: str): function test_qwen3_custom_system_prompt_with_tools (line 268) | def test_qwen3_custom_system_prompt_with_tools(model_name: str, renderer... function test_qwen3_preserves_insertion_order (line 313) | def test_qwen3_preserves_insertion_order(model_name: str, renderer_name:... FILE: tinker_cookbook/renderers/renderer_pickle_test.py function renderer_and_model (line 31) | def renderer_and_model(request: pytest.FixtureRequest) -> tuple[str, str]: class TestRendererPickle (line 35) | class TestRendererPickle: method test_pickle_roundtrip (line 36) | def test_pickle_roundtrip(self, renderer_and_model: tuple[str, str]) -... method test_pickle_metadata_set (line 49) | def test_pickle_metadata_set(self, renderer_and_model: tuple[str, str]... method test_pickle_without_metadata_raises (line 59) | def test_pickle_without_metadata_raises(self) -> None: method test_pickle_with_manual_metadata (line 70) | def test_pickle_with_manual_metadata(self) -> None: method test_pickle_without_metadata_vl_renderer (line 85) | def test_pickle_without_metadata_vl_renderer(self) -> None: method test_pickle_with_explicit_model_name (line 97) | def test_pickle_with_explicit_model_name(self) -> None: method test_pickle_custom_registered_renderer (line 109) | def test_pickle_custom_registered_renderer(self) -> None: class TestMessageCompleterPickle (line 130) | class TestMessageCompleterPickle: method test_tinker_message_completer_pickle_structure (line 131) | def test_tinker_message_completer_pickle_structure(self) -> None: FILE: tinker_cookbook/renderers/renderers_test.py function _rand_str (line 71) | def _rand_str(rng: random.Random, length: int = 8) -> str: function _rand_tool_call (line 75) | def _rand_tool_call(rng: random.Random) -> ToolCall: function generate_conversation (line 85) | def generate_conversation( function get_basic_3turn_conversation (line 147) | def get_basic_3turn_conversation() -> list[Message]: function get_basic_2turn_conversation (line 159) | def get_basic_2turn_conversation() -> list[Message]: function get_system_message_3turn_conversation (line 170) | def get_system_message_3turn_conversation() -> list[Message]: function get_system_message_2turn_conversation (line 186) | def get_system_message_2turn_conversation() -> list[Message]: function get_basic_4turn_conversation (line 201) | def get_basic_4turn_conversation() -> list[Message]: function get_tool_call_conversation (line 214) | def get_tool_call_conversation() -> list[Message]: function get_tool_call_gen_conversation (line 245) | def get_tool_call_gen_conversation() -> list[Message]: function get_4turn_thinking_conversation (line 253) | def get_4turn_thinking_conversation() -> list[Message]: function get_thinking_with_whitespace_conversation (line 278) | def get_thinking_with_whitespace_conversation() -> list[Message]: function get_multiturn_thinking_conversation (line 292) | def get_multiturn_thinking_conversation() -> list[Message]: function get_multiturn_tool_conversation (line 317) | def get_multiturn_tool_conversation() -> list[Message]: function get_multiturn_thinking_and_tool_conversation (line 368) | def get_multiturn_thinking_and_tool_conversation() -> list[Message]: function _conversation_has_tools (line 518) | def _conversation_has_tools(messages: list[Message]) -> bool: function _add_llama3_date_prefix (line 523) | def _add_llama3_date_prefix(messages: list[Message]) -> list[Message]: function test_generation_against_hf_chat_templates (line 538) | def test_generation_against_hf_chat_templates( function test_supervised_example_against_hf_chat_templates (line 632) | def test_supervised_example_against_hf_chat_templates( function test_tokenization_boundary_with_whitespace (line 707) | def test_tokenization_boundary_with_whitespace(model_name: str): function test_tool_call_supervised_rendering (line 760) | def test_tool_call_supervised_rendering(model_name: str): function test_strip_thinking_from_history_default (line 819) | def test_strip_thinking_from_history_default(model_name: str, renderer_c... function test_strip_thinking_from_history_false (line 851) | def test_strip_thinking_from_history_false(model_name: str, renderer_cla... function _split_by_weights (line 876) | def _split_by_weights(tokens: list[int], weights: list[float]) -> tuple[... function get_2turn_with_thinking (line 909) | def get_2turn_with_thinking() -> list[Message]: function test_supervised_generation_parse_consistency (line 975) | def test_supervised_generation_parse_consistency( function test_eot_parsing (line 1112) | def test_eot_parsing(model_name: str, renderer_name: str): function test_supervised_example_no_user_messages (line 1181) | def test_supervised_example_no_user_messages(model_name: str, renderer_n... function _verify_extension_property (line 1218) | def _verify_extension_property(renderer, messages: list[Message], tokeni... function test_extension_property_holds (line 1345) | def test_extension_property_holds( function test_extension_property_breaks_when_expected (line 1368) | def test_extension_property_breaks_when_expected(): function cleanup_custom_renderer (line 1386) | def cleanup_custom_renderer(): function test_register_and_get_custom_renderer (line 1395) | def test_register_and_get_custom_renderer(cleanup_custom_renderer): function cleanup_custom_tokenizer (line 1428) | def cleanup_custom_tokenizer(): function test_register_and_get_custom_tokenizer (line 1437) | def test_register_and_get_custom_tokenizer(cleanup_custom_tokenizer): FILE: tinker_cookbook/renderers/role_colon.py class RoleColonRenderer (line 15) | class RoleColonRenderer(Renderer): method has_extension_property (line 29) | def has_extension_property(self) -> bool: method render_message (line 33) | def render_message(self, message: Message, ctx: RenderContext) -> Rend... method get_stop_sequences (line 52) | def get_stop_sequences(self) -> list[str]: method parse_response (line 55) | def parse_response(self, response: list[int]) -> tuple[Message, bool]: method _bos_tokens (line 87) | def _bos_tokens(self) -> list[int]: method create_conversation_prefix_with_tools (line 94) | def create_conversation_prefix_with_tools( FILE: tinker_cookbook/renderers/testing_utils.py function extract_token_ids (line 11) | def extract_token_ids(result: Any) -> list[int]: function skip_if_deepseek_tokenizer_bug (line 35) | def skip_if_deepseek_tokenizer_bug(model_name: str) -> None: FILE: tinker_cookbook/renderers/tool_calling_test.py function test_qwen3_tool_response_rendering (line 34) | def test_qwen3_tool_response_rendering(model_name: str, renderer_name: s... function test_qwen3_parse_single_tool_call (line 82) | def test_qwen3_parse_single_tool_call(model_name: str, renderer_name: str): function test_qwen3_parse_multiple_tool_calls (line 123) | def test_qwen3_parse_multiple_tool_calls(model_name: str, renderer_name:... function test_kimi_k2_parse_tool_call (line 169) | def test_kimi_k2_parse_tool_call(): function test_deepseek_parse_tool_call (line 195) | def test_deepseek_parse_tool_call(): function test_qwen3_parse_invalid_tool_call_json (line 225) | def test_qwen3_parse_invalid_tool_call_json(): function test_qwen3_mixed_valid_invalid_tool_calls (line 249) | def test_qwen3_mixed_valid_invalid_tool_calls(): function test_deepseek_parse_invalid_tool_call_json (line 282) | def test_deepseek_parse_invalid_tool_call_json(): function test_kimi_k2_parse_invalid_tool_call_json (line 301) | def test_kimi_k2_parse_invalid_tool_call_json(): FILE: tinker_cookbook/rl/builder_pickle_test.py class TestProblemGroupBuilderPickle (line 17) | class TestProblemGroupBuilderPickle: method test_pickle_roundtrip (line 18) | def test_pickle_roundtrip(self) -> None: method test_pickle_with_convo_prefix (line 41) | def test_pickle_with_convo_prefix(self) -> None: class TestRolloutTask (line 58) | class TestRolloutTask: method test_pickle_roundtrip (line 59) | def test_pickle_roundtrip(self) -> None: class TestRolloutExecutorContextVar (line 90) | class TestRolloutExecutorContextVar: method test_default_is_none (line 91) | def test_default_is_none(self) -> None: method test_set_and_get (line 95) | def test_set_and_get(self) -> None: FILE: tinker_cookbook/rl/data_processing.py function compute_advantages (line 23) | def compute_advantages(trajectory_groups_P: list[TrajectoryGroup]) -> li... function _is_prefix (line 40) | def _is_prefix(seq1: FlatOb, seq2: FlatOb) -> bool: function _flat_ob_token_len (line 47) | def _flat_ob_token_len(flat_ob: FlatOb) -> int: function _flat_ob_to_model_input (line 57) | def _flat_ob_to_model_input(flat_ob: FlatOb) -> tinker.ModelInput: function _flatten_chunks (line 76) | def _flatten_chunks(chunks: list[tinker.ModelInputChunk]) -> FlatOb: function trajectory_to_data (line 86) | def trajectory_to_data(traj: Trajectory, traj_advantage: float) -> list[... function assemble_training_data (line 174) | def assemble_training_data( function remove_constant_reward_groups (line 196) | def remove_constant_reward_groups( FILE: tinker_cookbook/rl/message_env.py class MessageStepResult (line 24) | class MessageStepResult: class MessageEnv (line 35) | class MessageEnv(ABC): method initial_observation (line 39) | async def initial_observation(self) -> list[Message]: method step (line 44) | async def step(self, message: Message) -> MessageStepResult: class EnvFromMessageEnv (line 49) | class EnvFromMessageEnv(types.Env): method __init__ (line 56) | def __init__( method _render_in_thread (line 71) | async def _render_in_thread(self, messages: list[Message], **kwargs) -... method initial_observation (line 80) | async def initial_observation(self) -> tuple[tinker.ModelInput, StopCo... method step (line 85) | async def step(self, action: types.Action) -> types.StepResult: FILE: tinker_cookbook/rl/message_env_test.py function _make_model_input (line 24) | def _make_model_input(tokens: list[int]) -> tinker.ModelInput: class StubMessageEnv (line 28) | class StubMessageEnv(MessageEnv): method __init__ (line 31) | def __init__( method initial_observation (line 40) | async def initial_observation(self) -> list[Message]: method step (line 43) | async def step(self, message: Message) -> MessageStepResult: function _make_renderer (line 48) | def _make_renderer( class TestInitialObservation (line 74) | class TestInitialObservation: method test_returns_rendered_prompt_and_stop_condition (line 75) | def test_returns_rendered_prompt_and_stop_condition(self): method test_render_runs_in_thread (line 91) | def test_render_runs_in_thread(self): class TestStepParseFailure (line 109) | class TestStepParseFailure: method test_parse_failure_returns_failed_reward (line 110) | def test_parse_failure_returns_failed_reward(self): method test_parse_failure_no_terminate (line 133) | def test_parse_failure_no_terminate(self): class TestStepSuccess (line 153) | class TestStepSuccess: method test_delegates_to_message_env_and_renders (line 154) | def test_delegates_to_message_env_and_renders(self): method test_custom_stop_condition_from_message_env (line 190) | def test_custom_stop_condition_from_message_env(self): method test_none_stop_condition_falls_back_to_base (line 208) | def test_none_stop_condition_falls_back_to_base(self): class TestMaxTrajectoryTokens (line 227) | class TestMaxTrajectoryTokens: method test_context_overflow_terminates_episode (line 228) | def test_context_overflow_terminates_episode(self): method test_within_limit_continues (line 256) | def test_within_limit_continues(self): method test_no_limit_set (line 279) | def test_no_limit_set(self): class TestStepThreading (line 298) | class TestStepThreading: method test_step_renders_in_thread (line 299) | def test_step_renders_in_thread(self): class TestLogsPassthrough (line 320) | class TestLogsPassthrough: method test_logs_forwarded_on_success (line 323) | def test_logs_forwarded_on_success(self): method test_logs_forwarded_on_context_overflow (line 341) | def test_logs_forwarded_on_context_overflow(self): method test_no_logs_on_parse_error (line 365) | def test_no_logs_on_parse_error(self): method test_empty_logs_by_default (line 385) | def test_empty_logs_by_default(self): FILE: tinker_cookbook/rl/metric_util.py function _compute_by_group_metrics (line 30) | def _compute_by_group_metrics(trajectory_groups_P: list[TrajectoryGroup]... function compute_trajectory_metrics (line 49) | def compute_trajectory_metrics( function _compute_trajectory_metrics (line 73) | def _compute_trajectory_metrics(trajectory_groups_P: list[TrajectoryGrou... function dataset_to_env_group_builders (line 112) | def dataset_to_env_group_builders(dataset: RLDataset) -> list[EnvGroupBu... class RLTestSetEvaluator (line 119) | class RLTestSetEvaluator(SamplingClientEvaluator): method __init__ (line 120) | def __init__( method eval_token_completer (line 134) | async def eval_token_completer( method __call__ (line 169) | async def __call__( method _eval_with_executor (line 187) | async def _eval_with_executor( method _collect_eval_metrics (line 210) | def _collect_eval_metrics( FILE: tinker_cookbook/rl/metrics.py function compute_kl_sample_train (line 18) | def compute_kl_sample_train( function compute_post_kl (line 53) | async def compute_post_kl( function incorporate_kl_penalty (line 87) | async def incorporate_kl_penalty( function discounted_future_sum_vectorized (line 131) | def discounted_future_sum_vectorized(x: torch.Tensor, gamma: float) -> t... function compute_sampling_client_metrics (line 152) | def compute_sampling_client_metrics( FILE: tinker_cookbook/rl/multiturn_weight_assignment_test.py function _make_transition (line 26) | def _make_transition( function _get_mask (line 43) | def _get_mask(datum: tinker.Datum) -> list[float]: function _stub_tool (line 48) | async def _stub_tool() -> ToolResult: function _zero_reward_fn (line 53) | async def _zero_reward_fn(history) -> tuple[float, dict[str, float]]: class TestMultiTurnPrefixTrajectory (line 62) | class TestMultiTurnPrefixTrajectory: method _make_trajectory (line 70) | def _make_trajectory(self) -> Trajectory: method test_returns_single_datum (line 84) | def test_returns_single_datum(self): method test_mask_matches_expected (line 88) | def test_mask_matches_expected(self): method test_mask_sum_equals_action_token_count (line 97) | def test_mask_sum_equals_action_token_count(self): class TestSingleTurnTrajectory (line 109) | class TestSingleTurnTrajectory: method test_single_turn_mask (line 110) | def test_single_turn_mask(self): class TestPrefixBreak (line 128) | class TestPrefixBreak: method test_non_prefix_observation_produces_two_datums (line 129) | def test_non_prefix_observation_produces_two_datums(self): method test_each_datum_has_correct_mask (line 140) | def test_each_datum_has_correct_mask(self): function _make_stub_renderer (line 160) | def _make_stub_renderer(): function _make_stub_policy (line 229) | def _make_stub_policy(): function _run_e2e_rollout (line 245) | def _run_e2e_rollout(): class TestEndToEndToolUseRollout (line 262) | class TestEndToEndToolUseRollout: method test_trajectory_has_two_transitions (line 263) | def test_trajectory_has_two_transitions(self): method test_produces_single_datum (line 269) | def test_produces_single_datum(self): method test_mask_only_on_agent_tokens (line 273) | def test_mask_only_on_agent_tokens(self): FILE: tinker_cookbook/rl/play_w_env.py function get_async_input (line 30) | async def get_async_input(prompt: str, multiline: bool = False) -> str: class ManualPolicy (line 51) | class ManualPolicy(TokenCompleter): method __init__ (line 52) | def __init__(self, tokenizer: Tokenizer, multiline: bool = True, show_... method __call__ (line 58) | async def __call__(self, ob: tinker.ModelInput, stop: StopCondition) -... function print_trajectory_summary (line 73) | def print_trajectory_summary(trajectory: Trajectory): function play_env (line 89) | async def play_env( function main (line 103) | async def main(): FILE: tinker_cookbook/rl/preference_envs.py class PreferenceEnv (line 39) | class PreferenceEnv(Env): method __init__ (line 40) | def __init__( method stop_condition (line 49) | def stop_condition(self) -> StopCondition: method initial_observation (line 52) | async def initial_observation(self) -> tuple[Observation, StopCondition]: method step (line 55) | async def step(self, action: Action) -> StepResult: class TournamentPattern (line 75) | class TournamentPattern(StrEnum): function get_pairs_chunked (line 80) | def get_pairs_chunked(n: int, pattern: TournamentPattern, chunk_size: in... function get_pairs (line 94) | def get_pairs(n: int, pattern: TournamentPattern) -> list[tuple[int, int]]: class PairwisePreferenceGroupBuilder (line 104) | class PairwisePreferenceGroupBuilder(EnvGroupBuilder): method make_envs (line 114) | async def make_envs(self) -> Sequence[Env]: method _preprocess_message (line 119) | def _preprocess_message(self, message: renderers.Message) -> renderers... method get_response_message (line 125) | def get_response_message(self, trajectory: Trajectory) -> tuple[list[r... method comparison_reward_for_second_messages (line 131) | def comparison_reward_for_second_messages( method compute_group_rewards (line 142) | async def compute_group_rewards( method logging_tags (line 217) | def logging_tags(self) -> list[str]: class PairwisePreferenceDataset (line 221) | class PairwisePreferenceDataset(RLDataset): method __init__ (line 222) | def __init__( method get_batch (line 241) | def get_batch(self, index: int) -> list[EnvGroupBuilder]: method _labeled_comparison_to_env_group (line 248) | def _labeled_comparison_to_env_group(self, lc: LabeledComparison) -> E... method __len__ (line 258) | def __len__(self) -> int: class PairwisePreferenceRLDatasetBuilder (line 263) | class PairwisePreferenceRLDatasetBuilder(RLDatasetBuilder): method __call__ (line 273) | async def __call__(self) -> tuple[PairwisePreferenceDataset, None]: FILE: tinker_cookbook/rl/problem_env.py class ProblemEnv (line 25) | class ProblemEnv(Env): method __init__ (line 26) | def __init__( method stop_condition (line 37) | def stop_condition(self) -> StopCondition: method get_question (line 41) | def get_question(self) -> str: method check_answer (line 45) | def check_answer(self, sample_str: str) -> bool: method check_format (line 49) | def check_format(self, sample_str: str) -> bool: method get_reference_answer (line 53) | def get_reference_answer(self) -> str: method initial_observation (line 57) | async def initial_observation(self) -> tuple[Observation, StopCondition]: method step (line 63) | async def step(self, action: Action) -> StepResult: class ProblemGroupBuilder (line 101) | class ProblemGroupBuilder(EnvGroupBuilder): method make_envs (line 106) | async def make_envs(self) -> Sequence[Env]: method compute_group_rewards (line 109) | async def compute_group_rewards( method logging_tags (line 114) | def logging_tags(self) -> list[str]: FILE: tinker_cookbook/rl/rollout_error_resilience_test.py function _make_trajectory (line 39) | def _make_trajectory() -> Trajectory: class _FakePolicy (line 54) | class _FakePolicy(TokenCompleter): method __init__ (line 57) | def __init__(self, fail_indices: set[int] | None = None, error: BaseEx... method __call__ (line 62) | async def __call__(self, model_input, stop): class _FakeEnv (line 70) | class _FakeEnv(Env): method initial_observation (line 71) | async def initial_observation(self): method step (line 74) | async def step(self, action): class _FakeEnvGroupBuilder (line 83) | class _FakeEnvGroupBuilder(EnvGroupBuilder): method __init__ (line 84) | def __init__(self, n_envs: int = 4): method make_envs (line 88) | async def make_envs(self): class TestRolloutStrategyFromConfig (line 98) | class TestRolloutStrategyFromConfig: method test_false_returns_fail_fast (line 99) | def test_false_returns_fail_fast(self): method test_true_returns_retry_on_failure (line 104) | def test_true_returns_retry_on_failure(self): method test_strategy_instance_passed_through (line 110) | def test_strategy_instance_passed_through(self): method test_fail_fast_instance_passed_through (line 114) | def test_fail_fast_instance_passed_through(self): method test_invalid_value_raises (line 118) | def test_invalid_value_raises(self): class TestStrategyPickle (line 128) | class TestStrategyPickle: method test_fail_fast_pickleable (line 129) | def test_fail_fast_pickleable(self): method test_retry_on_failure_pickleable (line 134) | def test_retry_on_failure_pickleable(self): class TestRolloutError (line 146) | class TestRolloutError: method test_pickleable (line 147) | def test_pickleable(self): class TestTrajectoryGroupErrors (line 154) | class TestTrajectoryGroupErrors: method test_default_no_errors (line 155) | def test_default_no_errors(self): method test_with_errors (line 159) | def test_with_errors(self): method test_pickleable_with_errors (line 164) | def test_pickleable_with_errors(self): method test_get_total_rewards_unaffected (line 170) | def test_get_total_rewards_unaffected(self): class TestRolloutErrorCounter (line 188) | class TestRolloutErrorCounter: method test_ingest_successful_group (line 189) | def test_ingest_successful_group(self): method test_ingest_none_increments_groups_skipped (line 195) | def test_ingest_none_increments_groups_skipped(self): method test_ingest_group_with_errors (line 202) | def test_ingest_group_with_errors(self): method test_cumulative_across_ingests (line 216) | def test_cumulative_across_ingests(self): class TestFailFastStrategy (line 236) | class TestFailFastStrategy: method test_default_strategy_raises_on_error (line 237) | def test_default_strategy_raises_on_error(self): method test_success_returns_all_trajectories (line 244) | def test_success_returns_all_trajectories(self): method test_cancelled_error_propagates (line 251) | def test_cancelled_error_propagates(self): class TestRetryOnFailureStrategy (line 263) | class TestRetryOnFailureStrategy: method test_no_errors_returns_all_trajectories (line 264) | def test_no_errors_returns_all_trajectories(self): method test_retry_recovers_from_transient_failure (line 271) | def test_retry_recovers_from_transient_failure(self): method test_retry_creates_fresh_envs (line 282) | def test_retry_creates_fresh_envs(self): method test_all_fail_raises_after_retries (line 290) | def test_all_fail_raises_after_retries(self): method test_budget_exhausted_cancels_and_raises (line 298) | def test_budget_exhausted_cancels_and_raises(self): method test_zero_retries_raises_on_any_failure (line 308) | def test_zero_retries_raises_on_any_failure(self): method test_cancelled_error_not_swallowed (line 315) | def test_cancelled_error_not_swallowed(self): method test_keyboard_interrupt_not_swallowed (line 321) | def test_keyboard_interrupt_not_swallowed(self): method test_make_envs_failure_during_retry_propagates (line 327) | def test_make_envs_failure_during_retry_propagates(self): class TestImplErrorHandling (line 351) | class TestImplErrorHandling: method test_fail_fast_propagates_error (line 352) | def test_fail_fast_propagates_error(self): method test_retry_strategy_returns_none_on_group_error (line 373) | def test_retry_strategy_returns_none_on_group_error(self): method test_all_trajectories_failed_returns_none (line 392) | def test_all_trajectories_failed_returns_none(self): FILE: tinker_cookbook/rl/rollout_logging.py class RolloutSummaryExportConfig (line 17) | class RolloutSummaryExportConfig: class RolloutSummaryGroup (line 27) | class RolloutSummaryGroup: function _json_safe (line 35) | def _json_safe(value: Any) -> Any: function write_rollout_summaries_jsonl (line 51) | def write_rollout_summaries_jsonl( function rollout_summaries_jsonl_path (line 109) | def rollout_summaries_jsonl_path(log_path: str, file_prefix: str) -> Path: function write_rollout_summaries_jsonl_from_groups (line 114) | def write_rollout_summaries_jsonl_from_groups( FILE: tinker_cookbook/rl/rollout_logging_test.py function test_write_rollout_summaries_jsonl_handles_numpy_scalars (line 13) | def test_write_rollout_summaries_jsonl_handles_numpy_scalars(tmp_path: P... FILE: tinker_cookbook/rl/rollout_strategy.py class RolloutResult (line 32) | class RolloutResult: class RolloutStrategy (line 40) | class RolloutStrategy(ABC): method catches_group_errors (line 52) | def catches_group_errors(self) -> bool: method execute (line 58) | async def execute( class FailFast (line 73) | class FailFast(RolloutStrategy): method execute (line 80) | async def execute( class RetryOnFailure (line 95) | class RetryOnFailure(RolloutStrategy): method catches_group_errors (line 119) | def catches_group_errors(self) -> bool: method execute (line 122) | async def execute( function rollout_strategy_from_config (line 205) | def rollout_strategy_from_config( FILE: tinker_cookbook/rl/rollouts.py class RolloutErrorCounter (line 29) | class RolloutErrorCounter: method ingest (line 40) | def ingest(self, result: TrajectoryGroup | None) -> None: method get_metrics (line 48) | def get_metrics(self, prefix: str = "rollout_errors") -> dict[str, flo... function _log_transition_logs (line 59) | def _log_transition_logs(logs: dict[str, Any]) -> None: function _log_transition_metrics (line 72) | def _log_transition_metrics(metrics: dict[str, Any] | None) -> None: function _log_single_trajectory_details (line 89) | def _log_single_trajectory_details(traj: Trajectory, final_reward: float... function do_single_rollout (line 116) | async def do_single_rollout(policy: TokenCompleter, env: Env) -> Traject... function do_group_rollout (line 144) | async def do_group_rollout( function set_rollout_executor (line 190) | def set_rollout_executor(executor: Executor | None) -> None: function get_rollout_executor (line 205) | def get_rollout_executor() -> Executor | None: class _RolloutTask (line 211) | class _RolloutTask: function _run_rollout_sync (line 223) | def _run_rollout_sync(task: _RolloutTask) -> TrajectoryGroup | None: function do_group_rollout_and_filter_constant_reward (line 243) | async def do_group_rollout_and_filter_constant_reward( function _do_group_rollout_and_filter_constant_reward_impl (line 291) | async def _do_group_rollout_and_filter_constant_reward_impl( FILE: tinker_cookbook/rl/shutdown_test.py class TestAsyncCounter (line 16) | class TestAsyncCounter: method test_decrement_and_get (line 17) | def test_decrement_and_get(self): method test_concurrent_decrements (line 26) | def test_concurrent_decrements(self): class TestShutdownCascade (line 38) | class TestShutdownCascade: method test_dataloader_enqueues_shutdown_sentinels (line 39) | def test_dataloader_enqueues_shutdown_sentinels(self): method test_last_worker_signals_training_loop (line 57) | def test_last_worker_signals_training_loop(self): method test_full_cascade_no_hang (line 75) | def test_full_cascade_no_hang(self): method test_cascade_with_early_shutdown (line 155) | def test_cascade_with_early_shutdown(self): method test_requeue_skipped_during_shutdown (line 221) | def test_requeue_skipped_during_shutdown(self): method test_none_items_pass_through_during_shutdown (line 252) | def test_none_items_pass_through_during_shutdown(self): FILE: tinker_cookbook/rl/train.py class KLReferenceConfig (line 74) | class KLReferenceConfig: function gather_with_progress (line 84) | async def gather_with_progress( function _get_evaluator_name (line 110) | def _get_evaluator_name(evaluator: SamplingClientEvaluator) -> str: function _sanitize_filename_component (line 118) | def _sanitize_filename_component(text: str) -> str: function _maybe_export_rollout_summary_jsonl (line 124) | def _maybe_export_rollout_summary_jsonl( function _get_logtree_scope (line 158) | def _get_logtree_scope( function _select_representative_inds (line 183) | def _select_representative_inds(scores: list[float], num_inds: int) -> l... function print_group (line 191) | def print_group(traj_group: TrajectoryGroup, tokenizer: Tokenizer): function _remove_mask (line 245) | def _remove_mask(datum: tinker.Datum) -> tinker.Datum: function _training_logprobs_from_fwd_bwd (line 252) | def _training_logprobs_from_fwd_bwd( function train_step (line 259) | async def train_step( class StreamMinibatchConfig (line 314) | class StreamMinibatchConfig: class AsyncConfig (line 332) | class AsyncConfig: class Config (line 344) | class Config: function run_single_evaluation (line 443) | async def run_single_evaluation( function run_evaluations_parallel (line 479) | async def run_evaluations_parallel( function do_sync_training_with_stream_minibatch (line 510) | async def do_sync_training_with_stream_minibatch( class WrappedTrajectoryGroup (line 642) | class WrappedTrajectoryGroup: class _Shutdown (line 659) | class _Shutdown: class _AsyncCounter (line 669) | class _AsyncCounter: method __init__ (line 672) | def __init__(self, start: int): method decrement_and_get (line 676) | async def decrement_and_get(self) -> int: function do_async_training (line 683) | async def do_async_training( function save_checkpoint_and_get_sampling_client (line 1003) | async def save_checkpoint_and_get_sampling_client( function prepare_minibatch (line 1028) | async def prepare_minibatch( function compute_full_batch_metrics_and_get_sampling_client (line 1067) | async def compute_full_batch_metrics_and_get_sampling_client( function do_train_step_streaming_and_get_sampling_client (line 1107) | async def do_train_step_streaming_and_get_sampling_client( function do_train_step_and_get_sampling_client (line 1242) | async def do_train_step_and_get_sampling_client( function do_sync_training (line 1292) | async def do_sync_training( function main (line 1418) | async def main( FILE: tinker_cookbook/rl/types.py class StepResult (line 24) | class StepResult: class Transition (line 42) | class Transition: class Env (line 59) | class Env(ABC): method initial_observation (line 66) | async def initial_observation(self) -> tuple[Observation, StopCondition]: method step (line 70) | async def step(self, action: Action) -> StepResult: class Trajectory (line 75) | class Trajectory: class RolloutError (line 86) | class RolloutError: class EnvGroupBuilder (line 100) | class EnvGroupBuilder(ABC): method make_envs (line 127) | async def make_envs(self) -> Sequence[Env]: method compute_group_rewards (line 130) | async def compute_group_rewards( method cleanup (line 142) | async def cleanup(self) -> None: method logging_tags (line 155) | def logging_tags(self) -> list[str]: class TrajectoryGroup (line 168) | class TrajectoryGroup: method get_total_rewards (line 182) | def get_total_rewards(self) -> list[float]: class RLDataset (line 194) | class RLDataset(ABC): method get_batch (line 201) | def get_batch(self, index: int) -> Sequence[EnvGroupBuilder]: method __len__ (line 205) | def __len__(self) -> int: class RLDatasetBuilder (line 210) | class RLDatasetBuilder: method __call__ (line 216) | async def __call__(self) -> tuple[RLDataset, RLDataset | None]: FILE: tinker_cookbook/sandbox/__init__.py class SandboxBackend (line 19) | class SandboxBackend(StrEnum): FILE: tinker_cookbook/sandbox/modal_sandbox.py function _read_stream_capped (line 38) | async def _read_stream_capped(stream: object, max_bytes: int) -> str: function _is_sandbox_terminated (line 64) | def _is_sandbox_terminated(e: BaseException) -> bool: class ModalSandbox (line 73) | class ModalSandbox: method __init__ (line 87) | def __init__( method create (line 102) | async def create( method sandbox_id (line 122) | def sandbox_id(self) -> str: method send_heartbeat (line 125) | async def send_heartbeat(self) -> None: method run_command (line 128) | async def run_command( method read_file (line 152) | async def read_file( method write_file (line 162) | async def write_file( method cleanup (line 206) | async def cleanup(self) -> None: class ModalSandboxPool (line 213) | class ModalSandboxPool: method __init__ (line 225) | def __init__( method _create (line 246) | async def _create(self) -> ModalSandbox: method _maintain_pool (line 251) | async def _maintain_pool(self) -> None: method _maintain_pool_step (line 260) | async def _maintain_pool_step(self) -> None: method run_in_workdir (line 281) | async def run_in_workdir( method terminate (line 330) | async def terminate(self) -> None: FILE: tinker_cookbook/sandbox/sandbox_interface.py class SandboxResult (line 11) | class SandboxResult: class SandboxTerminatedError (line 20) | class SandboxTerminatedError(SandboxError): class SandboxInterface (line 27) | class SandboxInterface(Protocol): method sandbox_id (line 35) | def sandbox_id(self) -> str: method send_heartbeat (line 39) | async def send_heartbeat(self) -> None: method run_command (line 46) | async def run_command( method read_file (line 67) | async def read_file( method write_file (line 79) | async def write_file( method cleanup (line 92) | async def cleanup(self) -> None: class SandboxResource (line 97) | class SandboxResource: method __init__ (line 100) | def __init__(self, sandbox: SandboxInterface): method send_heartbeat (line 103) | async def send_heartbeat(self) -> None: method cleanup (line 106) | async def cleanup(self) -> None: FILE: tinker_cookbook/sandbox/sandboxfusion.py class SandboxFusionClient (line 23) | class SandboxFusionClient: method __init__ (line 37) | def __init__( method _get_session (line 47) | async def _get_session(self) -> aiohttp.ClientSession: method run (line 67) | async def run( method close (line 117) | async def close(self) -> None: FILE: tinker_cookbook/scripts/merge_tinker_adapter_to_hf_model.py function main (line 18) | def main(): FILE: tinker_cookbook/scripts/test_tool_calling_e2e.py function print_result (line 87) | def print_result( function test_model (line 110) | async def test_model( function main (line 162) | async def main(): FILE: tinker_cookbook/supervised/common.py function compute_mean_nll (line 11) | def compute_mean_nll( function create_rightshifted_model_input_and_leftshifted_targets (line 31) | def create_rightshifted_model_input_and_leftshifted_targets( function datum_from_model_input_weights (line 68) | def datum_from_model_input_weights( FILE: tinker_cookbook/supervised/data.py function conversation_to_datum (line 20) | def conversation_to_datum( function _one_of (line 33) | def _one_of(a: Any, b: Any) -> bool: class SupervisedDatasetFromHFDataset (line 37) | class SupervisedDatasetFromHFDataset(SupervisedDataset): method __init__ (line 38) | def __init__( method get_batch (line 54) | def get_batch(self, index: int) -> list[tinker.Datum]: method set_epoch (line 64) | def set_epoch(self, seed: int = 0): method __len__ (line 67) | def __len__(self) -> int: class StreamingSupervisedDatasetFromHFDataset (line 71) | class StreamingSupervisedDatasetFromHFDataset(SupervisedDataset): method __init__ (line 72) | def __init__( method get_batch (line 93) | def get_batch(self, index: int) -> list[tinker.Datum]: method set_epoch (line 117) | def set_epoch(self, seed: int = 0): method __len__ (line 122) | def __len__(self) -> int: class FromConversationFileBuilder (line 127) | class FromConversationFileBuilder(ChatDatasetBuilder): method __call__ (line 132) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: FILE: tinker_cookbook/supervised/nll_evaluator.py class NLLEvaluator (line 10) | class NLLEvaluator(TrainingClientEvaluator): method __init__ (line 11) | def __init__(self, data: list[tinker.Datum], name: str = "test"): method __call__ (line 15) | async def __call__(self, training_client: tinker.TrainingClient) -> di... method from_dataset (line 25) | def from_dataset(cls, dataset: SupervisedDataset, name: str = "test") ... FILE: tinker_cookbook/supervised/resume_test.py class StopTrainingException (line 18) | class StopTrainingException(Exception): function create_mock_logger_with_jsonl (line 22) | def create_mock_logger_with_jsonl( function checkpoint_resume (line 53) | def checkpoint_resume(): FILE: tinker_cookbook/supervised/train.py class Config (line 39) | class Config: class SubmittedBatch (line 86) | class SubmittedBatch: function run_evals (line 99) | async def run_evals( function main (line 152) | async def main(config: Config): FILE: tinker_cookbook/supervised/types.py class SupervisedDataset (line 16) | class SupervisedDataset: method get_batch (line 21) | def get_batch(self, index: int) -> list[tinker.Datum]: method __len__ (line 24) | def __len__(self) -> int: method set_epoch (line 27) | def set_epoch(self, seed: int = 0): class SupervisedDatasetBuilder (line 40) | class SupervisedDatasetBuilder: method __call__ (line 45) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: class ChatDatasetBuilderCommonConfig (line 50) | class ChatDatasetBuilderCommonConfig: class ChatDatasetBuilder (line 65) | class ChatDatasetBuilder(SupervisedDatasetBuilder): method __call__ (line 73) | def __call__(self) -> tuple[SupervisedDataset, SupervisedDataset | None]: method tokenizer (line 80) | def tokenizer(self) -> Tokenizer: method renderer (line 84) | def renderer(self) -> renderers.Renderer: FILE: tinker_cookbook/supervised/viz_sft_dataset.py class Config (line 19) | class Config: function run (line 27) | def run(cfg: Config): FILE: tinker_cookbook/third_party/litellm/provider.py class _SamplingResult (line 63) | class _SamplingResult: function _prepare_messages_with_tools (line 74) | def _prepare_messages_with_tools( function _sample_chat_completion (line 101) | async def _sample_chat_completion( function _sampling_result_to_chat_completion_dict (line 154) | def _sampling_result_to_chat_completion_dict(result: _SamplingResult) ->... function _extract_sampling_params (line 207) | def _extract_sampling_params(optional_params: dict[str, Any]) -> dict[st... function _build_model_response (line 225) | def _build_model_response( function _map_tinker_error (line 262) | def _map_tinker_error(exc: Exception) -> Exception: class _ClientBundle (line 306) | class _ClientBundle: class TinkerLiteLLMProvider (line 315) | class TinkerLiteLLMProvider(CustomLLM): method __init__ (line 318) | def __init__( method _get_service_client (line 326) | def _get_service_client(self) -> tinker.ServiceClient: method _get_or_create_client (line 331) | def _get_or_create_client(self, base_model: str) -> _ClientBundle: method set_client (line 348) | def set_client( method acompletion (line 372) | async def acompletion( method completion (line 415) | def completion( function register_litellm_provider (line 477) | def register_litellm_provider( FILE: tinker_cookbook/third_party/litellm/provider_test.py class FakeSampledSequence (line 26) | class FakeSampledSequence: class FakeSampleResponse (line 33) | class FakeSampleResponse: function _make_sampling_result (line 37) | def _make_sampling_result( class TestExtractSamplingParams (line 63) | class TestExtractSamplingParams: method test_all_params (line 64) | def test_all_params(self) -> None: method test_max_completion_tokens (line 83) | def test_max_completion_tokens(self) -> None: method test_empty (line 87) | def test_empty(self) -> None: class TestPrepareMessagesWithTools (line 96) | class TestPrepareMessagesWithTools: method test_extracts_system_message (line 97) | def test_extracts_system_message(self) -> None: method test_no_system_message (line 122) | def test_no_system_message(self) -> None: class TestSamplingResultToDict (line 147) | class TestSamplingResultToDict: method test_basic_response (line 148) | def test_basic_response(self) -> None: method test_parse_failure_gives_length_finish (line 161) | def test_parse_failure_gives_length_finish(self) -> None: method test_tool_calls_in_response (line 166) | def test_tool_calls_in_response(self) -> None: method test_tool_call_without_id_gets_generated (line 180) | def test_tool_call_without_id_gets_generated(self) -> None: method test_list_content_formatted_as_string (line 189) | def test_list_content_formatted_as_string(self) -> None: class TestSampleChatCompletion (line 204) | class TestSampleChatCompletion: method test_basic_flow (line 206) | async def test_basic_flow(self) -> None: method test_with_tools (line 241) | async def test_with_tools(self) -> None: method test_custom_stop_sequences (line 277) | async def test_custom_stop_sequences(self) -> None: class TestTinkerLiteLLMProvider (line 310) | class TestTinkerLiteLLMProvider: method test_register_adds_to_provider_map (line 311) | def test_register_adds_to_provider_map(self) -> None: method test_set_client_creates_bundle (line 344) | def test_set_client_creates_bundle(self) -> None: method test_set_client_updates_existing_bundle (line 365) | def test_set_client_updates_existing_bundle(self) -> None: method test_acompletion_requires_base_model (line 387) | async def test_acompletion_requires_base_model(self) -> None: method test_acompletion_basic (line 409) | async def test_acompletion_basic(self) -> None: FILE: tinker_cookbook/third_party/openai_compat.py function openai_messages_to_tinker (line 20) | def openai_messages_to_tinker(messages: list[dict[str, Any]]) -> list[Me... function openai_tools_to_tinker (line 38) | def openai_tools_to_tinker(tools: list[dict[str, Any]]) -> list[ToolSpec]: FILE: tinker_cookbook/third_party/openai_compat_test.py class TestOpenAIMessagesToTinker (line 16) | class TestOpenAIMessagesToTinker: method test_basic_messages (line 17) | def test_basic_messages(self) -> None: method test_message_with_tool_call_id (line 28) | def test_message_with_tool_call_id(self) -> None: method test_message_with_name (line 35) | def test_message_with_name(self) -> None: method test_message_with_tool_calls (line 40) | def test_message_with_tool_calls(self) -> None: method test_none_content_becomes_empty_string (line 61) | def test_none_content_becomes_empty_string(self) -> None: class TestOpenAIToolsToTinker (line 72) | class TestOpenAIToolsToTinker: method test_basic_tool (line 73) | def test_basic_tool(self) -> None: method test_skips_non_function_tools (line 93) | def test_skips_non_function_tools(self) -> None: method test_missing_description (line 105) | def test_missing_description(self) -> None: method test_empty_tools (line 115) | def test_empty_tools(self) -> None: FILE: tinker_cookbook/tokenizer_utils.py function register_tokenizer (line 28) | def register_tokenizer( function get_registered_tokenizer_names (line 47) | def get_registered_tokenizer_names() -> list[str]: function is_tokenizer_registered (line 52) | def is_tokenizer_registered(name: str) -> bool: function unregister_tokenizer (line 57) | def unregister_tokenizer(name: str) -> bool: function get_tokenizer (line 72) | def get_tokenizer(model_name: str) -> Tokenizer: function _get_hf_tokenizer (line 85) | def _get_hf_tokenizer(model_name: str) -> Tokenizer: FILE: tinker_cookbook/tokenizer_utils_test.py function _clear_cache (line 9) | def _clear_cache() -> None: function test_kimi_k2_thinking_trusts_remote_code_without_env (line 15) | def test_kimi_k2_thinking_trusts_remote_code_without_env( function test_kimi_k25_trusts_remote_code_without_env (line 30) | def test_kimi_k25_trusts_remote_code_without_env( function test_no_trust_remote_code_by_default (line 45) | def test_no_trust_remote_code_by_default( function test_env_var_enables_trust_remote_code (line 59) | def test_env_var_enables_trust_remote_code( function test_env_var_falsy_values_do_not_enable (line 74) | def test_env_var_falsy_values_do_not_enable( FILE: tinker_cookbook/tool_use/agent_tool_message_env.py class AgentToolMessageEnv (line 24) | class AgentToolMessageEnv(MessageEnv): method __post_init__ (line 37) | def __post_init__(self) -> None: method initial_observation (line 40) | async def initial_observation(self) -> list[Message]: method _handle_tool_calls (line 45) | async def _handle_tool_calls(self, tool_calls: list[ToolCall]) -> list... method step (line 69) | async def step(self, message: Message) -> MessageStepResult: function build_agent_tool_env (line 126) | def build_agent_tool_env( FILE: tinker_cookbook/tool_use/agent_tool_message_env_test.py function _noop_reward (line 16) | async def _noop_reward(history: list[Message]) -> tuple[float, dict[str,... class StubTool (line 20) | class StubTool: method __init__ (line 23) | def __init__(self, name: str, response: str, should_stop: bool = False): method name (line 29) | def name(self) -> str: method description (line 33) | def description(self) -> str: method parameters_schema (line 37) | def parameters_schema(self) -> dict[str, Any]: method run (line 40) | async def run(self, input: ToolInput) -> ToolResult: method to_spec (line 48) | def to_spec(self) -> ToolSpec: function _make_tool_call (line 56) | def _make_tool_call(name: str, arguments: str = "{}", call_id: str = "ca... class TestStepLogs (line 65) | class TestStepLogs: method test_logs_assistant_content (line 68) | def test_logs_assistant_content(self): method test_logs_empty_when_no_content (line 82) | def test_logs_empty_when_no_content(self): method test_logs_multimodal_content (line 96) | def test_logs_multimodal_content(self): method test_logs_tool_calls_and_results (line 117) | def test_logs_tool_calls_and_results(self): method test_logs_multiple_tool_calls (line 137) | def test_logs_multiple_tool_calls(self): method test_logs_no_tool_calls (line 160) | def test_logs_no_tool_calls(self): FILE: tinker_cookbook/tool_use/tools.py function simple_tool_result (line 25) | def simple_tool_result( function error_tool_result (line 71) | def error_tool_result( function _extract_annotated_info (line 115) | def _extract_annotated_info(annotation: Any) -> tuple[Any, FieldInfo | N... class FunctionTool (line 140) | class FunctionTool: method __init__ (line 147) | def __init__(self, fn: Callable[..., Any]): method name (line 155) | def name(self) -> str: method description (line 159) | def description(self) -> str: method _build_params_model (line 162) | def _build_params_model(self) -> type[BaseModel]: method parameters_schema (line 190) | def parameters_schema(self) -> dict[str, Any]: method to_spec (line 194) | def to_spec(self) -> ToolSpec: method run (line 202) | async def run(self, input: ToolInput) -> ToolResult: method __get__ (line 249) | def __get__(self, obj: Any, objtype: type | None = None) -> FunctionTool: function tool (line 263) | def tool(fn: Callable[..., Any]) -> FunctionTool: function handle_tool_call (line 294) | async def handle_tool_call( FILE: tinker_cookbook/tool_use/types.py class ToolInput (line 12) | class ToolInput: class ToolResult (line 20) | class ToolResult: class Tool (line 30) | class Tool(Protocol): method name (line 34) | def name(self) -> str: method description (line 39) | def description(self) -> str: method parameters_schema (line 44) | def parameters_schema(self) -> dict[str, Any]: method run (line 48) | async def run(self, input: ToolInput) -> ToolResult: method to_spec (line 52) | def to_spec(self) -> ToolSpec: FILE: tinker_cookbook/utils/code_state.py function code_state (line 11) | def code_state(modules: Sequence[str | ModuleType] = ("tinker_cookbook",... FILE: tinker_cookbook/utils/deprecation.py function _parse_version (line 47) | def _parse_version(v: str) -> tuple[int, ...]: function _current_version (line 68) | def _current_version() -> tuple[int, ...]: function _check_past_removal (line 77) | def _check_past_removal(removal_version: str | None) -> bool: function warn_deprecated (line 87) | def warn_deprecated( function deprecated (line 129) | def deprecated(__func: F) -> F: ... function deprecated (line 133) | def deprecated( function deprecated (line 140) | def deprecated( function make_deprecated_module_getattr (line 198) | def make_deprecated_module_getattr( FILE: tinker_cookbook/utils/deprecation_test.py class TestParseVersion (line 22) | class TestParseVersion: method test_simple (line 23) | def test_simple(self): method test_dev_suffix (line 26) | def test_dev_suffix(self): method test_prerelease (line 29) | def test_prerelease(self): method test_single_number (line 32) | def test_single_number(self): method test_empty_fallback (line 35) | def test_empty_fallback(self): class TestWarnDeprecated (line 44) | class TestWarnDeprecated: method test_basic_warning (line 45) | def test_basic_warning(self): method test_warning_with_removal_version (line 53) | def test_warning_with_removal_version(self): method test_warning_with_message (line 59) | def test_warning_with_message(self): method test_full_warning_message (line 65) | def test_full_warning_message(self): method test_past_removal_version_raises (line 78) | def test_past_removal_version_raises(self): method test_no_removal_version_never_raises (line 84) | def test_no_removal_version_never_raises(self): class TestDeprecatedDecorator (line 97) | class TestDeprecatedDecorator: method test_decorate_function_no_args (line 98) | def test_decorate_function_no_args(self): method test_decorate_function_with_message (line 112) | def test_decorate_function_with_message(self): method test_decorate_function_empty_parens (line 125) | def test_decorate_function_empty_parens(self): method test_preserves_function_metadata (line 137) | def test_preserves_function_metadata(self): method test_decorate_class (line 146) | def test_decorate_class(self): method test_class_preserves_isinstance (line 161) | def test_class_preserves_isinstance(self): method test_function_with_args_and_kwargs (line 172) | def test_function_with_args_and_kwargs(self): method test_past_removal_raises_on_call (line 184) | def test_past_removal_raises_on_call(self): class TestMakeDeprecatedModuleGetattr (line 200) | class TestMakeDeprecatedModuleGetattr: method test_unknown_attr_raises_attribute_error (line 201) | def test_unknown_attr_raises_attribute_error(self): method test_redirects_with_warning (line 206) | def test_redirects_with_warning(self): method test_bad_path_raises (line 223) | def test_bad_path_raises(self): FILE: tinker_cookbook/utils/file_utils.py function read_jsonl (line 4) | def read_jsonl(path: str) -> list[dict]: FILE: tinker_cookbook/utils/format_colorized.py function format_colorized (line 6) | def format_colorized( FILE: tinker_cookbook/utils/logtree.py class Formatter (line 43) | class Formatter(Protocol): method to_html (line 50) | def to_html(self) -> str: method get_css (line 54) | def get_css(self) -> str: method to_data (line 58) | def to_data(self) -> dict[str, Any] | None: class Node (line 64) | class Node: method to_html (line 75) | def to_html(self, indent: int = 0) -> str: method to_dict (line 100) | def to_dict(self) -> dict[str, Any]: class Theme (line 123) | class Theme: class Trace (line 131) | class Trace: method __init__ (line 134) | def __init__(self, title: str, path: str | os.PathLike | None, write_o... method _register_formatter_css (line 142) | def _register_formatter_css(self, css: str) -> None: method body_html (line 147) | def body_html(self, wrap_body: bool = True) -> str: method get_html (line 158) | def get_html(self) -> str: method head_html (line 162) | def head_html( method to_dict (line 202) | def to_dict(self) -> dict[str, Any]: function _normalize_attrs (line 379) | def _normalize_attrs(**attrs: Any) -> dict[str, str]: function _append (line 391) | def _append(node: Node) -> None: function _next_header_level (line 399) | def _next_header_level() -> int: function _is_logging_enabled (line 406) | def _is_logging_enabled() -> bool: function _in_container (line 412) | def _in_container(node: Node) -> Iterator[None]: function _exception_block (line 421) | def _exception_block(exc: BaseException) -> Node: function _write_trace (line 432) | def _write_trace(trace: Trace, theme: Theme | None = None) -> None: function init_trace (line 453) | def init_trace( function scope_header (line 502) | def scope_header(title: str, **attrs: Any) -> Iterator[None]: function scope_header_decorator (line 545) | def scope_header_decorator(title: str) -> Callable[[F], F]: ... # Strin... function scope_header_decorator (line 550) | def scope_header_decorator(title: F) -> F: ... # Bare: @scope_header_de... function scope_header_decorator (line 553) | def scope_header_decorator( function scope_div (line 607) | def scope_div(**attrs: Any) -> Iterator[None]: function scope_disable (line 630) | def scope_disable() -> Iterator[None]: function optional_enable_logging (line 646) | def optional_enable_logging(enable: bool) -> Iterator[None]: function scope_details (line 656) | def scope_details(summary: str) -> Iterator[None]: function log_text (line 687) | def log_text(text: str, *, div_class: str | None = None) -> None: function log_html (line 710) | def log_html(html: str, *, div_class: str | None = None) -> None: function log_formatter (line 737) | def log_formatter(formatter: Formatter) -> None: function details (line 776) | def details(text: str, *, summary: str = "Details", pre: bool = True) ->... function header (line 802) | def header(text: str, *, level: int | None = None) -> None: function table (line 826) | def table(obj: Any, *, caption: str | None = None) -> None: function table_from_dict (line 883) | def table_from_dict( function table_from_dict_of_lists (line 917) | def table_from_dict_of_lists( function _table_from_list_of_dicts (line 956) | def _table_from_list_of_dicts(data: list[dict], *, caption: str | None =... function _table_from_list_of_lists (line 969) | def _table_from_list_of_lists( function write_html_with_default_style (line 1004) | def write_html_with_default_style( function write_trace_json (line 1048) | def write_trace_json(trace: Trace, path: str | os.PathLike) -> None: function jinja_context (line 1062) | def jinja_context(trace: Trace, **extra: Any) -> dict[str, Any]: function render_with_jinja (line 1083) | def render_with_jinja( function flush_trace (line 1114) | def flush_trace() -> bool: FILE: tinker_cookbook/utils/logtree_formatters.py function _render_content_html (line 17) | def _render_content_html(content: Content) -> str: class ConversationFormatter (line 62) | class ConversationFormatter: method to_html (line 73) | def to_html(self) -> str: method to_data (line 86) | def to_data(self) -> dict[str, Any]: method get_css (line 93) | def get_css(self) -> str: FILE: tinker_cookbook/utils/logtree_test.py function test_basic_trace (line 14) | def test_basic_trace(): function test_log_text_renders_inline_text_node (line 35) | def test_log_text_renders_inline_text_node(): function test_nested_scopes (line 47) | def test_nested_scopes(): function test_conditional_logging (line 69) | def test_conditional_logging(): function test_table_rendering (line 94) | def test_table_rendering(): function test_html_content (line 122) | def test_html_content(): function test_details (line 138) | def test_details(): function async_test_async_safety (line 154) | async def async_test_async_safety(): function test_async_safety (line 177) | def test_async_safety(): function test_scope_header_decorator (line 182) | def test_scope_header_decorator(): function async_test_scope_header_decorator (line 208) | async def async_test_scope_header_decorator(): function test_async_decorator (line 229) | def test_async_decorator(): function test_error_handling (line 234) | def test_error_handling(): function test_no_write_without_path (line 255) | def test_no_write_without_path(): function test_scope_div (line 278) | def test_scope_div(): function test_inline_header (line 295) | def test_inline_header(): function test_div_class_parameter (line 312) | def test_div_class_parameter(): function test_export_helpers (line 329) | def test_export_helpers(): function test_write_trace_json (line 346) | def test_write_trace_json(): function test_graceful_degradation (line 367) | def test_graceful_degradation(): function async_test_graceful_degradation_decorator (line 390) | async def async_test_graceful_degradation_decorator(): function test_graceful_degradation_async (line 402) | def test_graceful_degradation_async(): function test_formatter (line 407) | def test_formatter(): function test_formatter_html_escaping (line 436) | def test_formatter_html_escaping(): function test_formatter_css_deduplication (line 461) | def test_formatter_css_deduplication(): function test_scope_details (line 490) | def test_scope_details(): function test_scope_disable_nested (line 513) | def test_scope_disable_nested(): function test_formatter_structured_data_in_json (line 543) | def test_formatter_structured_data_in_json(): function test_log_formatter_without_to_data_still_works (line 641) | def test_log_formatter_without_to_data_still_works(): function test_dataframe_table_produces_structured_nodes (line 663) | def test_dataframe_table_produces_structured_nodes(): FILE: tinker_cookbook/utils/lr_scheduling.py function compute_schedule_lr_multiplier (line 13) | def compute_schedule_lr_multiplier(lr_schedule: LRSchedule, step: int, t... FILE: tinker_cookbook/utils/misc_utils.py function timed (line 20) | def timed(key: str, metrics: dict[str, Any]): function dict_mean (line 31) | def dict_mean(list_of_dicts: list[dict[str, float | int]]) -> dict[str, ... function all_same (line 39) | def all_same(xs: list[Any]) -> bool: function lookup_func (line 43) | def lookup_func(path_to_func: str, default_module: str | None = None): function split_list (line 59) | def split_list(lst: Sequence[T], num_splits: int) -> list[list[T]]: function concat_lists (line 89) | def concat_lists(list_of_lists: list[list[Any]]) -> list[Any]: function not_none (line 93) | def not_none(x: T | None) -> T: FILE: tinker_cookbook/utils/ml_log.py function dump_config (line 52) | def dump_config(config: Any) -> Any: class Logger (line 80) | class Logger(ABC): method log_hparams (line 84) | def log_hparams(self, config: Any) -> None: method log_metrics (line 89) | def log_metrics(self, metrics: dict[str, Any], step: int | None = None... method log_long_text (line 93) | def log_long_text(self, key: str, text: str) -> None: method close (line 97) | def close(self) -> None: method sync (line 101) | def sync(self) -> None: method get_logger_url (line 105) | def get_logger_url(self) -> str | None: class _PermissiveJSONEncoder (line 110) | class _PermissiveJSONEncoder(json.JSONEncoder): method default (line 113) | def default(self, o: Any) -> Any: class JsonLogger (line 121) | class JsonLogger(Logger): method __init__ (line 124) | def __init__(self, log_dir: str | Path): method log_hparams (line 130) | def log_hparams(self, config: Any) -> None: method log_metrics (line 142) | def log_metrics(self, metrics: dict[str, Any], step: int | None = None... class PrettyPrintLogger (line 152) | class PrettyPrintLogger(Logger): method __init__ (line 155) | def __init__(self): method log_hparams (line 159) | def log_hparams(self, config: Any) -> None: method log_metrics (line 167) | def log_metrics(self, metrics: dict[str, Any], step: int | None = None... function _maybe_truncate_repr (line 190) | def _maybe_truncate_repr(value: Any) -> str: function _rich_console_use_logger (line 198) | def _rich_console_use_logger(console: Console): class WandbLogger (line 205) | class WandbLogger(Logger): method __init__ (line 208) | def __init__( method log_hparams (line 233) | def log_hparams(self, config: Any) -> None: method log_metrics (line 238) | def log_metrics(self, metrics: dict[str, Any], step: int | None = None... method close (line 244) | def close(self) -> None: method get_logger_url (line 249) | def get_logger_url(self) -> str | None: class NeptuneLogger (line 256) | class NeptuneLogger(Logger): method __init__ (line 259) | def __init__( method log_hparams (line 284) | def log_hparams(self, config: Any) -> None: method log_metrics (line 289) | def log_metrics( method close (line 300) | def close(self) -> None: class TrackioLogger (line 306) | class TrackioLogger(Logger): method __init__ (line 309) | def __init__( method log_hparams (line 329) | def log_hparams(self, config: Any) -> None: method log_metrics (line 334) | def log_metrics(self, metrics: dict[str, Any], step: int | None = None... method close (line 340) | def close(self) -> None: class MultiplexLogger (line 346) | class MultiplexLogger(Logger): method __init__ (line 349) | def __init__(self, loggers: list[Logger]): method log_hparams (line 352) | def log_hparams(self, config: Any) -> None: method log_metrics (line 357) | def log_metrics(self, metrics: dict[str, Any], step: int | None = None... method log_long_text (line 362) | def log_long_text(self, key: str, text: str) -> None: method close (line 368) | def close(self) -> None: method sync (line 374) | def sync(self) -> None: method get_logger_url (line 380) | def get_logger_url(self) -> str | None: function setup_logging (line 388) | def setup_logging( function _get_command_line_invocation (line 485) | def _get_command_line_invocation() -> str: function configure_logging_module (line 492) | def configure_logging_module(path: str, level: int = logging.INFO) -> lo... FILE: tinker_cookbook/utils/ml_log_test.py function _flush_root_handlers (line 9) | def _flush_root_handlers() -> None: function test_configure_logging_module_logs_invocation_and_appends (line 14) | def test_configure_logging_module_logs_invocation_and_appends(tmp_path): FILE: tinker_cookbook/utils/trace.py class EventType (line 25) | class EventType(StrEnum): class TraceEvent (line 34) | class TraceEvent: method to_dict (line 45) | def to_dict(self) -> dict[str, Any]: class ScopeContext (line 61) | class ScopeContext: class SpanRecord (line 71) | class SpanRecord: class IterationWindow (line 91) | class IterationWindow: method __init__ (line 120) | def __init__(self) -> None: method record_span (line 125) | def record_span(self, name: str, start_time: float, end_time: float) -... method aggregate (line 137) | def aggregate(self) -> dict[str, float]: method get_timing_metrics (line 164) | def get_timing_metrics(self) -> dict[str, float]: method merge_spans (line 175) | def merge_spans(self, spans: list[SpanRecord]) -> None: method get_span_records (line 180) | def get_span_records(self) -> list[dict[str, Any]]: method write_spans_jsonl (line 204) | def write_spans_jsonl(self, path: Path | str, step: int) -> None: class TraceCollector (line 236) | class TraceCollector: method __init__ (line 239) | def __init__(self, flush_interval_sec: float = 1.0, output_file: str =... method add_event (line 252) | def add_event(self, event: TraceEvent): method get_timestamp (line 256) | def get_timestamp(self) -> float: method get_all_events_immediately_available (line 260) | def get_all_events_immediately_available(self) -> list[TraceEvent]: method _write_events (line 270) | def _write_events(self, events: list[TraceEvent], f: TextIOWrapper) ->... method _flush_worker (line 289) | def _flush_worker(self): method shutdown (line 311) | def shutdown(self): function _atexit_trace_shutdown (line 321) | def _atexit_trace_shutdown(): function _instrument_sdk_clients (line 331) | def _instrument_sdk_clients() -> None: function trace_init (line 367) | def trace_init( function trace_shutdown (line 382) | def trace_shutdown() -> None: class FunctionCallContext (line 392) | class FunctionCallContext: class CreateTraceEventsResult (line 403) | class CreateTraceEventsResult: function _get_trace_thread_info (line 410) | def _get_trace_thread_info() -> tuple[int, str, str]: function _create_trace_events (line 428) | def _create_trace_events(name: str) -> CreateTraceEventsResult: function _create_end_event (line 486) | def _create_end_event( function _make_scope_wrapper (line 510) | def _make_scope_wrapper(func: Callable[..., Any], name: str) -> Callable... function scope (line 604) | def scope(func: Callable[..., Any]) -> Callable[..., Any]: function scope_span (line 646) | async def scope_span(name: str): function scope_span_sync (line 685) | def scope_span_sync(name: str): function get_scope_context (line 721) | def get_scope_context() -> ScopeContext: function update_scope_context (line 741) | def update_scope_context(values: dict[str, Any]) -> None: function _build_gantt_chart (line 755) | def _build_gantt_chart(span_records: list[dict[str, Any]], step: int) ->... function save_gantt_chart_html (line 782) | def save_gantt_chart_html(window: IterationWindow, step: int, path: Path... function trace_iteration (line 794) | def trace_iteration(step: int) -> Generator[IterationWindow, None, None]: function convert_jsonl_to_json_main (line 836) | def convert_jsonl_to_json_main(): FILE: tinker_cookbook/utils/trace_test.py function trace_session (line 32) | def trace_session(): function foo (line 49) | async def foo(): function bar (line 58) | async def bar(): function ced (line 66) | def ced(): function baz (line 71) | async def baz(): function coroutine1 (line 78) | async def coroutine1(): function coroutine2 (line 84) | async def coroutine2(): function sync_func (line 90) | def sync_func(): function work (line 95) | async def work(thread_name: str): function example_program (line 103) | async def example_program(): function test_trace (line 119) | def test_trace(): function test_scope_noop_async (line 158) | def test_scope_noop_async(): function test_scope_noop_sync (line 170) | def test_scope_noop_sync(): function test_iteration_window_single_span (line 185) | def test_iteration_window_single_span(): function test_iteration_window_multiple_spans_same_name (line 192) | def test_iteration_window_multiple_spans_same_name(): function test_iteration_window_mixed_spans (line 204) | def test_iteration_window_mixed_spans(): function test_iteration_window_empty (line 219) | def test_iteration_window_empty(): function test_iteration_window_span_records (line 225) | def test_iteration_window_span_records(): function test_merge_spans (line 237) | def test_merge_spans(): function test_get_timing_metrics (line 255) | def test_get_timing_metrics(): function test_get_timing_metrics_without_total (line 265) | def test_get_timing_metrics_without_total(): function test_write_spans_jsonl (line 277) | def test_write_spans_jsonl(): function test_write_spans_jsonl_empty_window (line 305) | def test_write_spans_jsonl_empty_window(): function test_trace_iteration_collects_scoped_spans (line 318) | def test_trace_iteration_collects_scoped_spans(): function test_trace_iteration_aggregates_repeated_calls (line 344) | def test_trace_iteration_aggregates_repeated_calls(): function test_trace_iteration_without_trace_init (line 369) | def test_trace_iteration_without_trace_init(): function test_trace_iteration_with_perfetto_only (line 388) | def test_trace_iteration_with_perfetto_only(): function test_trace_iteration_sync_functions (line 406) | def test_trace_iteration_sync_functions(): function test_trace_iteration_on_exception (line 425) | def test_trace_iteration_on_exception(): function test_trace_iteration_nested (line 454) | def test_trace_iteration_nested(): function test_scope_span_async (line 488) | def test_scope_span_async(): function test_scope_span_with_perfetto (line 503) | def test_scope_span_with_perfetto(): function test_scope_span_noop (line 536) | def test_scope_span_noop(): function test_scope_span_sync (line 547) | def test_scope_span_sync(): function test_scope_span_multiple (line 558) | def test_scope_span_multiple(): function test_scope_span_on_exception (line 574) | def test_scope_span_on_exception(): function test_build_gantt_chart_success (line 598) | def test_build_gantt_chart_success(): function test_build_gantt_chart_empty_spans (line 624) | def test_build_gantt_chart_empty_spans(): function test_build_gantt_chart_no_plotly (line 631) | def test_build_gantt_chart_no_plotly(): function test_save_gantt_chart_html (line 647) | def test_save_gantt_chart_html(): function test_sdk_client_instrumentation_covers_all_async_methods (line 674) | def test_sdk_client_instrumentation_covers_all_async_methods(): function test_scope_double_wrapping_prevention (line 703) | def test_scope_double_wrapping_prevention(): FILE: tinker_cookbook/weights/__init__.py function build_lora_adapter (line 39) | def build_lora_adapter( FILE: tinker_cookbook/weights/_artifacts.py function copy_artifact_file (line 29) | def copy_artifact_file(src: Path, dst: Path) -> None: function _raise_no_safetensors (line 44) | def _raise_no_safetensors(model_dir: Path) -> None: function get_model_state_keys (line 59) | def get_model_state_keys(model_dir: Path) -> set[str]: function get_model_state_shapes (line 77) | def get_model_state_shapes(model_dir: Path) -> dict[str, tuple[int, ...]]: function get_shard_files (line 105) | def get_shard_files(model_dir: Path) -> list[str]: function resolve_model_dir (line 137) | def resolve_model_dir(base_model: str) -> Path: function load_adapter_weights (line 166) | def load_adapter_weights(adapter_dir: Path) -> tuple[dict[str, torch.Ten... function copy_model_code_files (line 201) | def copy_model_code_files(model_dir: Path, output_path: Path) -> None: class ShardWriter (line 230) | class ShardWriter: method __init__ (line 242) | def __init__(self, output_path: Path, max_shard_size: int = _MAX_SHARD... method add_tensor (line 251) | def add_tensor(self, key: str, tensor: torch.Tensor) -> None: method flush (line 264) | def flush(self) -> None: method finalize (line 281) | def finalize(self) -> dict[str, str]: method total_size (line 310) | def total_size(self) -> int: FILE: tinker_cookbook/weights/_download.py function download (line 16) | def download(*, tinker_path: str, output_dir: str, base_url: str | None ... function _safe_extract_tar (line 95) | def _safe_extract_tar(archive_path: Path, extract_dir: Path) -> None: FILE: tinker_cookbook/weights/_export/__init__.py function build_hf_model (line 46) | def build_hf_model( function _has_native_fp8 (line 220) | def _has_native_fp8(config_dict: dict) -> bool: function _resolve_strategy (line 228) | def _resolve_strategy(merge_strategy: str) -> str: function resolve_trust_remote_code (line 240) | def resolve_trust_remote_code(trust_remote_code: bool | None) -> bool: function load_config_dict (line 251) | def load_config_dict(model_dir_or_name: str | Path) -> dict: function is_multimodal (line 279) | def is_multimodal(config: PretrainedConfig) -> bool: function is_multimodal_from_dict (line 287) | def is_multimodal_from_dict(config_dict: dict) -> bool: function save_tokenizer_and_processor (line 293) | def save_tokenizer_and_processor( function cleanup_on_failure (line 318) | def cleanup_on_failure(out: Path) -> None: FILE: tinker_cookbook/weights/_export/_full.py function build_full (line 34) | def build_full( function _load_model (line 88) | def _load_model( FILE: tinker_cookbook/weights/_export/_quantized.py function is_deepseek_config (line 49) | def is_deepseek_config(config_dict: dict) -> bool: function _get_fp8_max (line 62) | def _get_fp8_max() -> float: function quantize_blockwise (line 73) | def quantize_blockwise( function dequantize_blockwise (line 133) | def dequantize_blockwise( function _is_routed_expert_weight (line 187) | def _is_routed_expert_weight(key: str) -> bool: function _should_skip_checkpoint_key (line 203) | def _should_skip_checkpoint_key(key: str) -> bool: function _has_native_fp8_quantization (line 225) | def _has_native_fp8_quantization(config_dict: dict) -> bool: function _get_native_block_size (line 240) | def _get_native_block_size(config_dict: dict) -> tuple[int, int]: function _make_cross_shard_tensor_loader (line 252) | def _make_cross_shard_tensor_loader( function _weight_scale_key (line 293) | def _weight_scale_key(weight_key: str) -> str: function _build_vllm_quantization_config (line 317) | def _build_vllm_quantization_config(output_weight_map: dict[str, str]) -... function _serialize_for_vllm (line 408) | def _serialize_for_vllm(config: dict) -> dict: function _serialize_vllm_scheme (line 429) | def _serialize_vllm_scheme(group: dict) -> dict: function _load_resume_state (line 454) | def _load_resume_state(output_path: Path) -> dict: function _save_merge_state (line 478) | def _save_merge_state( function _save_shard_atomic (line 497) | def _save_shard_atomic( function build_quantized (line 511) | def build_quantized( function _compute_total_size (line 773) | def _compute_total_size(output_path: Path, shard_names: set[str]) -> int: function _patch_config_with_quantization (line 795) | def _patch_config_with_quantization(output_path: Path, quant_config: dic... FILE: tinker_cookbook/weights/_export/_shard.py function build_sharded (line 40) | def build_sharded( FILE: tinker_cookbook/weights/_merge.py class MergeProfile (line 34) | class MergeProfile: function detect_merge_profile (line 70) | def detect_merge_profile( function _detect_gpt_oss_profile (line 108) | def _detect_gpt_oss_profile(model_config: dict, model_state_keys: set[st... function _detect_default_profile (line 129) | def _detect_default_profile(model_config: dict, model_state_keys: set[st... function _detect_deepseek_profile (line 145) | def _detect_deepseek_profile(model_config: dict, model_state_keys: set[s... class MergeOp (line 176) | class MergeOp: function merge_lora_matrices (line 208) | def merge_lora_matrices(lora_A: torch.Tensor, lora_B: torch.Tensor) -> t... function expand_expert_lora_tensors (line 221) | def expand_expert_lora_tensors( function apply_merged_weight (line 257) | def apply_merged_weight(target: torch.Tensor, merged_lora: torch.Tensor)... function plan_merge_ops (line 272) | def plan_merge_ops( function _plan_non_expert_op (line 352) | def _plan_non_expert_op( function _plan_expert_ops (line 375) | def _plan_expert_ops( function validate_merge_op_shapes (line 442) | def validate_merge_op_shapes( function apply_merge_op (line 496) | def apply_merge_op(tensors: dict[str, torch.Tensor], op: MergeOp) -> None: function merge_adapter_weights (line 538) | def merge_adapter_weights( FILE: tinker_cookbook/weights/_publish.py function publish_to_hf_hub (line 10) | def publish_to_hf_hub( FILE: tinker_cookbook/weights/artifacts_test.py class TestGetModelStateKeys (line 28) | class TestGetModelStateKeys: method test_reads_keys_from_single_shard (line 29) | def test_reads_keys_from_single_shard(self, tmp_path: Path): method test_reads_keys_from_multiple_shards (line 36) | def test_reads_keys_from_multiple_shards(self, tmp_path: Path): method test_raises_if_no_safetensors (line 43) | def test_raises_if_no_safetensors(self, tmp_path: Path): class TestGetModelStateShapes (line 53) | class TestGetModelStateShapes: method test_reads_shapes (line 54) | def test_reads_shapes(self, tmp_path: Path): method test_reads_shapes_across_shards (line 61) | def test_reads_shapes_across_shards(self, tmp_path: Path): method test_helpful_error_for_bin_files (line 68) | def test_helpful_error_for_bin_files(self, tmp_path: Path): method test_helpful_error_for_empty_dir (line 73) | def test_helpful_error_for_empty_dir(self, tmp_path: Path): class TestGetShardFiles (line 83) | class TestGetShardFiles: method test_reads_from_index_json (line 84) | def test_reads_from_index_json(self, tmp_path: Path): method test_falls_back_to_glob (line 97) | def test_falls_back_to_glob(self, tmp_path: Path): method test_raises_if_no_files (line 103) | def test_raises_if_no_files(self, tmp_path: Path): class TestShardWriter (line 113) | class TestShardWriter: method test_single_shard_named_without_index (line 114) | def test_single_shard_named_without_index(self, tmp_path: Path): method test_multiple_shards_when_exceeding_max_size (line 126) | def test_multiple_shards_when_exceeding_max_size(self, tmp_path: Path): method test_total_size_tracks_bytes (line 137) | def test_total_size_tracks_bytes(self, tmp_path: Path): method test_temp_files_cleaned_up (line 142) | def test_temp_files_cleaned_up(self, tmp_path: Path): method test_empty_writer_produces_no_files (line 151) | def test_empty_writer_produces_no_files(self, tmp_path: Path): class TestLoadAdapterWeights (line 163) | class TestLoadAdapterWeights: method test_loads_weights_and_config (line 164) | def test_loads_weights_and_config(self, tmp_path: Path): method test_missing_safetensors_raises (line 173) | def test_missing_safetensors_raises(self, tmp_path: Path): method test_missing_config_raises (line 178) | def test_missing_config_raises(self, tmp_path: Path): class TestCopyModelCodeFiles (line 189) | class TestCopyModelCodeFiles: method test_copies_only_py_files (line 190) | def test_copies_only_py_files(self, tmp_path: Path): method test_does_not_overwrite_existing (line 211) | def test_does_not_overwrite_existing(self, tmp_path: Path): FILE: tinker_cookbook/weights/download_test.py class TestSafeExtractTar (line 14) | class TestSafeExtractTar: method test_rejects_symlinks (line 17) | def test_rejects_symlinks(self): method test_rejects_path_traversal (line 35) | def test_rejects_path_traversal(self): method test_extracts_safe_archive (line 51) | def test_extracts_safe_archive(self): class TestDownload (line 68) | class TestDownload: method test_downloads_and_extracts (line 71) | def test_downloads_and_extracts(self): FILE: tinker_cookbook/weights/export_test.py function _create_synthetic_model (line 21) | def _create_synthetic_model(model_dir: Path, config_dict: dict, state_di... function _create_sharded_model (line 44) | def _create_sharded_model( function _create_adapter (line 74) | def _create_adapter(adapter_dir: Path, weights: dict[str, torch.Tensor],... class TestBuildHfModelDispatch (line 86) | class TestBuildHfModelDispatch: method test_invalid_strategy_raises (line 87) | def test_invalid_strategy_raises(self, tmp_path: Path): method test_dequantize_raises_not_implemented (line 96) | def test_dequantize_raises_not_implemented(self, tmp_path: Path): method test_invalid_dtype_raises (line 105) | def test_invalid_dtype_raises(self, tmp_path: Path): class TestBuildShardedSingleShard (line 120) | class TestBuildShardedSingleShard: method test_merges_adapter_into_single_shard (line 123) | def test_merges_adapter_into_single_shard(self, tmp_path: Path): class TestBuildShardedMultiShard (line 175) | class TestBuildShardedMultiShard: method test_merges_across_shards (line 178) | def test_merges_across_shards(self, tmp_path: Path): class TestBuildShardedSeparateExperts (line 227) | class TestBuildShardedSeparateExperts: method test_merges_per_expert_weights (line 230) | def test_merges_per_expert_weights(self, tmp_path: Path): class TestBuildShardedFusedExperts (line 274) | class TestBuildShardedFusedExperts: method test_merges_gate_and_up_into_correct_halves (line 282) | def test_merges_gate_and_up_into_correct_halves(self, tmp_path: Path): method test_single_shard_output_has_no_index (line 322) | def test_single_shard_output_has_no_index(self, tmp_path: Path): class TestBuildShardedCleanup (line 354) | class TestBuildShardedCleanup: method test_cleans_up_on_failure (line 355) | def test_cleans_up_on_failure(self, tmp_path: Path): function _load_output_tensors (line 379) | def _load_output_tensors(output_dir: Path) -> dict[str, torch.Tensor]: FILE: tinker_cookbook/weights/merge_test.py function _make_base_model (line 31) | def _make_base_model(state_dict: dict[str, torch.Tensor], class_name: st... function _make_expert_lora_pair (line 41) | def _make_expert_lora_pair( class TestApplyMergedWeight (line 58) | class TestApplyMergedWeight: method test_adds_delta_in_place (line 59) | def test_adds_delta_in_place(self): method test_raises_on_shape_mismatch (line 65) | def test_raises_on_shape_mismatch(self): class TestConfigValidation (line 75) | class TestConfigValidation: method test_missing_lora_alpha (line 76) | def test_missing_lora_alpha(self): method test_missing_r (line 81) | def test_missing_r(self): class TestNonExpertMerge (line 92) | class TestNonExpertMerge: method test_standard_linear_merge (line 93) | def test_standard_linear_merge(self): method test_missing_target_key_raises (line 111) | def test_missing_target_key_raises(self): method test_gpt_oss_attn_remapping (line 120) | def test_gpt_oss_attn_remapping(self): method test_vision_model_prefix_remapping (line 133) | def test_vision_model_prefix_remapping(self): class TestSeparateExpertMerge (line 151) | class TestSeparateExpertMerge: method test_per_expert_merge (line 152) | def test_per_expert_merge(self): method test_shared_lora_a_broadcast (line 172) | def test_shared_lora_a_broadcast(self): class TestFusedInterleavedMerge (line 199) | class TestFusedInterleavedMerge: method _make_state_dict (line 207) | def _make_state_dict(self) -> dict[str, torch.Tensor]: method _make_adapter (line 217) | def _make_adapter(self, gate_fill: float, up_fill: float) -> dict[str,... method test_gate_and_up_in_correct_slots (line 232) | def test_gate_and_up_in_correct_slots(self): method test_up_does_not_leak_into_gate (line 246) | def test_up_does_not_leak_into_gate(self): class TestFusedConcatenatedMerge (line 269) | class TestFusedConcatenatedMerge: method _make_state_dict (line 277) | def _make_state_dict(self) -> dict[str, torch.Tensor]: method _make_adapter (line 287) | def _make_adapter(self, gate_fill: float, up_fill: float) -> dict[str,... method test_gate_and_up_in_correct_halves (line 302) | def test_gate_and_up_in_correct_halves(self): method test_up_does_not_leak_into_gate (line 317) | def test_up_does_not_leak_into_gate(self): class TestExpertErrorCases (line 341) | class TestExpertErrorCases: method test_non_3d_expert_lora_raises (line 342) | def test_non_3d_expert_lora_raises(self): class TestMergeLoraMatrices (line 364) | class TestMergeLoraMatrices: method test_basic_multiplication (line 365) | def test_basic_multiplication(self): method test_with_scaling (line 372) | def test_with_scaling(self): class TestExpandExpertLoraTensors (line 387) | class TestExpandExpertLoraTensors: method test_expand_A_to_match_B (line 388) | def test_expand_A_to_match_B(self): method test_expand_B_to_match_A (line 395) | def test_expand_B_to_match_A(self): method test_both_single_raises (line 402) | def test_both_single_raises(self): method test_already_matched_is_noop (line 406) | def test_already_matched_is_noop(self): method test_mismatched_expert_counts_raises (line 413) | def test_mismatched_expert_counts_raises(self): class TestDetectMergeProfile (line 423) | class TestDetectMergeProfile: method test_standard_model (line 424) | def test_standard_model(self): method test_gpt_oss_detection (line 432) | def test_gpt_oss_detection(self): method test_fused_concatenated_non_gpt_oss (line 442) | def test_fused_concatenated_non_gpt_oss(self): method test_vision_model_prefix (line 449) | def test_vision_model_prefix(self): method test_separate_experts_without_fused (line 455) | def test_separate_experts_without_fused(self): method test_empty_architectures (line 461) | def test_empty_architectures(self): class TestPlanMergeOps (line 472) | class TestPlanMergeOps: method test_non_expert_produces_2d_op (line 473) | def test_non_expert_produces_2d_op(self): method test_separate_experts_produce_per_expert_2d_ops (line 488) | def test_separate_experts_produce_per_expert_2d_ops(self): method test_fused_experts_produce_3d_ops (line 506) | def test_fused_experts_produce_3d_ops(self): method test_fused_interleaved_sets_flag (line 520) | def test_fused_interleaved_sets_flag(self): method test_extra_key_remaps_applied (line 531) | def test_extra_key_remaps_applied(self): method test_vision_prefix_remapping (line 541) | def test_vision_prefix_remapping(self): method test_unembed_tokens_remapped_to_lm_head (line 551) | def test_unembed_tokens_remapped_to_lm_head(self): method test_missing_key_raises (line 561) | def test_missing_key_raises(self): method test_missing_config_key_raises (line 571) | def test_missing_config_key_raises(self): method test_invalid_expert_layout_raises (line 575) | def test_invalid_expert_layout_raises(self): class TestApplyMergeOp (line 585) | class TestApplyMergeOp: method test_2d_standard_merge (line 586) | def test_2d_standard_merge(self): method test_3d_fused_concatenated_gate (line 598) | def test_3d_fused_concatenated_gate(self): method test_3d_fused_interleaved_up (line 618) | def test_3d_fused_interleaved_up(self): method test_shape_mismatch_raises (line 638) | def test_shape_mismatch_raises(self): class TestValidateMergeOpShapes (line 654) | class TestValidateMergeOpShapes: method test_valid_2d_op_passes (line 655) | def test_valid_2d_op_passes(self): method test_invalid_2d_shape_raises (line 666) | def test_invalid_2d_shape_raises(self): method test_valid_3d_fused_concatenated_passes (line 678) | def test_valid_3d_fused_concatenated_passes(self): method test_invalid_3d_fused_shape_raises (line 696) | def test_invalid_3d_fused_shape_raises(self): method test_valid_3d_non_fused_passes (line 713) | def test_valid_3d_non_fused_passes(self): FILE: tinker_cookbook/weights/publish_test.py class TestPublishToHfHub (line 11) | class TestPublishToHfHub: method test_raises_on_nonexistent_path (line 12) | def test_raises_on_nonexistent_path(self): method test_calls_hf_api_correctly (line 19) | def test_calls_hf_api_correctly(self): method test_public_repo (line 43) | def test_public_repo(self): FILE: tinker_cookbook/weights/quantized_test.py class TestFP8RoundTrip (line 34) | class TestFP8RoundTrip: method test_exact_round_trip_block_size_1 (line 35) | def test_exact_round_trip_block_size_1(self): method test_padded_dimensions (line 44) | def test_padded_dimensions(self): method test_large_block_preserves_shape (line 56) | def test_large_block_preserves_shape(self): method test_zeros_round_trip (line 63) | def test_zeros_round_trip(self): class TestIsDeepseekConfig (line 76) | class TestIsDeepseekConfig: method test_deepseek_v3_detected (line 77) | def test_deepseek_v3_detected(self): method test_non_deepseek_rejected (line 80) | def test_non_deepseek_rejected(self): method test_similar_strings_rejected (line 85) | def test_similar_strings_rejected(self): class TestIsRoutedExpertWeight (line 95) | class TestIsRoutedExpertWeight: method test_routed_expert_matched (line 96) | def test_routed_expert_matched(self): method test_shared_expert_rejected (line 100) | def test_shared_expert_rejected(self): method test_attention_rejected (line 103) | def test_attention_rejected(self): method test_norm_rejected (line 106) | def test_norm_rejected(self): method test_embed_rejected (line 109) | def test_embed_rejected(self): class TestShouldSkipCheckpointKey (line 118) | class TestShouldSkipCheckpointKey: method test_rotary_emb_skipped (line 119) | def test_rotary_emb_skipped(self): method test_layer_61_skipped (line 122) | def test_layer_61_skipped(self): method test_normal_layer_not_skipped (line 126) | def test_normal_layer_not_skipped(self): method test_embed_not_skipped (line 130) | def test_embed_not_skipped(self): class TestBuildVllmQuantizationConfig (line 139) | class TestBuildVllmQuantizationConfig: method test_correct_schema (line 140) | def test_correct_schema(self): method test_ignore_list_correct (line 161) | def test_ignore_list_correct(self): class TestSerializeForVllm (line 178) | class TestSerializeForVllm: method test_strips_unknown_fields (line 179) | def test_strips_unknown_fields(self): method test_preserves_known_fields (line 194) | def test_preserves_known_fields(self): class TestResumeState (line 219) | class TestResumeState: method test_no_state_file_returns_empty (line 220) | def test_no_state_file_returns_empty(self, tmp_path: Path): method test_load_valid_state (line 223) | def test_load_valid_state(self, tmp_path: Path): method test_missing_shard_file_raises (line 236) | def test_missing_shard_file_raises(self, tmp_path: Path): method test_atomic_save (line 247) | def test_atomic_save(self, tmp_path: Path): class TestSaveShardAtomic (line 256) | class TestSaveShardAtomic: method test_atomic_write (line 257) | def test_atomic_write(self, tmp_path: Path): class TestOutputShardAssembly (line 271) | class TestOutputShardAssembly: method _make_model_and_adapter (line 274) | def _make_model_and_adapter(self, tmp_path: Path): method test_routed_expert_quantized_to_fp8 (line 328) | def test_routed_expert_quantized_to_fp8(self, tmp_path: Path): method test_dense_stays_bf16 (line 355) | def test_dense_stays_bf16(self, tmp_path: Path): method test_shared_expert_stays_bf16 (line 380) | def test_shared_expert_stays_bf16(self, tmp_path: Path): method test_config_has_compression_config (line 402) | def test_config_has_compression_config(self, tmp_path: Path): class TestCrossShardFP8Scale (line 430) | class TestCrossShardFP8Scale: method test_cross_shard_scale_dequantizes_correctly (line 434) | def test_cross_shard_scale_dequantizes_correctly(self, tmp_path: Path): method test_merge_applied_before_requantize_on_native_fp8 (line 522) | def test_merge_applied_before_requantize_on_native_fp8(self, tmp_path:... FILE: tinker_cookbook/weights/stress_test.py function _create_model (line 36) | def _create_model(path: Path, config: dict, state_dict: dict) -> None: function _create_adapter (line 54) | def _create_adapter(path: Path, weights: dict, config: dict) -> None: class TestNumericalCorrectness (line 65) | class TestNumericalCorrectness: method test_merge_lora_matrices_matches_manual (line 68) | def test_merge_lora_matrices_matches_manual(self): method test_scaling_applied_correctly (line 77) | def test_scaling_applied_correctly(self): method test_higher_rank_lora (line 93) | def test_higher_rank_lora(self): method test_bfloat16_precision (line 104) | def test_bfloat16_precision(self): class TestCrossPathConsistency (line 124) | class TestCrossPathConsistency: method _make_model_and_adapter (line 127) | def _make_model_and_adapter(self): method test_plan_apply_matches_merge_adapter_weights (line 143) | def test_plan_apply_matches_merge_adapter_weights(self): method test_multiple_adapters_targeting_same_key (line 164) | def test_multiple_adapters_targeting_same_key(self): class TestExpertEdgeCases (line 189) | class TestExpertEdgeCases: method test_fused_gate_and_up_both_applied (line 190) | def test_fused_gate_and_up_both_applied(self): method test_fused_down_proj_no_slicing (line 219) | def test_fused_down_proj_no_slicing(self): class TestShardPathEdgeCases (line 239) | class TestShardPathEdgeCases: method test_adapter_targets_subset_of_model_keys (line 240) | def test_adapter_targets_subset_of_model_keys(self, tmp_path: Path): method test_empty_adapter_produces_identical_output (line 277) | def test_empty_adapter_produces_identical_output(self, tmp_path: Path,... method test_output_exists_raises_before_any_work (line 304) | def test_output_exists_raises_before_any_work(self, tmp_path: Path): class TestShapeValidationEdgeCases (line 339) | class TestShapeValidationEdgeCases: method test_shapes_read_without_loading_tensors (line 340) | def test_shapes_read_without_loading_tensors(self, tmp_path: Path): method test_validate_catches_wrong_rank (line 353) | def test_validate_catches_wrong_rank(self): class TestProfileDetectionEdgeCases (line 366) | class TestProfileDetectionEdgeCases: method test_gpt_oss_without_fused_experts (line 367) | def test_gpt_oss_without_fused_experts(self): method test_vision_gpt_oss_combination (line 375) | def test_vision_gpt_oss_combination(self): class TestConfigLoadingEdgeCases (line 393) | class TestConfigLoadingEdgeCases: method test_local_dir_without_config_raises (line 394) | def test_local_dir_without_config_raises(self, tmp_path: Path): method test_local_dir_with_config_loads (line 399) | def test_local_dir_with_config_loads(self, tmp_path: Path): class TestShardWriterEdgeCases (line 410) | class TestShardWriterEdgeCases: method test_single_tensor_larger_than_max_shard (line 411) | def test_single_tensor_larger_than_max_shard(self, tmp_path: Path): method test_shard_count_correct_after_multiple_flushes (line 422) | def test_shard_count_correct_after_multiple_flushes(self, tmp_path: Pa... FILE: tinker_cookbook/xmux/control.py class JobStatus (line 16) | class JobStatus(StrEnum): class PaneJobInfo (line 25) | class PaneJobInfo(BaseModel): class WindowJobInfo (line 32) | class WindowJobInfo(BaseModel): class SessionMetadata (line 39) | class SessionMetadata(BaseModel): class PaneInfo (line 51) | class PaneInfo(BaseModel): class JobInfo (line 59) | class JobInfo(BaseModel): function load_existing_metadata (line 73) | def load_existing_metadata(session_name: str) -> SessionMetadata | None: class ControlWindow (line 82) | class ControlWindow: method __init__ (line 85) | def __init__(self, session_name: str): method debug_print (line 102) | def debug_print(self, msg: str) -> None: method _load_metadata (line 107) | def _load_metadata(self) -> SessionMetadata: method _get_window_list (line 115) | def _get_window_list(self) -> list[tuple[int, str]]: method _get_pane_info (line 141) | def _get_pane_info(self, window_index: int) -> list[PaneInfo]: method _check_job_status (line 172) | def _check_job_status(self, job: JobInfo) -> JobStatus: method refresh_jobs (line 214) | def refresh_jobs(self) -> None: method draw_header (line 291) | def draw_header(self, stdscr: curses.window, height: int, width: int) ... method draw_jobs (line 315) | def draw_jobs(self, stdscr: curses.window, height: int, width: int) ->... method draw_footer (line 359) | def draw_footer(self, stdscr: curses.window, height: int, width: int) ... method handle_input (line 384) | def handle_input(self, _stdscr: curses.window, key: int) -> bool: method run (line 448) | def run(self, stdscr: curses.window) -> None: function main (line 495) | def main() -> None: FILE: tinker_cookbook/xmux/core.py class JobSpec (line 17) | class JobSpec(BaseModel): method get_window_name (line 25) | def get_window_name(self, default_name: str) -> str: class SwarmConfig (line 30) | class SwarmConfig(BaseModel): method get_session_name (line 42) | def get_session_name(self) -> str: class JobConfig (line 48) | class JobConfig(BaseModel): function _execute_command (line 57) | def _execute_command(cmdlist: list[str], verbose: bool = False) -> subpr... function _save_job_config (line 65) | def _save_job_config(job_spec: JobSpec, use_pickle: bool, dry_run: bool)... class JobCommand (line 97) | class JobCommand(BaseModel): function _get_tmux_env_flags (line 104) | def _get_tmux_env_flags(env: dict[str, str]) -> list[str]: function _create_job_command (line 109) | def _create_job_command(config_path: str, debug: bool = False, dry_run: ... function _session_exists (line 131) | def _session_exists(session_name: str) -> bool: function _get_next_window_index (line 139) | def _get_next_window_index(metadata: SessionMetadata | None) -> int: function _merge_metadata (line 152) | def _merge_metadata( function _enable_pane_logging (line 198) | def _enable_pane_logging( function _configure_status_bar (line 214) | def _configure_status_bar(session_name: str, sweep_name: str, verbose: b... function launch_swarm (line 278) | def launch_swarm(job_specs: list[JobSpec], config: SwarmConfig) -> None: FILE: tinker_cookbook/xmux/examples/async_rl_sweep.py function json_already_exists (line 12) | def json_already_exists(log_relpath: str) -> bool: function build_rl_basic_config (line 20) | def build_rl_basic_config(max_steps_off_policy: int, name: str) -> rl_tr... function async_rl_sweep (line 47) | def async_rl_sweep(): FILE: tinker_cookbook/xmux/examples/fake_train.py class Config (line 11) | class Config(BaseModel): function fake_train_model (line 18) | def fake_train_model(config_dict: dict[str, Any]): function main (line 66) | def main(config: dict[str, Any]): FILE: tinker_cookbook/xmux/examples/ml_sweep.py function demo_individual_windows (line 13) | def demo_individual_windows(): function demo_grouped_by_model (line 66) | def demo_grouped_by_model(): function demo_mixed_grouping (line 100) | def demo_mixed_grouping(): function demo_large_scale (line 153) | def demo_large_scale(): function demo_real_usage (line 201) | def demo_real_usage(): function main (line 234) | def main(): FILE: tinker_cookbook/xmux/run_job.py function get_module_member (line 13) | def get_module_member(path_with_colon: str) -> Callable[..., object]: function main (line 20) | def main() -> None: FILE: tinker_cookbook/xmux/utils.py function find_common_prefix (line 10) | def find_common_prefix(strings: list[str]) -> str: function abbreviate_path (line 41) | def abbreviate_path(path: str, max_length: int = 20) -> str: function generate_unique_names (line 89) | def generate_unique_names(paths: list[str], max_length: int = 20) -> lis... function smart_window_name (line 122) | def smart_window_name( function format_status_bar_windows (line 136) | def format_status_bar_windows(window_names: list[str], max_width: int = ... class SymbolPath (line 168) | class SymbolPath(str): method __new__ (line 172) | def __new__(cls, module: str, name: str): method from_string (line 180) | def from_string(cls, value: str): method __reduce__ (line 184) | def __reduce__(self): function get_symbol_path (line 188) | def get_symbol_path(cls_or_fn: Any) -> SymbolPath: