Downloads · 30 days
8
20% of all-time downloads
lurepaper/LURE_5.2
LURE_5.2 is a machine learning model from lurepaper. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Downloads · 30 days
8
20% of all-time downloads
All-time downloads
41
Public
Parameters
32.8B
65.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors65.5 GB · 100%
From the Hugging Face model README
This is the LURE model for Lua 5.2.
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "lurepaper/LURE_5.2"
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained(model_id)
prompt = "You are a Lua programming language expert. Please generate generate concise Lua code that produces the Lua 5.2 opcode OP_ADD. Use a print function call at the end to show the execution result of the opcode."
messages = [
{"role": "user", "content": prompt},
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768,
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
# parsing thinking content
try:
# rindex finding 151668 (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("Thinking content:")
print(thinking_content)
print("Generated LuaGadget:")
print(content)