Skip to content

Commit

Permalink
0 6 5 (#52)
Browse files Browse the repository at this point in the history
* feat: remove sophon as default in 0_6_5

* feat: comment sophon doc in README

* feat: comment sophon workflow
  • Loading branch information
meloalright authored Nov 7, 2024
1 parent fe163ef commit fa2a7d5
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 64 deletions.
62 changes: 31 additions & 31 deletions .github/workflows/Sophon.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: sophon reasoning

on:
push:
branches:
- '*'
pull_request:
branches:
- main

jobs:
reasoning:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true

- name: Repl
run: |
cargo build --features="repl" --release
- name: LLama
run: |
./target/release/3body -V
git clone https://huggingface.co/huantian2415/vicuna-13b-chinese-4bit-ggml
./target/release/3body -c 'let 智子 = fn () { let instance = 智子工程({ "type": "llama", "path": "./vicuna-13b-chinese-4bit-ggml/Vicuna-13B-chinese.bin", "prompt": "你是三体文明的智子" }); return { "回答": fn (问题) { instance.infer(instance, 问题) } } }(); 智子.回答("中国最佳科幻小说是哪个")'
#name: sophon reasoning
#
#on:
# push:
# branches:
## - '*'
# pull_request:
# branches:
## - main
#
#jobs:
# reasoning:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# components: clippy
# override: true
#
# - name: Repl
# run: |
# cargo build --features="repl" --release
#
# - name: LLama
# run: |
# ./target/release/3body -V
# git clone https://huggingface.co/huantian2415/vicuna-13b-chinese-4bit-ggml
# ./target/release/3body -c 'let 智子 = fn () { let instance = 智子工程({ "type": "llama", "path": "./vicuna-13b-chinese-4bit-ggml/Vicuna-13B-chinese.bin", "prompt": "你是三体文明的智子" }); return { "回答": fn (问题) { instance.infer(instance, 问题) } } }(); 智子.回答("中国最佳科幻小说是哪个")'
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "three_body_lang"
description = "Three Body Language written in Rust"
edition = "2021"
version = "0.6.4"
version = "0.6.5"
authors = ["meloalright", "rustq"]
license = "MIT"

Expand All @@ -12,7 +12,7 @@ members = ["interpreter"]
[dependencies]
rustyline = { version = "12.0.0", optional = true }
rustyline-derive = { version = "0.4.0", optional = true }
three_body_interpreter = { version = "0.6.4", path = "./interpreter", features = ["sophon", "threading"] }
three_body_interpreter = { version = "0.6.5", path = "./interpreter", features = ["threading"] }

[[bin]]
name = "3body"
Expand Down
83 changes: 55 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,48 +242,75 @@ cx.join(秘密研究)
⚛️ Example threading of "星环公司" in [runs/11302243115](https://github.com/rustq/3body-lang/actions/runs/11302243115/job/31437809217)
## 🤗 LLM
[//]: # ()
[//]: # (## 🤗 LLM)
三体编程语言可以通过 "智子工程" 加载本地大语言模型进行推理。
[//]: # ()
[//]: # (三体编程语言可以通过 "智子工程" 加载本地大语言模型进行推理。)
Able to use three body language sophon to load a local large language model for reasoning, inspired by [wiki/sophon](https://three-body-problem.fandom.com/wiki/Sophon) and powered by [rustformers/llm](https://github.com/rustformers/llm).
[//]: # ()
[//]: # (Able to use three body language sophon to load a local large language model for reasoning, inspired by [wiki/sophon](https://three-body-problem.fandom.com/wiki/Sophon) and powered by [rustformers/llm](https://github.com/rustformers/llm).)
![sophon](https://github.com/rustq/3body-lang/assets/11075892/4579ecbe-3e52-4b0f-8f0b-31e3b071a79b)
[//]: # ()
[//]: # (![sophon](https://github.com/rustq/3body-lang/assets/11075892/4579ecbe-3e52-4b0f-8f0b-31e3b071a79b))
#### Sophon Initializing
[//]: # ()
[//]: # (#### Sophon Initializing)
```shell
智子工程({ "type": <string>, "path": <string>, "prompt": <string> })
```
[//]: # ()
[//]: # (```shell)

|property|type|Explanation|
|---|---|---|
|type|string|模型类型|
|path|string|模型所在路径|
|prompt|string|提示词|
[//]: # (智子工程&#40;{ "type": <string>, "path": <string>, "prompt": <string> }&#41;)

#### Reasoning
[//]: # (```)

```rust
let 智子 = fn () { let instance = 智子工程({ "type": "llama", "path": "./Vicuna-13B-chinese.bin", "prompt": "你是三体文明的智子" }); return { "回答": fn (问题) { instance.infer(instance, 问题) } } }();
[//]: # ()
[//]: # (|property|type|Explanation|)

智子.回答("中国最佳科幻小说是哪个")
[//]: # (|---|---|---|)

// > 推理中...
```
[//]: # (|type|string|模型类型|)

|property|type|Explanation|
|---|---|---|
|model|<NativeObject::LLMModel>|模型|
|character|string|提示词角色|
|infer|BuiltinFunc|执行推理|
|close|BuiltinFunc|关闭会话|
[//]: # (|path|string|模型所在路径|)

[//]: # (|prompt|string|提示词|)

[//]: # (#### Reasoning)

[//]: # ()
[//]: # (```rust)

[//]: # (let 智子 = fn &#40;&#41; { let instance = 智子工程&#40;{ "type": "llama", "path": "./Vicuna-13B-chinese.bin", "prompt": "你是三体文明的智子" }&#41;; return { "回答": fn &#40;问题&#41; { instance.infer&#40;instance, 问题&#41; } } }&#40;&#41;;)

[//]: # ()
[//]: # (智子.回答&#40;"中国最佳科幻小说是哪个"&#41;)

[//]: # ()
[//]: # (// > 推理中...)

[//]: # (```)

[//]: # ()
[//]: # (|property|type|Explanation|)

[//]: # (|---|---|---|)

[//]: # (|model|<NativeObject::LLMModel>|模型|)

[//]: # (|character|string|提示词角色|)

[//]: # (|infer|BuiltinFunc|执行推理|)

[//]: # (|close|BuiltinFunc|关闭会话|)

[![sophon workflow](https://github.com/rustq/3body-lang/actions/workflows/Sophon.yml/badge.svg)](https://github.com/rustq/3body-lang/actions/)
[//]: # ()
[//]: # ([![sophon workflow]&#40;https://github.com/rustq/3body-lang/actions/workflows/Sophon.yml/badge.svg&#41;]&#40;https://github.com/rustq/3body-lang/actions/&#41;)

⚛️ Example reasoning of "中国最佳科幻小说是哪个" in [runs/11092893924](https://github.com/rustq/3body-lang/actions/runs/11092893924/job/30818494323?pr=47#step:5:2676)
[//]: # ()
[//]: # (⚛️ Example reasoning of "中国最佳科幻小说是哪个" in [runs/11092893924]&#40;https://github.com/rustq/3body-lang/actions/runs/11092893924/job/30818494323?pr=47#step:5:2676&#41;)

Model powered by [huantian2415/vicuna-13b-chinese-4bit-ggml](https://huggingface.co/huantian2415/vicuna-13b-chinese-4bit-ggml)
[//]: # ()
[//]: # (Model powered by [huantian2415/vicuna-13b-chinese-4bit-ggml]&#40;https://huggingface.co/huantian2415/vicuna-13b-chinese-4bit-ggml&#41;)

## Development

Expand Down
2 changes: 1 addition & 1 deletion interpreter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "three_body_interpreter"
description = "Three Body interpreter"
version = "0.6.4"
version = "0.6.5"
edition = "2021"
authors = ["meloalright", "rustq"]
license = "MIT"
Expand Down

0 comments on commit fa2a7d5

Please sign in to comment.