Views
No views yet
version 0.32 - 2026-02-21 01:24:19 UTC
(retraining
source-code |
pipeline-card)
retrain-pipelines/func_calls_ds v0.31
(70f9a28 -
2026-02-20 18:34:18 UTC)
unsloth/Qwen2.5-1.5B
(1582479 -
2025-04-28 04:13:37 UTC)
[object Object]1from transformers import AutoModelForCausalLM, AutoTokenizer
2from torch import device, cuda
3
4repo_id = "retrain-pipelines/function_caller_lora"
5revision = "<model_revision_commit_hash>"
6model = AutoModelForCausalLM.from_pretrained(
7 repo_id, revision=revision, torch_dtype="auto", device_map="auto")
8tokenizer = AutoTokenizer.from_pretrained(
9 repo_id, revision=revision, torch_dtype="auto", device_map="auto")
10
11device = device("cuda" if cuda.is_available() else "cpu")
12def generate_tool_calls_list(query, max_new_tokens=400) -> str:
13 formatted_query = tokenizer.chat_template.format(query, "")
14 inputs = tokenizer(formatted_query, return_tensors="pt").input_ids.to(device)
15 outputs = model.generate(inputs, max_new_tokens=max_new_tokens, do_sample=False)
16 generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
17 return generated_text[len(formatted_query):].strip()
18
19generate_tool_calls_list("Is 49 a perfect square ?")[object Object] -
Run by [object Object] -
UnslothFuncCallFlow - exec_id : 135