Skip to content

Fix Tinker API#553

Merged
chenyushuo merged 4 commits into
agentscope-ai:mainfrom
pan-x-c:fix/tinker
May 26, 2026
Merged

Fix Tinker API#553
chenyushuo merged 4 commits into
agentscope-ai:mainfrom
pan-x-c:fix/tinker

Conversation

@pan-x-c
Copy link
Copy Markdown
Collaborator

@pan-x-c pan-x-c commented May 26, 2026

Description

This pull request refactors the sample method in vllm_model.py to ensure compatibility with the new tinker interface

  • Refactored the sample method in vllm_model.py to collect prompt log probabilities (prompt_logprobs) and top-k prompt log probabilities (topk_prompt_logprobs) as NumPy arrays instead of Python lists, improving performance and downstream compatibility. The SampledSequence and SampleResponse now use NumPy arrays for token IDs and logprobs.
  • Introduced the TopkPromptLogprobs type for structured storage of top-k logprobs, and updated the method to return prompt_logprobs_np and topk_prompt_logprobs_np fields.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@pan-x-c
Copy link
Copy Markdown
Collaborator Author

pan-x-c commented May 26, 2026

/unittest-module-common

1 similar comment
@pan-x-c
Copy link
Copy Markdown
Collaborator Author

pan-x-c commented May 26, 2026

/unittest-module-common

@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
0 0 0 0 0 0 2ms

Tests

Test Name Status Flaky Duration

Github Test Reporter by CTRF 💚

@chenyushuo
Copy link
Copy Markdown
Collaborator

/unittest-module-common

@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
81 79 0 2 0 0 27m 25s

Skipped

Tests Status
tests/common/vllm_test.py::TestAPIServer::test_reasoning_content skipped ⏭️
tests/common/vllm_test.py::TestTinkerAsyncAPIServer::test_api_async skipped ⏭️

Tests

