Views
No views yet
1{
2 "reflection": "string - thoughts about previous actions and current situation",
3 "rationale": "string - reasoning for the current action",
4 "action_name": "string - one of: north, south, east, west, pick, drop",
5 "action_parameters": {},
6 "message": "string - message to other agents (optional)",
7 "add_memory": "string - information to remember for future steps"
8}1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load model and tokenizer
5tokenizer = AutoTokenizer.from_pretrained("aarontamte/LLama3.1-8B-cooperative-agent-finetune")
6model = AutoModelForCausalLM.from_pretrained(
7 "aarontamte/LLama3.1-8B-cooperative-agent-finetune",
8 torch_dtype=torch.bfloat16,
9 device_map="auto"
10)
11
12# Prepare input
13prompt = "What is the capital of France?"
14inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
15
16# Generate response
17outputs = model.generate(
18 **inputs,
19 max_new_tokens=512,
20 temperature=0.7,
21 top_p=0.9,
22 do_sample=True
23)
24
25# Decode response
26response = tokenizer.decode(outputs[0], skip_special_tokens=True)
27print(response)pip install torch transformers