Views
No views yet
create_cell - Create new cellsupdate_cell - Update cell contentdelete_cell - Delete cellsget_cell_content - Read cell contentget_notebook_content - Get full notebookexecute_cell - Execute code cellsget_cell_output - Get cell outputanalyze_image - Analyze plots/imagesread_file - Read fileswrite_file - Write fileslist_directory - List directoriescreate_notebook - Create notebooksdelete_file - Delete filesrename_file - Rename/move filesrun_shell - Execute shell commandsfind_in_notebook - Search in notebookreplace_in_cell - Replace text in cellsinstall_package - Install Python packageslist_packages - List installed packages1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4# Load base model
5base_model = AutoModelForCausalLM.from_pretrained(
6 "Qwen/Qwen2.5-Coder-1.5B-Instruct",
7 device_map="cuda",
8 torch_dtype=torch.float16,
9)
10tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct")
11
12# Load LoRA adapters
13model = PeftModel.from_pretrained(base_model, "coconut495/qwen2.5-coder-1.5b-cellsistant-tool-calling")
14
15# Generate tool calls
16prompt = '''<|im_start|>system
17You are a helpful assistant with access to the following tools:
18[{"type": "function", "function": {"name": "create_cell", ...}}]
19<|im_end|>
20<|im_start|>user
21Add a code cell that prints hello<|im_end|>
22<|im_start|>assistant
23'''
24
25inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
26outputs = model.generate(**inputs, max_new_tokens=64, use_cache=False)
27print(tokenizer.decode(outputs[0], skip_special_tokens=True))| Parameter | Value |
|---|---|
| Epochs | 1 |
| Batch Size | 2 |
| Gradient Accumulation | 4 |
| Learning Rate | 2e-4 |
| LoRA Rank (r) | 16 |
| LoRA Alpha | 16 |
| Max Sequence Length | 4096 |
| Trainable Parameters | 18.5M (1.18%) |