Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot access local variable #61

Open
kaosbeat opened this issue Jun 5, 2024 · 0 comments
Open

cannot access local variable #61

kaosbeat opened this issue Jun 5, 2024 · 0 comments

Comments

@kaosbeat
Copy link

kaosbeat commented Jun 5, 2024

I'm using a local openAI endpoint (using meta-llama-3-70b-instruct.Q4_K_M.gguf)
To use the local endpoint, I edited line 37 in lib/openai/__init__.py
api_base = os.environ.get("OPENAI_API_BASE", "http://localhost:5001/v1")
no other edits

When using the addon I get
Error executing generated code: cannot access local variable 'global_namespace' where it is not associated with a value

image

The generated code is correct though, if I copy-paste in the script editor, output is as expected.
eg. this is what happens in my endpoint:


Input: {"model": "gpt-4", "messages": [{"role": "system", "content": "You are an assistant made for the purposes of helping the user with Blender, the 3D software. \n- Respond with your answers in markdown (```). \n- Preferably import entire modules instead of bits. \n- Do not perform destructive operations on the meshes. \n- Do not use cap_ends. Do not do more than what is asked (setting up render settings, adding cameras, etc)\n- Do not respond with anything that is not Python code.\n\nExample:\n\nuser: create 10 cubes in random locations from -10 to 10\nassistant:\n```\nimport bpy\nimport random\nbpy.ops.mesh.primitive_cube_add()\n\n#how many cubes you want to add\ncount = 10\n\nfor c in range(0,count):\n    x = random.randint(-10,10)\n    y = random.randint(-10,10)\n    z = random.randint(-10,10)\n    bpy.ops.mesh.primitive_cube_add(location=(x,y,z))\n```"}, {"role": "user", "content": "Can you please write Blender code for me that accomplishes the following task: generate 10 random sized cubes? \n. Do not respond with anything that is not Python code. Do not provide explanations"}], "stream": true, "max_tokens": 1500}

Processing Prompt (28 / 28 tokens)
Generating (83 / 1500 tokens)
(EOS token triggered!)
CtxLimit: 346/2048, Process:3.47s (124.0ms/T = 8.07T/s), Generate:74.91s (902.6ms/T = 1.11T/s), Total:78.39s (1.06T/s)
Output: ```python
import bpy
import random

for _ in range(10):
    bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0))
    cube = bpy.context.object
    scale = (random.uniform(0.1, 2), random.uniform(0.1, 2), random.uniform(0.1, 2))
    cube.scale = scale

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant