Views
No views yet
scaled_dot_product_attention (vLLM compatible)pip install transformers tokenizers torch1import torch
2from transformers import AutoModelForCausalLM, AutoConfig
3from tokenizers import Tokenizer
4from huggingface_hub import hf_hub_download
5
6# Load model
7model = AutoModelForCausalLM.from_pretrained(
8 "TanishqV03/easysellhfvllm",
9 trust_remote_code=True,
10)
11model.eval()
12
13# Load tokenizer
14tok_path = hf_hub_download("TanishqV03/easysellhfvllm", "tokenizer.json")
15tokenizer = Tokenizer.from_file(tok_path)
16EOS_ID = tokenizer.token_to_id("[EOS]")
17
18# Run inference
19prompt = "i want bag pack"
20ids = tokenizer.encode("[BOS] " + prompt).ids
21x = torch.tensor([ids])
22gen = model.generate_tool_call(x, eos_token_id=EOS_ID)
23print(tokenizer.decode(gen))
24# → {"tool": "add_to_cart_tool", "parameters": {"product": "bag pack", "quantity": 1}}| Tool | Fires when |
|---|---|
search_catalog_by_text_tool | Product search, availability checks |
add_to_cart_tool | Buy / add any product |
get_checkout_link_tool | Checkout, pay now |
get_instant_checkout_link_tool | Instant buy / direct purchase |
list_all_products_tool | Show catalog |
update_order_address_tool | Change delivery address |
view_cart_tool | Show cart |
update_cart_item_tool | Change cart item quantity |
remove_from_cart_tool | Remove specific cart item |
clear_cart_tool | Empty entire cart |
clear_out_of_stock_items_tool | Remove unavailable items |
get_order_status_tool | Order tracking |
"mujhe shawl chahiye" → add_to_cart_tool"cart dikhao" → view_cart_tool"mobile ki link bhejo" → search_catalog_by_text_tool1from vllm import LLM
2llm = LLM(model="TanishqV03/easysellhfvllm", trust_remote_code=True)