2023年12月8日金曜日

居眠り検知のAIを作ってみる。

 最近おじさん、ようやく作りたいAIが作れるようになってきました。

このまえ居眠り検知をするAIを作っている会社の人のデモをみて思ったのです。

これおじさんでも作れる!



eal-Time Eye Blink Detection using Facial Landmarks

https://vision.fe.uni-lj.si/cvww2016/proceedings/papers/05.pdf


眠気を判定!目のまばたき検知をDlibとOpenCVを組み合わせて数十行で作る

https://qiita.com/mogamin/items/a65e2eaa4b27aa0a1c23


ラズパイカメラによる眠気検知とWebストリーミング

https://qiita.com/AkitoArai709/items/b8a23af4042de1aa0fdd


作ってる人たくさんいますね。


これも距離を計算するだけなのね。

おじさんもC++で作ってみました。


--------------------------

#define DLIB_JPEG_SUPPORT 1



#include <dlib_dnn.h>

#include <dlib_gui_widgets.h>

#include <dlib_clustering.h>

#include <dlib_string.h>

#include <dlib_image_io.h>

#include <dlib_image_processing_frontal_face_detector.h>


using namespace dlib;

using namespace std;



float EAR(point p1, point p2, point p3, point p4, point p5, point p6)

{

    float a1=sqrt( (p6.x() - p2.x()) * (p6.x() - p2.x()) + (p6.y() - p2.y()) * (p6.y() - p2.y()));

    float a2 = sqrt((p3.x() - p5.x()) * (p3.x() - p5.x()) + (p3.y() - p5.y()) * (p3.y() - p5.y()));

    float a3 = sqrt((p1.x() - p4.x()) * (p1.x() - p4.x()) + (p1.y() - p4.y()) * (p1.y() - p4.y()));

    return (a1 + a2) / (2 * a3);

}

// ----------------------------------------------------------------------------------------

float detectSleepiness(full_object_detection& fod)

{

    point p1,p2,p3,p4,p5,p6;

    float ear1, ear2;

    float ret = 0;

    p1=fod.part(36);

    p2 = fod.part(37);

    p3 = fod.part(38);

    p4 = fod.part(39);

    p5 = fod.part(40);

    p6 = fod.part(41);

    ear1 = EAR(p1, p2, p3, p4, p5, p6);

    p1 = fod.part(42);

    p2 = fod.part(43);

    p3 = fod.part(44);

    p4 = fod.part(45);

    p5 = fod.part(46);

    p6 = fod.part(47);

    ear2 = EAR(p1, p2, p3, p4, p5, p6);


   // printf("ear1=%f  era2=%f  \n",ear1,ear2);


    ret = ear1+ear2;

    return ret;

}


int main(int argc, char** argv)

{

    

    //const char* face_image = "202304_2_1.jpg";

    //const char* face_image = "kuchikomi1074_TP_V.jpg";

    const char* face_image = "taihige-hiyake001.jpg";


    float sleepiness;

    if (argc >= 2)face_image = argv[1];


    frontal_face_detector detector = get_frontal_face_detector();


    shape_predictor sp;

    deserialize("shape_predictor_68_face_landmarks.dat") >> sp;


    array2d<rgb_pixel> img;

    load_image(img, face_image);

    pyramid_up(img);


    std::vector<rectangle> dets = detector(img);

    cout << "Number of faces detected: " << dets.size() << endl;


    std::vector<full_object_detection> shapes;

    for (unsigned long j = 0; j < dets.size(); ++j)

    {

        full_object_detection shape = sp(img, dets[j]);

        cout << "number of parts: " << shape.num_parts() << endl;

        shapes.push_back(shape);

    }


    sleepiness=detectSleepiness(shapes[0]);

    printf("sleepiness=%f\n",sleepiness);

    cout << "hit enter to terminate" << endl;

    cin.get();

}


--------------------------

本当に簡単に作れるんですね。



2023年11月30日木曜日

顔認証をつくってみた。

 おじさんこの前、顔認証でゲートを通過するところに行きました。

最近だんだん増えてきたよね。

だけれど、きちんと登録したのに何故か通れない。

ふざけやがって・・・・。


なので今回は顔認証システムの作成に挑戦します!


Pythonで手軽に顔認識をやってみる(face-recognition)

https://blog.grasys.io/post/uema/face-recognition/


なるほど、dlibにはすでに顔認証ライブラリがあるのね。

99.38%の正解率らしい。


dlib/examples/dnn_face_recognition_ex.cpp

https://github.com/davisking/dlib/blob/master/examples/dnn_face_recognition_ex.cpp


ここに顔認証のサンプルがあります。
これをちょっと改造するだけじゃん!
顔認証は顔を検出して、次元縮小して、比べたい画像の特徴ベクトルの引き算して距離を求めるだけ。
なんだ引き算するだけじゃん。

dlib/examples/dnn_metric_learning_on_images_ex.cpp

学習のソースコードもとっても簡単だし。顔データもすべてそろっている。
ネットはテンプレートで組む時代なのね。
300万人の顔を学習させたのね。
なんかそこら辺の日本の企業を超えている気がする。
しかもこれ、resnetでmetric learningしているので、顔だけでなく植物の名前など画像ならなんでも学習させることが可能です。曲がったキュウリとかの異常検知もできそうですね。
凄すぎる。

志村けんやチョコプラのIKKOをきちんと認証できるかやってみました。

--------------------------------
#define DLIB_JPEG_SUPPORT 1


#include <dlib_dnn.h>
#include <dlib_gui_widgets.h>
#include <dlib_clustering.h>
#include <dlib_string.h>
#include <dlib_image_io.h>
#include <dlib_image_processing_frontal_face_detector.h>

using namespace dlib;
using namespace std;


template <template <int,template<typename>class,int,typename> class block, int N, template<typename>class BN, typename SUBNET>
using residual = add_prev1<block<N,BN,1,tag1<SUBNET>>>;

template <template <int,template<typename>class,int,typename> class block, int N, template<typename>class BN, typename SUBNET>
using residual_down = add_prev2<avg_pool<2,2,2,2,skip1<tag2<block<N,BN,2,tag1<SUBNET>>>>>>;

template <int N, template <typename> class BN, int stride, typename SUBNET> 
using block  = BN<con<N,3,3,1,1,relu<BN<con<N,3,3,stride,stride,SUBNET>>>>>;

template <int N, typename SUBNET> using ares      = relu<residual<block,N,affine,SUBNET>>;
template <int N, typename SUBNET> using ares_down = relu<residual_down<block,N,affine,SUBNET>>;

template <typename SUBNET> using alevel0 = ares_down<256,SUBNET>;
template <typename SUBNET> using alevel1 = ares<256,ares<256,ares_down<256,SUBNET>>>;
template <typename SUBNET> using alevel2 = ares<128,ares<128,ares_down<128,SUBNET>>>;
template <typename SUBNET> using alevel3 = ares<64,ares<64,ares<64,ares_down<64,SUBNET>>>>;
template <typename SUBNET> using alevel4 = ares<32,ares<32,ares<32,SUBNET>>>;

using anet_type = loss_metric<fc_no_bias<128,avg_pool_everything<
                            alevel0<
                            alevel1<
                            alevel2<
                            alevel3<
                            alevel4<
                            max_pool<3,3,2,2,relu<affine<con<32,7,7,2,2,
                            input_rgb_image_sized<150>
                            >>>>>>>>>>>>;

// ----------------------------------------------------------------------------------------

frontal_face_detector detector;
shape_predictor sp;
anet_type net;


matrix<float, 0, 1> get_face_descriptors(const char* fn,const char* sfn=nullptr)
{
    std::vector<matrix<float, 0, 1>> face_descriptors;
    matrix<rgb_pixel> img;
    load_image(img, fn);
    //image_window win(img);

    std::vector<matrix<rgb_pixel>> faces;
    for (auto face : detector(img))
    {
        auto shape = sp(img, face);
        matrix<rgb_pixel> face_chip;
        extract_image_chip(img, get_face_chip_details(shape, 150, 0.25), face_chip);
        faces.push_back(move(face_chip));
        draw_rectangle(img, face, dlib::rgb_pixel(255,0,0));
        //win.add_overlay(face);
    }

    if (faces.size() == 0)
    {
        return face_descriptors[0];
    }
   face_descriptors = net(faces);

   if (sfn != nullptr) {
       save_bmp(img, sfn);
   }
   //cin.get();
   
   return face_descriptors[0];
}

void save_face_descriptors(const char* fn, const char* sfn,const char* name)
{
    std::vector<matrix<float, 0, 1>> face_descriptors;
    matrix<rgb_pixel> img;
    load_image(img, fn);
    //image_window win(img);

    std::vector<matrix<rgb_pixel>> faces;
    for (auto face : detector(img))
    {
        auto shape = sp(img, face);
        matrix<rgb_pixel> face_chip;
        extract_image_chip(img, get_face_chip_details(shape, 150, 0.25), face_chip);
        faces.push_back(move(face_chip));
        draw_rectangle(img, face, dlib::rgb_pixel(255, 0, 0));
        draw_string(img, dlib::point(face.left(),face.top() + face.height()), name, rgb_pixel(255, 0, 0));
        //win.add_overlay(face);
    }

    if (faces.size() == 0)
    {
        return;
    }
    face_descriptors = net(faces);

    if (sfn != nullptr) {
        save_bmp(img, sfn);
    }
}


struct face_file {
    const char* name;
    const char* fname;
};

std::vector<struct face_file> face_files = {
    {"shimuraken","shimuraken.jpg"},
    {"matsuo","matsuo.jpg"},
    {"ikko","ikko.jpg"},
};

std::vector<const char*> test_files = {
    "shimura_001.jpg",
    "ikko_001.jpg",
    "matsuo_001.jpg",
};

int main(int argc, char** argv)
{

    detector = get_frontal_face_detector();
    deserialize("shape_predictor_5_face_landmarks.dat") >> sp;
    deserialize("dlib_face_recognition_resnet_model_v1.dat") >> net;



    std::vector<matrix<float, 0, 1>> face_descriptors;
    for (int i = 0; i < face_files.size(); i++) {
        face_descriptors.push_back(get_face_descriptors(face_files[i].fname));
    }
    for (int i = 0; i < face_files.size(); i++) {
        matrix<float, 0, 1> face_descriptors2 = get_face_descriptors(test_files[i]);
        printf("------------\n");
        printf("%s\n", test_files[i]);
        //for (int j = 0; j < face_files.size(); j++) {
        //    printf("    length=%f  name=%s  \n", length(face_descriptors[j] - face_descriptors2), face_files[j].name);
        //}
        float len;
        const char* name;
        int pos;
        char outname[256];
        pos = 0;
        len = length(face_descriptors[0] - face_descriptors2);
        name = face_files[0].name;
        for (int j = 1; j < face_files.size(); j++) {
            if (len < length(face_descriptors[j] - face_descriptors2))continue;
            pos = j;
            len = length(face_descriptors[j] - face_descriptors2);
            name = face_files[j].name;
        }
        printf("length=%f  name=%s  \n", len, name);
        sprintf(outname, "out_%s.bmp", name);
        save_face_descriptors(test_files[i], outname,name);
    }

    cout << "hit enter to terminate" << endl;
    cin.get();
}


--------------------------------


結果



文字が小さくて読みにくいですが、仮装しててもきちんと顔認証できるじゃん。
すげー。
顔認証システムって数時間で作れるのね。


2023年9月25日月曜日

激安の真空管プリアンプを作る その2

おじさん、前回紹介した激安真空管プリアンプキットをもう一つ買って、コンデンサーを交換する改造してみました。

このキット本当に謎です。

6J1の真空管は2本で2000円くらいするんですが、その真空管付きのキットも2000円。

なんでそうなるの?

キットを売っている会社もいくつかあり、コンデンサーがセラミックコンデンサーだったりフィルムコンデンサーだったり。部品も微妙に違います。

さすがにセラミックコンデンサーはダメだろ!

ちゃんとした品質のキット売ろうとしている感じが全くないですね。


http://audiolife.sblo.jp/article/185249378.html

このサイトのようにコンデンサーをオーディオ用電解コンデンサーと高級フィルムコンデンサーに交換します。

安い電解コンデンサーとセラミックコンデンサーなんてコンデンサーの本来の特性してないからね。



うーん。これ一瞬でかなり音がよくなったことがわかるくらい音質が改善する。
このキットはもともと音がいいと思っていたのですが・・・。

低音がしっかりして音が超クリアになるじゃん。

真空管があったまっていってどんどん音がよくなっていくのが快感になってしまった。


Mrs.GreenAppleの私は最強の音楽を聴いて評価しているのですが、この改造が最強な気がする。

ネットで書かれているように真空管とかをロシアの軍用グレードのものに交換するともっと音が良くなるのだろうか?

どんどんはまっていく・・・。

おそロシア。




2023年9月14日木曜日

激安の真空管プリアンプを作る

 おじさん、amazonで買って放置してあった真空管アンプを作ってみました。

プリアンプって書いてありますが、ヘッドフォンアップとしても使えるっぽい?です。



真空管の駆動に必要な高電圧が、倍電圧整流回路で簡単に作れることがネットで広まり、小型で安値な真空管アンプキットが1500円くらいで買えるようになりました。


こんな回路図をしているようです。
これ最初に考えた人頭いいね。
このCircuitLABのサイトも楽しいね。いろんな回路を何時間でも見てられる。
ご覧の通り回路のほとんどが高電圧を作るための回路です。

作って音を聞いてみて思ったことは、思ったより音がいい。

これ五十年前にこの音質に出会っていたら超感動したろうな。

さらに、これをちょっと改造すればたぶんもっと音良くなる。


こんな風に、カソードフォロワの出力で安定を狙った回路とかみんなどんどん回路図をGithubのようにアップデートしていくのね。すげー。

https://arereno.blogspot.com/2020/04/6j1-diy_14.html

回路も安定化させていろいろ試したくなってきた。


やべー、コンデンサーも高級なものに変えたくなってきた。

http://audiolife.sblo.jp/article/185249378.html


やっぱ世の中同じこと考える人たくさんいるのね。


2023年8月17日木曜日

llama.cppでLLMの学習をさせる

 おじさんが花火の場所取りをしている間に、ものすごい勢いでLLMの技術が進歩している。

最近LLMはCPUだけで0からスクラッチで学習させるのが目標らしい。




15Mに満たない言語モデルで小さな物語を紡ぐ

https://note.com/bakushu/n/nd834ff25394f


baby-llama

https://github.com/ggerganov/llama.cpp/pull/1360


llama.cpp でフルの学習メモ

https://zenn.dev/syoyo/articles/e9eb5211bb4e8b


llama.cpp

https://github.com/ggerganov/llama.cpp



へーーーーーーー。

LLMってまず計算するフレームワークが正しく実装されているか確かめるために、まずsin関数を学習させるのね。

そして実装ができたら、英語のシェイクスピアの文章を学習させるのね。

最後に超巨大データで学習させるのね。

日本語の場合、構文解析のわかちがきのところの高性能かつシンプルな実装のライブラリがないのね。


とっても勉強になる。

こんなに簡単にLLMの学習ってできるのね。

LLM最初のころは原子力発電所一基分くらいの電力と金が要ると言われていたのに・・・。


まぁ今日は初回なのでbaby-llamaをビルドして、サイン波を学習させてみました。



----------------------------------

init model

init_kv_cache

Example 1

error_before_opt: 506.75

error_after_opt:  128.53

best samples after optimization:

       X

      X

       X

       X

       X

       X

     X

    X

Example 9

error_before_opt: 132.24

error_after_opt:  101.97

Example 17

error_before_opt: 104.96

error_after_opt:  62.03

Example 25

error_before_opt: 134.28

error_after_opt:  58.35

Example 33

error_before_opt: 115.25

error_after_opt:  64.25

Example 41

error_before_opt: 125.32

error_after_opt:  62.99

Example 49

error_before_opt: 96.77

error_after_opt:  57.14

Example 57

error_before_opt: 98.44

error_after_opt:  58.38

Example 65

error_before_opt: 136.89

error_after_opt:  71.56

best samples after optimization:

       X

       X

       X

     X

    X

   X

 X

 X

Example 73

error_before_opt: 104.19

error_after_opt:  65.09

Example 81

error_before_opt: 103.45

error_after_opt:  57.70

Example 89

error_before_opt: 107.56

error_after_opt:  57.80

Example 97

error_before_opt: 97.15

error_after_opt:  65.41

Example 105

error_before_opt: 107.30

error_after_opt:  67.93

Example 113

error_before_opt: 114.04

error_after_opt:  75.12

Example 121

error_before_opt: 115.25

error_after_opt:  71.37

Example 129

error_before_opt: 104.39

error_after_opt:  71.55

best samples after optimization:

  X

    X

   X

  X

 X

 X

 X

  X

Example 137

error_before_opt: 99.17

error_after_opt:  75.65

Example 145

error_before_opt: 100.43

error_after_opt:  68.08

Example 153

error_before_opt: 98.71

error_after_opt:  71.94

Example 161

error_before_opt: 103.10

error_after_opt:  68.90

Example 169

error_before_opt: 117.62

error_after_opt:  70.84

Example 177

error_before_opt: 79.23

error_after_opt:  63.81

Example 185

error_before_opt: 101.08

error_after_opt:  70.64

Example 193

error_before_opt: 98.38

error_after_opt:  67.66

best samples after optimization:

 X

 X

 X

 X

  X

   X

    X

     X

Example 201

error_before_opt: 102.50

error_after_opt:  80.97

Example 209

error_before_opt: 118.92

error_after_opt:  80.08

Example 217

error_before_opt: 91.98

error_after_opt:  71.79

Example 225

error_before_opt: 103.32

error_after_opt:  80.62

Example 233

error_before_opt: 99.25

error_after_opt:  81.21

Example 241

error_before_opt: 94.08

error_after_opt:  68.46

Example 249

error_before_opt: 102.03

error_after_opt:  71.46

Generating 128 tokens.

X

 X

  X

    X

     X

      X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 X

 X

 X

  X

   X

     X

      X

       X

       X

       X

       X

      X

     X

    X

   X

  X

 X

 0.04 0.20 -1.42 -0.04 -0.93 3.49 -1.37 0.02 0.32 -3.07 -0.33 0.68 0.86 -1.37 1.00 -1.12 -0.16 1.14 0.16 -0.07 1.54 -0.90 0.17 0.99 2.63 0.24 -0.10 0.87 -0.17 -0.39 -1.45 -2.40

 0.44 0.45 -0.08 0.06 -0.70 1.09 -0.72 2.58 1.13 -0.41 0.45 0.01 -0.30 -0.53 -0.18 2.71 -0.81 0.08 0.33 0.54 1.85 -0.35 0.91 2.00 0.56 0.42 -0.10 0.50 -0.54 1.89 -3.25 -1.20

 -0.09 -0.03 0.15 -0.04 0.23 4.76 -0.08 0.29 -0.12 0.11 -0.20 0.00 0.06 -0.05 -0.03 -0.38 0.20 0.23 -0.06 -0.04 0.18 0.11 -0.06 0.13 0.28 -0.11 -0.00 -0.02 -0.07 0.61 -0.77 -1.70

 1.43 1.26 0.28 0.65 -1.15 2.28 1.23 0.26 1.87 -1.88 0.98 0.43 0.15 0.07 0.12 0.64 -1.33 -2.07 0.10 0.50 -1.24 -0.33 0.05 -1.34 -0.83 0.77 -0.03 1.07 0.31 -0.97 -0.10 -3.70

 0.35 -2.55 1.76 -1.51 0.73 1.24 -0.75 2.51 2.16 -0.23 -0.74 -1.53 0.65 1.19 0.69 -2.06 -0.97 0.32 -0.21 -1.94 2.18 0.16 -1.29 -1.29 2.12 -0.55 -1.55 -0.85 1.21 -1.00 -0.50 -1.79

 -0.94 1.05 -0.23 1.87 0.34 0.84 -2.52 -0.24 0.95 -1.08 1.97 1.85 0.76 -1.72 -0.55 -1.35 -0.68 -0.01 -1.59 1.92 1.96 -0.64 -3.58 -0.59 -0.47 0.13 -0.56 0.46 -2.63 -1.47 -0.40 -0.49

 1.42 0.31 0.21 -0.02 -0.55 1.23 -1.93 -1.36 1.42 -0.78 -1.91 -0.05 0.74 -1.48 -0.33 -1.24 -0.83 3.10 0.47 -0.50 -0.57 0.01 -0.32 -0.37 -1.56 -0.51 0.17 0.84 1.09 0.35 -0.33 -1.73

 0.97 0.74 -0.66 0.93 -0.24 1.83 1.27 -0.00 0.72 -1.95 0.02 -0.16 0.97 0.46 0.61 2.08 0.66 2.54 -0.37 0.40 1.40 0.45 0.03 0.61 -0.47 -0.34 -0.11 0.62 -0.50 -4.70 0.28 0.21

done


----------------------------------

できた。





2023年6月9日金曜日

Stable Diffusionをする

 おじさん、特にStable Diffusionには興味ないんですが、c++用のAIライブラリをmake使わずにひたすらいろいろなプラットフォーム用移植する勉強の一環で、Stable DiffusionのC++版をスクラッチでフルビルドしてみました。


論文:High-Resolution Image Synthesis with Latent Diffusion Models", Rombach, R., Blattmann, A., Lorenz, D., Esser, P., Ommer, B. (CVPR'22)

https://arxiv.org/abs/2112.10752


論文解説

https://zenn.dev/tomo_makes/books/4ed97f06d02a38/viewer/142053


ソース

https://github.com/EdVince/Stable-Diffusion-NCNN


ncnnという中国語?のライブラリを使わないといけないのね。

txt2imgとかimg2imgとかいろんなものが含まれています。

これ本当に動くのかなぁ。





---------------------------------


----------------[  init   ]---------------- 6.21G / 6.22G

----------------[ prompt  ]---------------- 6.22G / 6.22G

----------------[ encoder ]---------------- 6.41G / 6.41G

----------------[diffusion]----------------

step: 1/37      102223.67ms

step: 2/37


---------------------------------


うーん、これWindowsでCPUのみで行うと、1stepに100秒かかります。

これ結果出すのに1時間かかるね。


なんかテストは少女を生成しないといけないようなので、生成してみました。

---------------------------------


---------------------------------

できた!



2023年6月2日金曜日

日本語の大規模言語モデルRinnaを動かす

おじさん1日1AIをしています。

毎日AIの勉強を一つします。

毎日2、3時間くらいで、調べて、データ作成して、ビルドして、実験して、かなり大変。

誰かおじさんに働かなくて良いだけのお金くれないかなぁ。

そうしたらおじさんAIの研究をします。


最近LoRAで日本語にファインチューニングした言語モデルが増えてきました。

そのおかげで、おじさんのように、GPUなしのC++で大規模言語モデルの学習やファインチューニングをしようとしている人も増えてきました。


