Skip to content

Commit

Permalink
refactor: extract api for inter reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 4, 2024
1 parent 28fc827 commit 39f0274
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,32 @@
</a>
</p>

> UnitGen 是一个代码微调的数据框架,可以直接从你的代码库中生成微调数据:代码补全、测试生成、文档生成等。
> UnitGen 是一个用于生成微调代码的数据框架 —— 直接从你的代码库中生成微调数据:代码补全、测试生成、文档生成等。
Docs: [https://gen.unitmesh.cc/](https://gen.unitmesh.cc/)

Thanks to [OpenBayes](https://openbayes.com/console/signup?r=phodal_uVxU) for providing computing resources.

Examples:
Finetune Model Examples:

| name | model download (HuggingFace) | finetune Notebook | model download (OpenBayes) |
|---------------|---------------------------------------------------------------------------|--------------------------------------|-------------------------------------------------------------------------------------|
| DeepSeek 6.7B | [unit-mesh/autodev-coder](https://huggingface.co/unit-mesh/autodev-coder) | [finetune.ipynb](finetunes/deepseek) | [AutoDev Coder](https://openbayes.com/console/phodal/models/rCmer1KQSgp/9/overview) |
| CodeGeeX2 6B | TODO | TODO |

Language support by [Chapi](https://github.com/phodal/chapi)

- supported:
- [x] Java
- [x] Kotlin
- doing:
- [x] TypeScript/JavaScript
- [x] Rust
- future:
- [ ] Go
- [ ] Python
- [ ] C/C++
- [ ] C#
- [ ] Scala

Features:

Expand Down
33 changes: 30 additions & 3 deletions docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,43 @@ permalink: /
<a href="https://central.sonatype.com/artifact/cc.unitmesh/unit-picker">
<img src="https://img.shields.io/maven-central/v/cc.unitmesh/unit-picker" alt="Maven"/>
</a>
<a href="https://openbayes.com/console/signup?r=phodal_uVxU">
<img src="https://openbayes.com/img/badge-open-in-openbayes.svg" alt="Open In OpenBayes" />
</a>
<a href="https://openbayes.com/console/signup?r=phodal_uVxU">
<img src="https://openbayes.com/img/badge-built-with-openbayes.svg" alt="Built with OpenBayes" />
</a>
<a href="https://codecov.io/gh/unit-mesh/unit-gen">
<img src="https://codecov.io/gh/unit-mesh/unit-gen/branch/master/graph/badge.svg?token=nt22RX52DV" alt="codecov" />
</a>
</p>

> UnitGen 是一个代码微调的数据框架,可以直接从你的代码库中生成微调数据:代码补全、测试生成、文档生成等。
> UnitGen 是一个用于生成微调代码的数据框架 —— 直接从你的代码库中生成微调数据:代码补全、测试生成、文档生成等。
Examples:
Docs: [https://gen.unitmesh.cc/](https://gen.unitmesh.cc/)

Thanks to [OpenBayes](https://openbayes.com/console/signup?r=phodal_uVxU) for providing computing resources.

Finetune Model Examples:

| name | model download (HuggingFace) | finetune Notebook | model download (OpenBayes) |
|---------------|---------------------------------------------------------------------------|--------------------------------------|-------------------------------------------------------------------------------------|
| DeepSeek 6.7B | [unit-mesh/autodev-coder](https://huggingface.co/unit-mesh/autodev-coder) | [finetune.ipynb](finetunes/deepseek) | [AutoDev Coder](https://openbayes.com/console/phodal/models/rCmer1KQSgp/9/overview) |
| CodeGeeX2 6B | TODO | TODO |

Language support by [Chapi](https://github.com/phodal/chapi)

- supported:
- [x] Java
- [x] Kotlin
- doing:
- [x] TypeScript/JavaScript
- [x] Rust
- future:
- [ ] Go
- [ ] Python
- [ ] C/C++
- [ ] C#
- [ ] Scala

Features:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ class SingleProjectCodePicker(private val config: InsPickerOption) {
val checkoutCode = GitUtil.checkoutCode(config.url, config.branch, tempGitDir, config.gitDepth)
val codeDir = checkoutCode.toFile().canonicalFile

return@coroutineScope execute(codeDir)
}

/**
* Executes the given code directory.
*
* This method walks through the specified code directory and performs the necessary operations to execute the code.
* It initializes a language worker and a worker manager based on the specified language in the configuration.
* The code directory and language are used to initialize the worker manager.
*
* @param codeDir The directory containing the code to be executed.
* @return A mutable list of instructions representing the execution steps.
* @throws IllegalArgumentException if the specified language is not supported.
*/
suspend fun execute(codeDir: File): MutableList<Instruction> {
logger.info("start walk $codeDir")

val languageWorker = LanguageWorker()
Expand All @@ -76,7 +91,7 @@ class SingleProjectCodePicker(private val config: InsPickerOption) {
val workerManager = WorkerManager(WorkerContext.fromConfig(language, config))
workerManager.init(codeDir, language)

return@coroutineScope instructions(codeDir, languageWorker, workerManager, language)
return instructions(codeDir, languageWorker, workerManager, language)
}

/**
Expand Down

0 comments on commit 39f0274

Please sign in to comment.