RichardErkhov commited on
Commit
7f155cc
·
verified ·
1 Parent(s): 0b63fdf

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +99 -0
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ semcoder_s_1030 - bnb 8bits
11
+ - Model creator: https://huggingface.co/semcoder/
12
+ - Original model: https://huggingface.co/semcoder/semcoder_s_1030/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ license: other
20
+ library_name: transformers
21
+ license_name: deepseek
22
+ license_link: https://github.com/deepseek-ai/DeepSeek-Coder/blob/main/LICENSE-MODEL
23
+ pipeline_tag: text-generation
24
+ ---
25
+ # 🤔 SemCoder: Training Code Language Models with Comprehensive Semantics Reasoning
26
+
27
+ > Refer to our GitHub repo [ARiSE-Lab/SemCoder](https://github.com/ARiSE-Lab/SemCoder/) for detailed introduction to SemCoder!
28
+
29
+ ## Model Details
30
+
31
+
32
+ Use the code below to get started with the model. Make sure you installed the [transformers](https://huggingface.co/docs/transformers/index) library.
33
+
34
+ ```python
35
+ from transformers import pipeline
36
+ import torch
37
+
38
+ generator = pipeline(
39
+ model="semcoder/semcoder_s_1030",
40
+ task="text-generation",
41
+ torch_dtype=torch.float16,
42
+ device_map="auto",
43
+ )
44
+
45
+ # Generate Code
46
+
47
+ CODEGEN_REQUEST = """You are an exceptionally intelligent coding assistant that consistently delivers accurate and reliable <Code> according to <NL_Description>
48
+
49
+ <NL_Description>
50
+ {desc}
51
+
52
+ <Code>
53
+ """
54
+ desc = """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:
55
+ 1. Add a new task to the to-do list.
56
+ 2. Mark a task as completed.
57
+ 3. Display all tasks in the to-do list.
58
+ 4. Display only the incomplete tasks in the to-do list.
59
+ """
60
+
61
+ prompt = CODEGEN_REQUEST.format(desc=desc)
62
+ result = generator(prompt, max_length=2048, num_return_sequences=1, temperature=0.0)
63
+ code = result[0]["generated_text"].split("```python")[1].split("```")[0]
64
+ print(code)
65
+
66
+ # Understand Code with Monologues
67
+
68
+ FWD_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.
69
+ {code}
70
+ """
71
+
72
+ tests = """
73
+ todo_list = ToDoList()
74
+ todo_list.add_task("Buy groceries")
75
+ todo_list.add_task("Complete assignment")
76
+ todo_list.mark_completed("Buy groceries")
77
+ assert todo_list.tasks == ???
78
+ """
79
+ code += tests
80
+ prompt = FWD_MNL_REQUEST.format(code=code)
81
+ result = generator(prompt, max_length=2048, num_return_sequences=1, temperature=0.0)
82
+ print(result[0]["generated_text"])
83
+ ```
84
+
85
+ ## Citation
86
+
87
+ ```bibtex
88
+ @article{ding2024semcoder,
89
+ title={SemCoder: Training Code Language Models with Comprehensive Semantics},
90
+ author={Yangruibo Ding and Jinjun Peng and Marcus J. Min and Gail Kaiser and Junfeng Yang and Baishakhi Ray},
91
+ journal={arXiv preprint arXiv:2406.01006},
92
+ year={2024}
93
+ }
94
+ ```
95
+
96
+ ## Important Note
97
+
98
+ SemCoder models are trained on the synthetic data generated by OpenAI models. Please pay attention to OpenAI's [terms of use](https://openai.com/policies/terms-of-use) when using the models and the datasets. SemCoder will not compete with OpenAI's commercial products.
99
+