Views
No views yet
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "NexaAIDev/octopus-planning"
5model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7
8question = "Find my presentation for tomorrow's meeting, connect to the conference room projector via Bluetooth, increase the screen brightness, take a screenshot of the final summary slide, and email it to all participants"
9inputs = f"<|user|>{question}<|end|><|assistant|>"
10input_ids = tokenizer(inputs, return_tensors="pt").to(model.device)
11outputs = model.generate(
12 input_ids=input_ids["input_ids"],
13 max_length=1024,
14 do_sample=False)
15res = tokenizer.decode(outputs.tolist()[0])
16print(f"=== inference result ===\n{res}")def send_email(recipient, title, content):
"""
Sends an email to a specified recipient with a given title and content.
Parameters:
- recipient (str): The email address of the recipient.
- title (str): The subject line of the email. This is a brief summary or title of the email's purpose or content.
- content (str): The main body text of the email. It contains the primary message, information, or content that is intended to be communicated to the recipient.
"""@article{chen2024octoplannerondevicelanguagemodel,
title={Octo-planner: On-device Language Model for Planner-Action Agents},
author={Wei Chen and Zhiyuan Li and Zhen Guo and Yikang Shen},
year={2024},
eprint={2406.18082},
url={https://arxiv.org/abs/2406.18082},
}