OpenMythosのサンプルプログラムを動かしました

1.概要 前回、OpenMythosの環境構築まで実現したので、GitHubにあるサンプルプログラム(Usage)を動かしてみました。一部エラーが発生しましたが、結果出力部分なので修正をしました。その内容を記述します。 2.詳細 Usageに記載されているPythonプログラムをopenmythos_usage.pyとして作成します。 $ source ~/mypy/bin/activate (mypy) $ pythoh3 openmythos_usage.py 下記エラーとなります [MLA] Parameters: 1,538,626 [MLA] Logits shape: torch.Size([2, 16, 1000]) [MLA] Generated shape: torch.Size([2, 24]) Traceback (most recent call last):   File "/home/nakasima/openmythos/openmythos_usage.py", line 48, in <module>     rho = torch.linalg.eigvals(A).abs().max().item()           ^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: linalg.eig: The input tensor A must have at least 2 dimensions. コードの下記部分を修正します #rho = torch.linalg.eigvals(A).abs().max().item() rho = A.abs().max().item() $ source ~/mypy/bin/activate (mypy) $ pythoh3 openmythos_usage.py [MLA] Parameters: 1,538,626 [MLA] Logits shape: torch.Size([2, 16, 1000]) [MLA] Generated shape: torch.Size([2, 24]) [MLA] Spectral radius ρ(A) = 0.3679 (mus...

shell scriptを入れ子にした場合のteeの挙動について調べました

 1. 概要

teeを利用して実行ログをファイルに保管することを良く実施します。このような処理をすでに組み込んでいるshell全体を更にteeを利用して実行ログをファイル保管するとどのようになるのか調べてみました。結果は、両方の機能が実行されることになり、片方の機能が無効になることはありませんでした。その内容を記述します。

2. 詳細

単純なshellをtest1.shで作成します。

#!/bin/bash
echo "test1" | tee test1.log

実行すると、test1.logが出力されて、中身は下記内容になります。

test1

同じ処理をtest2.sh, test3.sh作成します。
更に、test.shを下記内容で作成します。

#!/bin/bash
test(){
sh test1.sh
sh test2.sh
sh test3.sh
}

test | tee test.log

それでは、test.shを実行します。
まず、test.logの内容は以下のようになります。

test1
test2
test3

また、test1.log, test2.log, test3.logも作成されて、中身も想定した内容になります。

コメント

このブログの人気の投稿

miniPCのBMAXでWindows11のsecure boot設定漏れでトラブル発生

LinuxMint-22.3にWine 11.6をサクッと入れてみました

LinuxMint 21.3にWinBoat導入を試してみました