dspy icon indicating copy to clipboard operation
dspy copied to clipboard

added support for vLLM server and docs for local models

Open arnavsinghvi11 opened this issue 1 year ago • 3 comments

-updated DSPy init with vLLM support -added vLLM to hf_client -added docs for local model testing with HFModel, TGI, vLLM, and MLC -added model initialization validation for HFClientTGI within latest changes

arnavsinghvi11 avatar Aug 23 '23 15:08 arnavsinghvi11

Any news on the state of this PR? Support for vLLM would be super.

andreapiso avatar Oct 14 '23 03:10 andreapiso

I think this is especially misleading because VLLM support is already in the documentation, but the relevant HFClientVLLM class is only defined in this unmerged PR

meditans avatar Nov 20 '23 13:11 meditans

This can now be closed but we'll need a new PR with just these bits:

        self._verify_model_with_server()
        self.kwargs = {
            "temperature": 0.1,
            "max_tokens": 75,
	@@ -42,6 +42,17 @@ def __init__(self, model, port, url="http://future-hgx-1", **kwargs):
            **kwargs,
        }

    def _verify_model_with_server(self):
        try:
            response = requests.get(f"{self.url}/info")
            response_json = response.json()
            server_model = response_json.get('model_id', '')
            if server_model != self.model:
                raise ValueError(f"Model mismatch. Client model: {self.model}, Server model: {server_model}")
        except Exception as e:
            print(f"Failed to verify model with server: {e}")
            raise

cc: @arnavsinghvi11

okhat avatar Nov 24 '23 19:11 okhat

I'm happily using vllm via

import dspy lm = dspy.HFClientVLLM(model="mistralai/Mistral-7B-Instruct-v0.2", port=8000, url="http://192.168.88.192") dspy.settings.configure(lm=lm)

chris-aeviator avatar Jan 14 '24 14:01 chris-aeviator