Test Name Status Flaky Duration
tests/common/config_test.py::TestConfig::test_all_examples_are_valid 17.3s
tests/common/config_test.py::TestConfig::test_chat_template_path 101ms
tests/common/config_test.py::TestConfig::test_config_flatten 39ms
tests/common/config_test.py::TestConfig::test_continue_from_checkpoint_is_valid 215ms
tests/common/config_test.py::TestConfig::test_default_workflow 99ms
tests/common/config_test.py::TestConfig::test_inference_model_base_port_falls_back_when_unavailable 3ms
tests/common/config_test.py::TestConfig::test_inference_model_base_port_uses_engine_id 1ms
tests/common/config_test.py::TestConfig::test_inference_model_random_port_can_use_port_reserved_by_api_server 1ms
tests/common/config_test.py::TestConfig::test_inference_model_random_port_ignores_base_port 1ms
tests/common/config_test.py::TestConfig::test_inference_model_without_base_port_uses_ephemeral_port 1ms
tests/common/config_test.py::TestConfig::test_load_default_config 369ms
tests/common/config_test.py::TestConfig::test_max_token_len_per_gpu_set_correctly 443ms
tests/common/config_test.py::TestConfig::test_multinode_inference_is_rejected_for_non_vllm_sglang_engines 38ms
tests/common/config_test.py::TestConfig::test_multinode_vllm_config_is_valid 37ms
tests/common/config_test.py::TestConfig::test_multinode_vllm_requires_full_node_occupancy 38ms
tests/common/config_test.py::TestConfig::test_multinode_vllm_requires_matching_nnodes_for_full_nodes 37ms
tests/common/config_test.py::TestConfig::test_multinode_vllm_requires_nnodes_within_cluster_size 38ms
tests/common/config_test.py::TestConfig::test_optimizer_config_propagation 100ms
tests/common/config_test.py::TestConfig::test_update_config_from_ray_cluster 1.7s
tests/common/experience_extraction_test.py::TestExperienceExtraction::test_convert_completion_output_extracts_sglang_routed_experts 1ms
tests/common/experience_extraction_test.py::TestExperienceExtraction::test_convert_completion_output_ignores_invalid_routed_experts_shape 1ms
tests/common/experience_test.py::TestEID::test_eid_properties 1ms
tests/common/experience_test.py::TestExperience::test_action_mask_and_logprobs_type 1ms
tests/common/experience_test.py::TestExperience::test_assertions 1ms
tests/common/experience_test.py::TestExperience::test_build_experience_token_view_aligns_prompt_action_mask_and_logprobs 1ms
tests/common/experience_test.py::TestExperience::test_deserialize_legacy_pickle_payload 2ms
tests/common/experience_test.py::TestExperience::test_deserialize_single_rejects_batch_payload 1ms
tests/common/experience_test.py::TestExperience::test_dpo_experience 1ms
tests/common/experience_test.py::TestExperience::test_format_colored_tokens_uses_action_mask 1ms
tests/common/experience_test.py::TestExperience::test_format_colored_tokens_uses_decoded_token_text 1ms
tests/common/experience_test.py::TestExperience::test_hf_datasets_conversion 15ms
tests/common/experience_test.py::TestExperience::test_multi_turn_experience 1ms
tests/common/experience_test.py::TestExperience::test_print_colored_tokens_writes_to_file 1ms
tests/common/experience_test.py::TestExperience::test_serialize_deserialize 1ms
tests/common/experience_test.py::TestExperience::test_serialize_deserialize_with_routed_experts 1ms
tests/common/experience_test.py::TestExperience::test_serialize_many_deserialize_many 1ms
tests/common/experience_test.py::TestExperience::test_serialize_many_deserialize_many_with_routed_experts 1ms
tests/common/experience_test.py::TestExperience::test_serialize_many_with_shared_multimodal_tensor 1ms
tests/common/experience_test.py::TestExperience::test_single_turn_experience 1ms
tests/common/experience_test.py::TestExperience::test_to_dict 1ms
tests/common/experience_test.py::TestExperienceConversion::test_experience_model_experience_conversion 1ms
tests/common/external_model_test.py::TestExternalModel::test_external_model_load 808ms
tests/common/models/utils_test.py::TestTokenizeAndMaskMessagesDefault::test_first_message_is_assistant 1.3s
tests/common/models/utils_test.py::TestTokenizeAndMaskMessagesDefault::test_messages_empty 706ms
tests/common/models/utils_test.py::TestTokenizeAndMaskMessagesDefault::test_mm_messages 1.3s
tests/common/models/utils_test.py::TestTokenizeAndMaskMessagesDefault::test_no_assistant_messages 720ms
tests/common/models/utils_test.py::TestTokenizeAndMaskMessagesDefault::test_normal_conversation_data 1.0s
tests/common/sglang_test.py::TestSGLangOpenAIAPI_0::test_chat_completions 2m 38s
tests/common/sglang_test.py::TestSGLangOpenAIAPI_1::test_chat_completions 1m 5s
tests/common/sglang_test.py::TestSGLangOpenAIAPI_2::test_chat_completions 54.2s
tests/common/sudoku_test.py::test_9x9_generator_produces_valid_solution 1ms
tests/common/sudoku_test.py::test_9x9_generator_creates_holes 1ms
tests/common/sudoku_test.py::test_9x9_solution_is_fully_filled 2ms
tests/common/sudoku_test.py::test_judge_allows_incomplete_board 1ms
tests/common/sudoku_test.py::test_judge_detects_row_violation 1ms
tests/common/sudoku_test.py::test_judge_detects_column_violation 1ms
tests/common/sudoku_test.py::test_judge_detects_block_violation 1ms
tests/common/sudoku_test.py::test_4x4_generator_produces_valid_solution 1ms
tests/common/sudoku_test.py::test_4x4_solution_is_fully_filled 1ms
tests/common/sudoku_test.py::test_4x4_judge_detects_row_violation 1ms
tests/common/sudoku_test.py::test_4x4_judge_detects_block_violation 1ms
tests/common/vllm_test.py::ModelWrapperTest_0::test_generate 1m 9s
tests/common/vllm_test.py::ModelWrapperTest_1::test_generate 58.1s
tests/common/vllm_test.py::ModelWrapperTest_2::test_generate 3m 18s
tests/common/vllm_test.py::TestModelLen_0::test_model_len 56.4s
tests/common/vllm_test.py::TestModelLen_1::test_model_len 55.2s
tests/common/vllm_test.py::TestModelLen_2::test_model_len 54.5s
tests/common/vllm_test.py::TestModelLenWithoutPromptTruncation::test_model_len 54.9s
tests/common/vllm_test.py::TestMessageProcess::test_no_prompt_truncation 54.9s
tests/common/vllm_test.py::TestMessageProcess::test_truncation_status 56.2s
tests/common/vllm_test.py::TestAPIServer::test_api 56.1s
tests/common/vllm_test.py::TestAPIServer::test_reasoning_content ⏭️ 515ms
tests/common/vllm_test.py::TestLogprobs::test_logprobs_api 39.8s
tests/common/vllm_test.py::TestAsyncAPIServer::test_api_async 41.7s
tests/common/vllm_test.py::TestTinkerAsyncAPIServer::test_api_async ⏭️ 1ms
tests/common/vllm_test.py::TestTokenizer::test_action_mask 268ms
tests/common/vllm_test.py::TestTokenizer::test_action_mask_with_tools 587ms
tests/common/vllm_test.py::TestAPIServerToolCall_0_deepseek_r1::test_api_tool_calls 2m 29s
tests/common/vllm_test.py::TestAPIServerToolCall_1::test_api_tool_calls 2m 30s
tests/common/vllm_test.py::TestSuperLongGeneration::test_generate 2m 35s
tests/common/vllm_test.py::TestTinkerAPI::test_tinker_api 1m 19s

Github Test Reporter by CTRF 💚

@pan-x-c
Copy link
Copy Markdown
Collaborator Author

pan-x-c commented May 26, 2026

/unittest-pattern-TestTinkerAPI

@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
1 1 0 0 0 0 1m 50s

Github Test Reporter by CTRF 💚

Comment thread trinity/common/models/vllm_model.py Outdated
@chenyushuo chenyushuo merged commit e5042a3 into agentscope-ai:main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants