You can use this model with the Hugging Face transformers library.
python
1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
23model_id ="luzimu/WebGen-LM-7B"# This model card refers to WebGen-LM-7B45tokenizer = AutoTokenizer.from_pretrained(model_id)6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")78# Example for website generation9user_prompt ="Generate a simple HTML page with a heading 'Hello, World!' and a paragraph of lorem ipsum text."10messages =[11{"role":"user","content": user_prompt}12]1314# Apply chat template for instruction-following format15text_input = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)1617# Generate output18model_inputs = tokenizer(text_input, return_tensors="pt").to(model.device)19generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=500, do_sample=True, temperature=0.01, top_k=50, top_p=0.95)2021# Decode and print the generated code22generated_text = tokenizer.decode(generated_ids[0], skip_special_tokens=True)23print(generated_text)2425# Example using Hugging Face pipeline for simpler inference26generator = pipeline("text-generation", model=model, tokenizer=tokenizer)27result = generator(user_prompt, max_new_tokens=500, do_sample=True, temperature=0.01, top_k=50, top_p=0.95)28print(result[0]['generated_text'])
Citation
If you find our project useful, please cite:
@misc{lu2025webgenbenchevaluatingllmsgenerating,
title={WebGen-Bench: Evaluating LLMs on Generating Interactive and Functional Websites from Scratch},
author={Zimu Lu and Yunqiao Yang and Houxing Ren and Haotian Hou and Han Xiao and Ke Wang and Weikang Shi and Aojun Zhou and Mingjie Zhan and Hongsheng Li},
year={2025},
eprint={2505.03733},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2505.03733},
}
@misc{lu2025webgenagentenhancinginteractivewebsite,
title={WebGen-Agent: Enhancing Interactive Website Generation with Multi-Level Feedback and Step-Level Reinforcement Learning},
author={Zimu Lu and Houxing Ren and Yunqiao Yang and Ke Wang and Zhuofan Zong and Junting Pan and Mingjie Zhan and Hongsheng Li},
year={2025},
eprint={2509.22644},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2509.22644},
}