Skip to content

[serve.llm] delete dead code from prompt format days#53621

Merged
kouroshHakha merged 11 commits intoray-project:masterfrom
nrghosh:delete_abstraction
Jun 10, 2025
Merged

[serve.llm] delete dead code from prompt format days#53621
kouroshHakha merged 11 commits intoray-project:masterfrom
nrghosh:delete_abstraction

Conversation

@nrghosh
Copy link
Copy Markdown
Contributor

@nrghosh nrghosh commented Jun 6, 2025

Why are these changes needed?

Cleanup - quick todo

Related issue number

https://anyscale1.atlassian.net/browse/LLM-1705

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
@nrghosh nrghosh requested a review from a team as a code owner June 6, 2025 19:46
@nrghosh nrghosh force-pushed the delete_abstraction branch 4 times, most recently from 07a9a52 to 0ca98dd Compare June 6, 2025 22:57
@nrghosh nrghosh force-pushed the delete_abstraction branch 2 times, most recently from c600add to f415836 Compare June 6, 2025 23:28
@nrghosh nrghosh changed the title quick todo - delete abstraction for prompt formats [serve] delete abstraction for prompt formats Jun 6, 2025
- Merge branch 'master' into delete_abstraction
@nrghosh nrghosh force-pushed the delete_abstraction branch from f415836 to d8d36ec Compare June 6, 2025 23:46
@kouroshHakha
Copy link
Copy Markdown
Contributor

@nrghosh you can add go label when you think this PR is ready to get tested against pre-merge ci.

@kouroshHakha kouroshHakha added the go add ONLY when ready to merge, run all tests label Jun 7, 2025
@kouroshHakha kouroshHakha changed the title [serve] delete abstraction for prompt formats [serve.llm] delete dead code from prompt format days Jun 7, 2025
Copy link
Copy Markdown
Contributor

@kouroshHakha kouroshHakha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more stuff can be deleted in this pr.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The huggingfacePromptFormat should also be deleted and absorbed? There is basically no need for this abstraction anymore?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you search for generate_prompt I don't think there is any place that uses it. We need to do a holistic clean up here. Most of items in this file are dead code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, generate_prompt isn't used in other places but the class is just used as a format specifier - mostly in tests. If we get rid of all instances there won't be the same pydantic type safety / standardization (if that becomes something that needs to be tested / guaranteed later).

But for now, yes can get rid of most of this code - but will need to get rid of some tests as well (like in test_prompt_formats and format specifiers in server_models.py (part of LLMConfig) (which could break some tests but is fixable).

Will review and see what else could be cleaned up.

Copy link
Copy Markdown
Contributor

@kouroshHakha kouroshHakha Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes all of those can be deleted. the tests also need clean up.

nrghosh and others added 2 commits June 6, 2025 18:01
@nrghosh nrghosh force-pushed the delete_abstraction branch from 8178cc0 to 060161c Compare June 9, 2025 23:39
Copy link
Copy Markdown
Contributor

@kouroshHakha kouroshHakha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great. just some nits:


from ray.llm._internal.utils import try_import

if TYPE_CHECKING:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete TYPE_CHECKING?

)
except OSError:
pass
# Note (Nikhil): prompt_format functionality has been removed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need to keep this note as it won't make sense anymore.

nrghosh and others added 2 commits June 10, 2025 00:24
Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
@nrghosh nrghosh requested a review from kouroshHakha June 10, 2025 07:33
@kouroshHakha kouroshHakha merged commit 6c3dfaf into ray-project:master Jun 10, 2025
5 checks passed
@nrghosh nrghosh deleted the delete_abstraction branch June 10, 2025 18:05
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants