Giter VIP home page Giter VIP logo

azookeykanakanjiconverter's Issues

[BUG] ZenzaiにおいてByte Fallbackが発生するケースがカバーされていない

zenz-v1は文字レベルBPEトークナイザを利用しており、語彙に含まれない文字が現れた場合はUTF-8のバイトレベルの分割を行う。
したがって、Next Token Probabilityが最大であるようなトークンをとった時、これがバイトレベルのトークンの可能性がある。

しかし、現在はConstraintがSwiftの文字列で示されているため、UTF-8としてinvalidな状態のテキストはConstraintとして扱えない。
文字列を中間表現とするのをやめ、UTF-8コードポイントで直接これを扱うようにしたい。

なお、ほとんどのケースでバイトレベルのトークンは現れないため、基本的にはエッジケースのみで生じる

[BUG] 漢数字への変換で誤差が出ている

例えば「1234567890」と入力して変換すると「十二億三千四百五十六万七千九百三十六」と表示され、正確な値と異なる値が表示される。

この部分でString -> Float -> Intと変換してしまっているのが原因と考えられる。

private func getWiseDicdata(convertTarget: String, inputData: ComposingText, inputRange: Range<Int>) -> [DicdataElement] {
var result: [DicdataElement] = []
result.append(contentsOf: self.getJapaneseNumberDicdata(head: convertTarget))
if inputData.input[..<inputRange.startIndex].last?.character.isNumber != true && inputData.input[inputRange.endIndex...].first?.character.isNumber != true, let number = Float(convertTarget) {
result.append(DicdataElement(ruby: convertTarget, cid: CIDData..cid, mid: MIDData.小さい数字.mid, value: -14))
if number.truncatingRemainder(dividingBy: 1) == 0 {
let int = Int(number)
if int < Int(1E18) && -Int(1E18) < int, let kansuji = self.numberFormatter.string(from: NSNumber(value: int)) {
result.append(DicdataElement(word: kansuji, ruby: convertTarget, cid: CIDData..cid, mid: MIDData.小さい数字.mid, value: -16))
}
}
}

[BUG] 学習後に優先順位が下がらなくなる単語がある

  1. 「へんかん」に対して「編感」を確定する
  2. これを長期記憶に保存する
  3. 何度「変換」で確定しても、「編感」が優先されるようになる。

この現象は1文字ずつ確定した際に起こる。iOS版のazooKeyでは起こらず、デスクトップ版でのみ再現している。

[Feature Request] メールアドレス変換を高機能化

現在、メールアドレス変換として次のような機能が用意されている。

  • /[A-Za-z0-9_\.]+@/と入力すると、@gmail.com@icloud.comなどを予測変換として表示する

これに対して、以下の要望が来ていた。

@gまで入力している場合に絞り込んでほしい

この機能を実装したい。現在の実装はEmailAddress.swiftに存在しており、これを拡張することで実現可能だと考えられる。

https://github.com/ensan-hcl/AzooKeyKanaKanjiConverter/blob/develop/Sources/KanaKanjiConverterModule/Converter/EmailAddress.swift

[Feature Request] Zenzai and CoreML

背景

Zenzaiは現在llama.cppを推論ランタイムとして動いている。llama.cppはプラットフォーム間の移植が容易である利点がある一方で、Apple PlatformsにおいてはNPU(Neural Engine)を利用できないため、効率においてCoreMLに劣る可能性がある。
そこで、CoreMLを用いたZenzaiの実装を実現し、llama.cppを上回る推論パフォーマンスを得たい。

現在の状況

@Skyline-23 さんによるzenzモデルのCoreML版が存在する。
https://github.com/Skyline-23/zenz-CoreML

これを用いて推論を行う実装が以下であり、現在logitの取得までは達成できている。しかし推論時間はllama.cppの1.4倍程度遅く、またNPUが適切に使えていないと見られる挙動を示す。

https://github.com/ensan-hcl/swift-zenz-coreml

やりたいこと

以上を踏まえ、以下を行ってllama.cppを超える性能を得たい。これが実現できれば、原理的にはApple PlatformにおいてCoreMLを利用した高速化が得られることになる。

  • zenz-v2(無改造のGPT-2)をCoreMLで動かし、入力に対するlogitを得る
  • Quantization, Palletizationをかけてモデルを圧縮する
  • KV-Cachingを有効にする
  • llama.cppよりも高速な推論性能を得る

[Feature Request] APIの非同期化

現在、ほぼ全ての処理が@MainActorで実行されており、メインスレッドをブロックしてしまう。かな漢字変換はしばしば重い操作であり、多くの実用的なアプリケーションにおいて望ましくない。

そこで@MainActorの制約を外して非同期でアクセスするよう変更を行いたい。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.