return_tensors='pt').to(device) for s in self.stop]    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs):        for i, s in enumerate(self.stop_ids):            if torch.all((s == input_ids[0][-s.shape[1]:])).item():                self.matched = self.stop[i]                return True        return Falsedef llm(prompt, stop=None, **kwargs):  check_stop = CheckStop(stop)  result = dolly(prompt, stopping_criteria=[check_stop], **kwargs)  return result[0]["generated_text"].rstrip(check_stop.matched)app = Flask("dolly")@app.route('/', methods=['POST'])def serve_llm():  resp = llm(**request.json)  return jsonify(resp)app.run(host="0.0.0.0", port="7777")Once the server is running, you can create a Databricks instance to wrap it as an LLM.# If running a Databricks notebook attached to the same cluster that runs the app,# you only need to specify the driver port to create a `Databricks` instance.llm = Databricks(cluster_driver_port="7777")llm("How are you?")    'Hello, thank you for asking. It is wonderful to hear that you are well.'# Otherwise, you can manually specify the cluster ID to use,# as well as Databricks workspace hostname and personal access token.llm = Databricks(cluster_id="0000-000000-xxxxxxxx", cluster_driver_port="7777")llm("How are you?")    'I am well. You?'# If the app accepts extra parameters like `temperature`,# you can set them in `model_kwargs`.llm = Databricks(cluster_driver_port="7777", model_kwargs={"temperature": 0.1})llm("How are you?")    'I am very well. It is a pleasure to meet you.'# Use `transform_input_fn` and `transform_output_fn` if the app# expects a different input schema and does not return a JSON string,# respectively, or you want to apply a prompt template on top.def transform_input(**request):    full_prompt = f"""{request["prompt"]}    Be Concise.    """    request["prompt"] = full_prompt    return requestdef transform_output(response):    return response.upper()llm = Databricks(
The Databricks Lakehouse Platform unifies data, analytics, and AI on one platform.
The Databricks Lakehouse Platform unifies data, analytics, and AI on one platform. ->: return_tensors='pt').to(device) for s in self.stop]    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs):        for i, s in enumerate(self.stop_ids):            if torch.all((s == input_ids[0][-s.shape[1]:])).item():                self.matched = self.stop[i]                return True        return Falsedef llm(prompt, stop=None, **kwargs):  check_stop = CheckStop(stop)  result = dolly(prompt, stopping_criteria=[check_stop], **kwargs)  return result[0]["generated_text"].rstrip(check_stop.matched)app = Flask("dolly")@app.route('/', methods=['POST'])def serve_llm():  resp = llm(**request.json)  return jsonify(resp)app.run(host="0.0.0.0", port="7777")Once the server is running, you can create a Databricks instance to wrap it as an LLM.# If running a Databricks notebook attached to the same cluster that runs the app,# you only need to specify the driver port to create a `Databricks` instance.llm = Databricks(cluster_driver_port="7777")llm("How are you?")    'Hello, thank you for asking. It is wonderful to hear that you are well.'# Otherwise, you can manually specify the cluster ID to use,# as well as Databricks workspace hostname and personal access token.llm = Databricks(cluster_id="0000-000000-xxxxxxxx", cluster_driver_port="7777")llm("How are you?")    'I am well. You?'# If the app accepts extra parameters like `temperature`,# you can set them in `model_kwargs`.llm = Databricks(cluster_driver_port="7777", model_kwargs={"temperature": 0.1})llm("How are you?")    'I am very well. It is a pleasure to meet you.'# Use `transform_input_fn` and `transform_output_fn` if the app# expects a different input schema and does not return a JSON string,# respectively, or you want to apply a prompt template on top.def transform_input(**request):    full_prompt = f"""{request["prompt"]}    Be Concise.    """    request["prompt"] = full_prompt    return requestdef transform_output(response):    return response.upper()llm = Databricks(