luzimu nielsr HF Staff commited on
Commit
f28bd42
·
verified ·
1 Parent(s): 3f49360

Improve model card: Add project page, tags, and sample usage (#2)

Browse files

- Improve model card: Add project page, tags, and sample usage (6bd771919f05b8bf356b129b8cd2bdf06a06634d)


Co-authored-by: Niels Rogge <[email protected]>

Files changed (1) hide show
  1. README.md +48 -3
README.md CHANGED
@@ -5,17 +5,20 @@ datasets:
5
  - luzimu/WebGen-Bench
6
  language:
7
  - en
 
8
  license: mit
9
  metrics:
10
  - accuracy
11
- library_name: transformers
12
  pipeline_tag: text-generation
 
 
13
  ---
14
 
15
  # WebGen-LM
16
 
17
  WebGen-LM is trained using the Bolt.diy trajectories generated from a subset of the training set of WebGen-Bench (🤗 [luzimu/WebGen-Bench](https://huggingface.co/datasets/luzimu/WebGen-Bench)). It has been introduced in the paper [WebGen-Bench: Evaluating LLMs on Generating Interactive and Functional Websites from Scratch](https://arxiv.org/abs/2505.03733).
18
 
 
19
  The training data and code can be found at [WebGen-Bench (Github)](https://github.com/mnluzimu/WebGen-Bench).
20
 
21
  The WebGen-LM family of models are as follows:
@@ -26,11 +29,52 @@ The WebGen-LM family of models are as follows:
26
  |WebGen-LM-14B | 🤗 [luzimu/WebGen-LM-14B](https://huggingface.co/luzimu/WebGen-LM-14B) |
27
  |WebGen-LM-32B | 🤗 [luzimu/WebGen-LM-32B](https://huggingface.co/luzimu/WebGen-LM-32B) |
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ## Performance on WebGen-Bench
30
 
31
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64b0bfef2f2f9c345b87e673/ADt1JdvKw-IZ_xnS17adL.png)
32
 
33
-
34
  ## Citation
35
 
36
  If you find our project useful, please cite:
@@ -44,4 +88,5 @@ If you find our project useful, please cite:
44
  archivePrefix={arXiv},
45
  primaryClass={cs.CL},
46
  url={https://arxiv.org/abs/2505.03733},
47
- }
 
 
5
  - luzimu/WebGen-Bench
6
  language:
7
  - en
8
+ library_name: transformers
9
  license: mit
10
  metrics:
11
  - accuracy
 
12
  pipeline_tag: text-generation
13
+ tags:
14
+ - code-generation
15
  ---
16
 
17
  # WebGen-LM
18
 
19
  WebGen-LM is trained using the Bolt.diy trajectories generated from a subset of the training set of WebGen-Bench (🤗 [luzimu/WebGen-Bench](https://huggingface.co/datasets/luzimu/WebGen-Bench)). It has been introduced in the paper [WebGen-Bench: Evaluating LLMs on Generating Interactive and Functional Websites from Scratch](https://arxiv.org/abs/2505.03733).
20
 
21
+ Project page: https://webgen-bench.github.io/
22
  The training data and code can be found at [WebGen-Bench (Github)](https://github.com/mnluzimu/WebGen-Bench).
23
 
24
  The WebGen-LM family of models are as follows:
 
29
  |WebGen-LM-14B | 🤗 [luzimu/WebGen-LM-14B](https://huggingface.co/luzimu/WebGen-LM-14B) |
30
  |WebGen-LM-32B | 🤗 [luzimu/WebGen-LM-32B](https://huggingface.co/luzimu/WebGen-LM-32B) |
31
 
32
+ ## Sample Usage
33
+
34
+ You can use this model with the `transformers` library for text generation tasks, specifically for code generation based on instructions.
35
+
36
+ ```python
37
+ from transformers import AutoModelForCausalLM, AutoTokenizer
38
+ import torch
39
+
40
+ model_id = "luzimu/WebGen-LM-32B"
41
+
42
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
43
+ model = AutoModelForCausalLM.from_pretrained(
44
+ model_id,
45
+ torch_dtype=torch.bfloat16,
46
+ device_map="auto"
47
+ )
48
+
49
+ messages = [
50
+ {"role": "user", "content": "Write HTML, CSS, and JavaScript for a simple to-do list web application. The list should allow users to add and remove items."},
51
+ ]
52
+
53
+ chat_input = tokenizer.apply_chat_template(
54
+ messages,
55
+ tokenize=False,
56
+ add_generation_prompt=True
57
+ )
58
+
59
+ model_inputs = tokenizer([chat_input], return_tensors="pt").to(model.device)
60
+
61
+ generated_ids = model.generate(
62
+ model_inputs.input_ids,
63
+ max_new_tokens=2048,
64
+ do_sample=True,
65
+ temperature=0.7,
66
+ top_p=0.95
67
+ )
68
+
69
+ # Decode only the newly generated tokens
70
+ output_text = tokenizer.decode(generated_ids[0][model_inputs.input_ids.shape[1]:], skip_special_tokens=False)
71
+ print(output_text)
72
+ ```
73
+
74
  ## Performance on WebGen-Bench
75
 
76
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64b0bfef2f2f9c345b87e673/ADt1JdvKw-IZ_xnS17adL.png)
77
 
 
78
  ## Citation
79
 
80
  If you find our project useful, please cite:
 
88
  archivePrefix={arXiv},
89
  primaryClass={cs.CL},
90
  url={https://arxiv.org/abs/2505.03733},
91
+ }
92
+ ```