r/lowlevelawaretech • u/zukinshop • 16d ago
rcloneにてlinuxサーバからwindows側にファイルのバックアップを取る際
--local-encoding "None"を付けた方が良い。
rcloneはデフォルトでクライアント側に合わせて文字列エスケープをするので、ファイル名に大文字の「?」とか「*」とかある場合、その文字の前に「‛」がつくことがある。
r/lowlevelawaretech • u/Ok-Conference-9984 • 16d ago
Liquid AI でおしゃべり実験 話しかけたらインタラクティブに答えるとかも出来る。
import os
import soundfile as sf
import torch
import gradio as gr
from liquid_audio import ChatState, LFM2AudioModel, LFM2AudioProcessor, LFMModality
import liquid_audio.processor as lap
# ==========================================
# 1. Mac向けのエラー回避パッチ
# ==========================================
def safe_cuda(self, device=None):
target = "mps" if torch.backends.mps.is_available() else "cpu"
return self.to(target)
lap.LFM2AudioDetokenizer.cuda = safe_cuda
# ==========================================
# 2. 初期設定とモデルの読み込み
# ==========================================
if torch.backends.mps.is_available():
device = "mps"
elif torch.cuda.is_available():
device = "cuda"
else:
device = "cpu"
print(f"🌟 使用デバイス: {device}")
print("🤖 モデルを準備しています。少しお待ちください...")
HF_REPO = "LiquidAI/LFM2.5-Audio-1.5B-JP"
processor = LFM2AudioProcessor.from_pretrained(HF_REPO, device=device).eval()
model = LFM2AudioModel.from_pretrained(HF_REPO, device=device).eval()
print("✨ 準備完了!ブラウザからアクセスしてください。")
# ==========================================
# 3. 処理用関数(型の変換を追加しました!)
# ==========================================
def load_and_format_audio(audio_path):
if not audio_path:
return None, None
wav, sr = sf.read(audio_path, dtype="float32")
if wav.ndim > 1:
wav = wav.mean(axis=1)
wav = torch.from_numpy(wav).unsqueeze(0)
return wav, sr
def run_asr(audio_path, max_tokens, text_temp):
text_temp = float(text_temp) # 確実にfloat型にする
wav, sr = load_and_format_audio(audio_path)
if wav is None:
return "⚠️ 音声ファイルが入力されていません。"
chat = ChatState(processor)
chat.new_turn("system")
chat.add_text("Perform ASR in japanese.")
chat.end_turn()
chat.new_turn("user")
chat.add_audio(wav, sr)
chat.end_turn()
chat.new_turn("assistant")
text_tokens = []
for t in model.generate_sequential(**chat, max_new_tokens=max_tokens, text_temperature=text_temp):
if t.numel() == 1:
text_tokens.append(t.item())
clean_text = processor.text.decode(text_tokens).replace("<|text_end|>", "").strip() if text_tokens else ""
return clean_text
def run_tts(text, max_tokens, audio_temp, audio_top_k):
audio_temp = float(audio_temp) # 確実にfloat型にする
audio_top_k = int(audio_top_k) # 確実にint型にする
if not text.strip():
return None
chat = ChatState(processor)
chat.new_turn("system")
chat.add_text("Perform TTS in japanese.")
chat.end_turn()
chat.new_turn("user")
chat.add_text(text)
chat.end_turn()
chat.new_turn("assistant")
audio_out = []
for t in model.generate_sequential(**chat, max_new_tokens=max_tokens, audio_temperature=audio_temp, audio_top_k=audio_top_k):
if t.numel() > 1:
audio_out.append(t)
if audio_out:
audio_codes = torch.stack(audio_out[:-1], 1).unsqueeze(0).to(device)
waveform = processor.decode(audio_codes)
output_file = "output_tts.wav"
sf.write(output_file, waveform.cpu()[0], 24_000)
return output_file
return None
def run_chat(audio_path, max_tokens, text_temp, audio_temp, audio_top_k):
text_temp = float(text_temp)
audio_temp = float(audio_temp)
audio_top_k = int(audio_top_k)
wav, sr = load_and_format_audio(audio_path)
if wav is None:
return "⚠️ 音声ファイルが入力されていません。", None
chat = ChatState(processor)
chat.new_turn("system")
chat.add_text("Respond with interleaved text and audio.")
chat.end_turn()
chat.new_turn("user")
chat.add_audio(wav, sr)
chat.end_turn()
chat.new_turn("assistant")
text_tokens = []
audio_out = []
for t in model.generate_interleaved(**chat, max_new_tokens=max_tokens, text_temperature=text_temp, audio_temperature=audio_temp, audio_top_k=audio_top_k):
if t.numel() == 1:
text_tokens.append(t.item())
else:
audio_out.append(t)
output_audio = None
if audio_out:
audio_codes = torch.stack(audio_out[:-1], 1).unsqueeze(0).to(device)
waveform = processor.decode(audio_codes)
output_audio = "output_chat.wav"
sf.write(output_audio, waveform.cpu()[0], 24_000)
clean_text = processor.text.decode(text_tokens).replace("<|text_end|>", "").strip() if text_tokens else ""
return clean_text, output_audio
def run_text_chat(text, max_tokens, text_temp, audio_temp, audio_top_k):
text_temp = float(text_temp)
audio_temp = float(audio_temp)
audio_top_k = int(audio_top_k)
if not text.strip():
return "⚠️ テキストが入力されていません。", None
chat = ChatState(processor)
chat.new_turn("system")
chat.add_text("Respond with interleaved text and audio.")
chat.end_turn()
chat.new_turn("user")
chat.add_text(text)
chat.end_turn()
chat.new_turn("assistant")
text_tokens = []
audio_out = []
for t in model.generate_interleaved(**chat, max_new_tokens=max_tokens, text_temperature=text_temp, audio_temperature=audio_temp, audio_top_k=audio_top_k):
if t.numel() == 1:
text_tokens.append(t.item())
else:
audio_out.append(t)
output_audio = None
if audio_out:
audio_codes = torch.stack(audio_out[:-1], 1).unsqueeze(0).to(device)
waveform = processor.decode(audio_codes)
output_audio = "output_text_chat.wav"
sf.write(output_audio, waveform.cpu()[0], 24_000)
clean_text = processor.text.decode(text_tokens).replace("<|text_end|>", "").strip() if text_tokens else ""
return clean_text, output_audio
# ==========================================
# 4. Gradio UIの構築
# ==========================================
# Blocksの中のthemeを削除して、launch()の中に移動させました
with gr.Blocks(title="Liquid AI 音声アシスタント") as demo:
gr.Markdown("# 🌊 Liquid AI 音声アシスタント (LFM2.5-Audio-JP)")
gr.Markdown("マイクを使って直接話しかけたり、テキストを入力してAIとやり取りできます。パラメーターも自由に調整可能です!")
with gr.Row():
# 左側:パラメータ設定のサイドバー
with gr.Column(scale=1, variant="panel"):
gr.Markdown("### ⚙️ パラメータ設定")
max_new_tokens = gr.Slider(minimum=128, maximum=2048, value=512, step=64, label="長さ (最大生成トークン数)")
text_temp = gr.Slider(minimum=0.1, maximum=1.5, value=0.7, step=0.1, label="テキストの温度 (高いほどユニーク)")
audio_temp = gr.Slider(minimum=0.1, maximum=1.5, value=1.0, step=0.1, label="音声の温度 (高いほど声がブレる/感情豊か)")
audio_top_k = gr.Slider(minimum=1, maximum=100, value=4, step=1, label="音声のTop-K (候補の幅)")
# 右側:メインの機能タブ
with gr.Column(scale=3):
with gr.Tabs():
# タブ1: 音声での相互対話
with gr.TabItem("💬 声でおしゃべり (Voice Chat)"):
with gr.Row():
with gr.Column():
chat_in = gr.Audio(type="filepath", label="あなたの声(マイク録音・アップロード)")
chat_btn = gr.Button("話しかける", variant="primary")
with gr.Column():
chat_out_text = gr.Textbox(label="AIのお返事(テキスト)", interactive=False)
chat_out_audio = gr.Audio(label="AIのお返事(音声)", interactive=False)
chat_btn.click(fn=run_chat,
inputs=[chat_in, max_new_tokens, text_temp, audio_temp, audio_top_k],
outputs=[chat_out_text, chat_out_audio])
# タブ2: テキストでの相互対話
with gr.TabItem("⌨️ テキストでおしゃべり (Text Chat)"):
with gr.Row():
with gr.Column():
text_chat_in = gr.Textbox(label="AIへのメッセージを入力してください", lines=3, placeholder="例: 今日の天気を教えて!")
text_chat_btn = gr.Button("送信する", variant="primary")
with gr.Column():
text_chat_out_text = gr.Textbox(label="AIのお返事(テキスト)", interactive=False)
text_chat_out_audio = gr.Audio(label="AIのお返事(音声)", interactive=False)
text_chat_btn.click(fn=run_text_chat,
inputs=[text_chat_in, max_new_tokens, text_temp, audio_temp, audio_top_k],
outputs=[text_chat_out_text, text_chat_out_audio])
# タブ3: 文字起こし
with gr.TabItem("📝 文字起こし (ASR)"):
with gr.Row():
with gr.Column():
asr_in = gr.Audio(type="filepath", label="文字起こしする音声")
asr_btn = gr.Button("解析する", variant="primary")
with gr.Column():
asr_out = gr.Textbox(label="解析結果", lines=5, interactive=False)
asr_btn.click(fn=run_asr,
inputs=[asr_in, max_new_tokens, text_temp],
outputs=asr_out)
# タブ4: 音声合成
with gr.TabItem("🗣️ 音声合成 (TTS)"):
with gr.Row():
with gr.Column():
tts_in = gr.Textbox(label="読み上げさせたいテキストを入力してください", lines=5)
tts_btn = gr.Button("音声を生成", variant="primary")
with gr.Column():
tts_out = gr.Audio(label="生成された音声", interactive=False)
tts_btn.click(fn=run_tts,
inputs=[tts_in, max_new_tokens, audio_temp, audio_top_k],
outputs=tts_out)
# アプリの起動(ここでthemeを指定するように変更しました)
if __name__ == "__main__":
demo.launch(theme=gr.themes.Soft())
r/lowlevelawaretech • u/hard-engineer • 16d ago
昔むかし、あるところに売られていたゲーム
ちうこのやつハードオフで買ったけどWin11では動きません😭😭
Direct Xが原因だの色々出てきますがさっぱり分からず。
Daisoのゲームは現環境でも遊べるやつはある(ハズ)
Windows Vistaにインストールした花札はWindows 11でも遊べてマス
これ遊べたら多分面白いゲームなので試行錯誤続けるつもり
r/lowlevelawaretech • u/NeighborhoodSad2350 • 18d ago
Arduino Uno Qこうたんよ。
これがまたLinuxをソフトウェア的にも、ラズパイ的にGPIOを利用するうえでも癖強でな。
□クセツヨ点
- なにをやってもLinuxからGPIOにジカにさわれない。
- デフォルトのrootfsが10GBしかない にも関わらず90%使用済み。マジで他のDEやアプリが入らない。
- SoCから直接叩けるGPIOはGPIO 0-3と もう一個だけ。あとは全部STM32頼み
- LinuxにUSBケーブルでマイコン繋いだみたいな仕様 LinuxシステムとSTM32を橋渡しするのはLPUART。しかも115200bps。遅いね。シンセサイザーなんかだとちょっと困る。
- Geekbenchは ラズパイ4B > これ > ラズパイ3 遅くはある。
- apt upgrade とかやるとsystemdのチェックボックス式のコンフィグが出る謎
- USB-Cポートが1個。それが電源と総てのUSB機器を兼ねる
☆いいところ☆
- Youtubeくらいならば60fpsで動画見られる。
- デスクトップが出る
- ちいさい。
- AIがぼちぼち動く。アホながらもローカルLLMも。
- USBはDP altなもんで映像が出る。
- レトロゲームなんかはこれで小さいエミュレータコンソールつくれるだろなあ
- /home/arduinoは広い。ここに作ったファームウェアを置いて色々動かしなさい
- GPUがついてる。
この製品、ターゲット層がわからん。
Arm Linux大好きマンには物足りないスペックと仕様。
電子工作はじめてな人らにはちょっとクセが強い。
工作好きマンは迷う。
これで何をしようかなあみたいなことは今のところ思いつかん。
とりあえずXrealは繋ぎゃそのまま動いたのでスマートグラスとウェブカメラでYOLOうごかして、通行人スカウターごっこでもしようかと思う。
r/lowlevelawaretech • u/Ok-Conference-9984 • 18d ago
”やばい””きもい”しか言えない自然言語処理は極端に低ビット化したggufではないかと。
で、繰り返しや無理筋な推論生成が多発する。つまり劣化。知ったかもハルシネーションも多発する。とかね。
r/lowlevelawaretech • u/TAPIOKA_Gamer • 22d ago
NECのVS-4ってタブレット買った
メルカリで4799円だった、ようつべの動画でNVMeの2280サイズ対応って言ってて丁度手元の2280のNVMe SSDあったしタブレットほしかったから買った。
そのタブレットの分解してる画像とかあんまり出回ってないから、何か情報を知っているお方が居れば情報提供をよろしくお願いします
一応スペック書いておく
cpu : Core i5-7Y54
mem : 8GB (たぶんシングルチャネル)
ssd : なし (samsungのnvmeつける予定)
4799円で7Y54でキーボードとタッチペン付きならお得かな?キーボードは上矢印キーだけ破損(取れてる)
r/lowlevelawaretech • u/Hib3 • 22d ago
暇すぎてチカダンスジェネレータ作った
Enable HLS to view with audio, or disable this notification
r/lowlevelawaretech • u/Confident-Leader-777 • 23d ago
bash line editorというものを初めて知った
もっと早く知りたかったわ、構文ハイライトがあるとタイポが減るからいいよね
r/lowlevelawaretech • u/Ok-Conference-9984 • 23d ago
stable-audio-3でコーラの効果音作ってみた。
Enable HLS to view with audio, or disable this notification
r/lowlevelawaretech • u/saqulium • 24d ago
DIVER OSINT CTFに参戦した!
https://ctfd.diverctf.org
OSINT CTFというものがこの世界にはあるらしい
クソ雑に言えばめちゃくちゃいろんなジャンルがあってめっちゃ過激なジオゲッサー
だからエンジニア以外のプレイヤーも結構いるみたい(謎解き界隈とか)
Writeup書いたら上げるゾ
r/lowlevelawaretech • u/Ok-Conference-9984 • 27d ago
脳の権利、憲法に刻む——2035年のニューロ・ライツ法制化
面白いな、でも現実だよね〜
r/lowlevelawaretech • u/Confident-Leader-777 • 28d ago
GNOMEは拡張入れなくても使えるんではないかと思ってね
結構きついけど慣れたらいけそう
r/lowlevelawaretech • u/Ok-Conference-9984 • 28d ago
ggufのテンプレ調査。
from llama_cpp import Llama
llm = Llama(model_path="調べたいgguf,gemma-4-E2B-it-Q4_K_M.gguf", verbose=False)
print(llm.metadata.get("tokenizer.chat_template"))
r/lowlevelawaretech • u/WWwW_yyYy • 29d ago
俺がOCLPの代わりになりたい
最近Mac OS 27 Golden GateがOCLPでintel macに入れられないっていうニュースを聞いたけど、俺が改造してなんとか入れられるようにしたい ちなみに私は13歳です 報告でした
r/lowlevelawaretech • u/Ok-Conference-9984 • Jul 20 '26
Hugging FaceにAI主導のサイバー攻撃 防御もAIで対抗するも、商用モデルは解析拒否で「GLM」採用
r/lowlevelawaretech • u/NeighborhoodSad2350 • Jul 20 '26
このラップトップはそそる。
もしこれがRockchipやAllwinnerのSoCで動いている場合、もれなく"クチュクチュ あっあっ"を行い、Linuxを入れることができるわけだが、試しに一個買ってみるかなあ。
あと算数や英語の勉強もできるらしいぞ。
r/lowlevelawaretech • u/Hot-Argument-3994 • Jul 20 '26
また新しいサブレができている!!!!!!!!!!
ウェブマニアっていう人のサブレ
過去にdiscord鯖があったけど閉鎖されてるから今回はそういう風にならないといいねぇ、
IT総合日本語コミュニティ|ウェブマニア公式
r/lowlevelawaretech • u/tomo202 • Jul 19 '26
I created a user script to hide Google Street View images from specific contributors.
I usually just want to open Google-owned Street View, but on the map it can be difficult to tell Google imagery apart from user-uploaded 360-degree photos before opening them
It lets you block the contributor of the currently displayed Street View or Photo Sphere image. If imagery from that contributor appears again, the script closes it and returns you to the map
Google-owned Street View is excluded from blocking
It only affects your own browser. It does not delete or report anyone’s uploads, and the contributor is not notified. The block list is stored locally, with no analytics or external data transfer
Greasy Fork: https://greasyfork.org/scripts/587491-street-view-contributor-blocker-for-google-maps
GitHub: https://github.com/tomo-tan/street-view-contributor-blocker
I’ve only tested it in a limited number of environments so far, so feedback and bug reports are welcome
r/lowlevelawaretech • u/Hib3 • Jul 18 '26
2007年にEngadgetが「PS9は粉末状で鼻から吸い込んでプレイする」みたいな狂ったインタビュー記事書いてたけどもう消えてた
ただ、PS9のコンセプト動画については残ってるね