https://zenn.dev/syoyo/articles/946c17666e10fb


ついにおじさんのやり方がが主流になるときが。

でもおじさん夜な夜な適当に勉強しているので、みんなに先を越されている・・・。

なるほど、最近ファインチューニング関係の論文が凄いのね。


QLoRA

https://github.com/artidoro/qlora/tree/main

https://zenn.dev/syoyo/articles/6918defde8a807

QLoRAだと微分値を求めるところが少なくGPU一枚でファインチューニングできるらしい


Fine-Tuning Language Models with Just Forward Passes

https://github.com/princeton-nlp/MeZO

https://arxiv.org/abs/2305.17333

フォワードのみだからC++で簡単にファインチューニングできる?



上記のサイトによると昨日、日本語のRinnaのモデルがC++で動くようになったらしいので、さっそくおじさんもGPUなしPCでやってみました。

---------------------

redpajama.exe -m "C:\trash\pytorch\redpajama.cpp-master\examples\redpajama\scripts\output_dir\ggml-japanese-gpt-neox-3.6b-instruction-ppo-f16.bin" -p "こんにちは"

main: seed = 1685673288

gptneox.cpp: loading model from C:\trash\pytorch\redpajama.cpp-master\examples\redpajama\scripts\output_dir\ggml-japanese-gpt-neox-3.6b-instruction-ppo-f16.bin

gptneox.cpp: can't use mmap because tensors are not aligned; convert to new format to avoid this

gptneox_model_load_internal: format     = ggmf v1 (old version with no mmap support)

gptneox_model_load_internal: n_vocab    = 32000

gptneox_model_load_internal: n_ctx      = 512

gptneox_model_load_internal: n_embd     = 2816

gptneox_model_load_internal: n_head     = 22

gptneox_model_load_internal: n_layer    = 36

gptneox_model_load_internal: n_rot      = 128

gptneox_model_load_internal: use_parallel_residual = 0

gptneox_model_load_internal: ftype      = 1 (mostly F16)

gptneox_model_load_internal: n_parts    = 1

gptneox_model_load_internal: model size = 12B

gptneox_model_load_internal: ggml ctx size = 7048095.00 KiB

gptneox_model_load_internal: mem required  = 8930.91 MiB (+ 1608.00 MiB per state)

..................................................................................................

.

.

gptneox_init_from_file: kv self size  =  198.00 MiB


system_info: n_threads = 4 / 4 | AVX = 0 | AVX2 = 0 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 0 | NEON = 0 | ARM_FMA = 0 | F16C = 0 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 0 | VSX = 0 |

sampling: repeat_last_n = 64, repeat_penalty = 1.100000, presence_penalty = 0.000000, frequency_penalty = 0.000000, top_k = 40, tfs_z = 1.000000, top_p = 0.950000, typical_p = 1.000000, temp = 0.800000, mirostat = 0, mirostat_lr = 0.100000, mirostat_ent = 5.000000

generate: n_ctx = 512, n_batch = 512, n_predict = 128, n_keep = 0



こんにちは。今日は曇りがちな天気でした。昨日は、家族とテニスをしたり、外でバーベキューをしたりしました。テニスはとても楽しかったです。また、海に行ったり、公園に行って散歩したりもしました。とてもリラックスできました。今日は、自宅でゆっくり過ごしています。ゲームやビデオを観たりして、楽しんでいます。明日は、家族と一緒にドライブに行く予定です。とても楽しみにしています。良い一日を過ごしてくださいね。



gptneox_print_timings:        load time =  8633.80 ms

gptneox_print_timings:      sample time =   127.78 ms /   128 runs   (    1.00 ms per run)

gptneox_print_timings: prompt eval time =  5968.87 ms /     4 tokens ( 1492.22 ms per token)

gptneox_print_timings:        eval time = 197970.49 ms /   127 runs   ( 1558.82 ms per run)

gptneox_print_timings:       total time = 206822.82 ms

---------------------


なんというきれいな日本語