Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| semcoder_1030.Q2_K.gguf | Q2_K | 2.36GB |
| semcoder_1030.IQ3_XS.gguf | IQ3_XS | 2.61GB |
| semcoder_1030.IQ3_S.gguf | IQ3_S | 2.75GB |
| semcoder_1030.Q3_K_S.gguf | Q3_K_S | 2.75GB |
| semcoder_1030.IQ3_M.gguf | IQ3_M | 2.9GB |
| semcoder_1030.Q3_K.gguf | Q3_K | 3.07GB |
| semcoder_1030.Q3_K_M.gguf | Q3_K_M | 3.07GB |
| semcoder_1030.Q3_K_L.gguf | Q3_K_L | 3.35GB |
| semcoder_1030.IQ4_XS.gguf | IQ4_XS | 3.4GB |
| semcoder_1030.Q4_0.gguf | Q4_0 | 3.56GB |
| semcoder_1030.IQ4_NL.gguf | IQ4_NL | 3.59GB |
| semcoder_1030.Q4_K_S.gguf | Q4_K_S | 3.59GB |
| semcoder_1030.Q4_K.gguf | Q4_K | 3.8GB |
| semcoder_1030.Q4_K_M.gguf | Q4_K_M | 3.8GB |
| semcoder_1030.Q4_1.gguf | Q4_1 | 3.95GB |
| semcoder_1030.Q5_0.gguf | Q5_0 | 4.33GB |
| semcoder_1030.Q5_K_S.gguf | Q5_K_S | 4.33GB |
| semcoder_1030.Q5_K.gguf | Q5_K | 4.46GB |
| semcoder_1030.Q5_K_M.gguf | Q5_K_M | 4.46GB |
| semcoder_1030.Q5_1.gguf | Q5_1 | 4.72GB |
| semcoder_1030.Q6_K.gguf | Q6_K | 5.15GB |
| semcoder_1030.Q8_0.gguf | Q8_0 | 6.67GB |
Refer to our GitHub repo ARiSE-Lab/SemCoder for detailed introduction to SemCoder!
1from transformers import pipeline
2import torch
3
4generator = pipeline(
5 model="semcoder/semcoder_1030",
6 task="text-generation",
7 torch_dtype=torch.float16,
8 device_map="auto",
9)
10
11# Generate Code
12
13CODEGEN_REQUEST = """You are an exceptionally intelligent coding assistant that consistently delivers accurate and reliable <Code> according to <NL_Description>
14
15<NL_Description>
16{desc}
17
18<Code>
19"""
20desc = """You are tasked with implementing a Python class that simulates a simple version of a "To-Do List" application. The class should have the following functionalities:
211. Add a new task to the to-do list.
222. Mark a task as completed.
233. Display all tasks in the to-do list.
244. Display only the incomplete tasks in the to-do list.
25"""
26
27prompt = CODEGEN_REQUEST.format(desc=desc)
28result = generator(prompt, max_length=2048, num_return_sequences=1, temperature=0.0)
29code = result[0]["generated_text"].split("```python")[1].split("```")[0]
30print(code)
31
32# Understand Code with Monologues
33
34FWD_MNL_REQUEST = """Simulate the Execution: You are given a Python function and an assertion containing a function input. Complete the assertion containing the execution output corresponding to the given input in [ANSWER] and [/ANSWER] tags.
35{code}
36"""
37
38tests = """
39todo_list = ToDoList()
40todo_list.add_task("Buy groceries")
41todo_list.add_task("Complete assignment")
42todo_list.mark_completed("Buy groceries")
43assert todo_list.tasks == ???
44"""
45code += tests
46prompt = FWD_MNL_REQUEST.format(code=code)
47result = generator(prompt, max_length=2048, num_return_sequences=1, temperature=0.0)
48print(result[0]["generated_text"])1@article{ding2024semcoder,
2 title={SemCoder: Training Code Language Models with Comprehensive Semantics},
3 author={Yangruibo Ding and Jinjun Peng and Marcus J. Min and Gail Kaiser and Junfeng Yang and Baishakhi Ray},
4 journal={arXiv preprint arXiv:2406.01006},
5 year={2024}
6}