set -gx VIRTUAL_ENV_PROMPT "Xenith" complete -c Xenith -erase complete -c ./bin/Xenith -erase complete -c Xenith -f complete -c ./bin/Xenith -f set -l main_commands "new:создать новую модель из корпуса" \ "train:обучить существующую модель" \ "gen:сгенерировать текст" \ "info:показать конфигурацию модели" \ "gradcheck:проверить градиенты численно" \ "bench:замерить скорость форварда и шага обучения" \ "update:Автомотическое обновление с гита" for cmd in $main_commands set -l parts (string split ":" $cmd) complete -c Xenith -n "__fish_use_subcommand" -a $parts[1] -d $parts[2] complete -c ./bin/Xenith -n "__fish_use_subcommand" -a $parts[1] -d $parts[2] end set -l new_cond "__fish_seen_subcommand_from new" complete -c Xenith -n $new_cond -l corpus -r -F -d "текст для построения словаря (обязательно)" complete -c Xenith -n $new_cond -l out -r -F -d "файл модели (по умолчанию model.xnh)" complete -c Xenith -n $new_cond -l vocab -r -d "размер словаря (по умолчанию 512)" complete -c Xenith -n $new_cond -l embd -r -d "размер эмбеддинга (по умолчанию 128)" complete -c Xenith -n $new_cond -l layers -r -d "число слоёв (по умолчанию 4)" complete -c Xenith -n $new_cond -l heads -r -d "число голов (по умолчанию 4)" complete -c Xenith -n $new_cond -l ctx -r -d "максимальный контекст (по умолчанию 128)" complete -c Xenith -n $new_cond -l ffn -r -d "размер FFN (по умолчанию 4*embd)" complete -c Xenith -n $new_cond -l rope -r -d "база RoPE (по умолчанию 10000)" complete -c Xenith -n $new_cond -l seed -r -d "зерно инициализации (по умолчанию 1337)" complete -c Xenith -n $new_cond -l untied -d "отдельная матрица выхода вместо привязанной к wte" complete -c Xenith -n $new_cond -l view-vocab -d "выводит словарь нейросети" set -l train_cond "__fish_seen_subcommand_from train" complete -c Xenith -n $train_cond -l corpus -r -F -d "обучающий текст (обязательно)" complete -c Xenith -n $train_cond -l out -r -F -d "куда сохранить (по умолчанию перезапись входного файла)" complete -c Xenith -n $train_cond -l steps -r -d "шагов (по умолчанию 1000)" complete -c Xenith -n $train_cond -l batch -r -d "батч (по умолчанию 8)" complete -c Xenith -n $train_cond -l block -r -d "длина окна (по умолчанию 64)" complete -c Xenith -n $train_cond -l lr -r -d "скорость (по умолчанию 3e-4)" complete -c Xenith -n $train_cond -l wd -r -d "weight decay (по умолчанию 0.01)" complete -c Xenith -n $train_cond -l clip -r -d "клип нормы градиента (по умолчанию 1.0)" complete -c Xenith -n $train_cond -l warmup -r -d "прогрев (по умолчанию 100)" complete -c Xenith -n $train_cond -l seed -r -d "зерно (по умолчанию 1337)" complete -c Xenith -n $train_cond -l ckpt-every -r -d "промежуточное сохранение каждые N шагов" complete -c Xenith -n $train_cond -l val-every -r -d "валидация каждые N шагов" complete -c Xenith -n $train_cond -l val-tokens -r -d "размер валидации (по умолчанию 20000)" complete -c Xenith -n $train_cond -l threads -r -d "потоков (0 = все ядра)" complete -c Xenith -n $train_cond -l resume -d "продолжить с сохранённого step (Adam-state из файла)" set -l gen_cond "__fish_seen_subcommand_from gen" complete -c Xenith -n $gen_cond -l prompt -r -d "стартовый текст" complete -c Xenith -n $gen_cond -l n -r -d "сколько токенов (по умолчанию 200)" complete -c Xenith -n $gen_cond -l temp -r -d "температура, 0 = жадный выбор (по умолчанию 0.8)" complete -c Xenith -n $gen_cond -l top-k -r -d "top-k (0 = выкл)" complete -c Xenith -n $gen_cond -l top-p -r -d "top-p (1.0 = выкл)" complete -c Xenith -n $gen_cond -l seed -r -d "зерно" complete -c Xenith -n $gen_cond -l no-stream -d "не печатать в процессе" complete -c Xenith -n $gen_cond -l batch -r -d "несколько промптов через ;" complete -c Xenith -n $gen_cond -l show-tokens -d "показать id токенов" complete -c ./bin/Xenith -n "__fish_seen_subcommand_from new" -a "(complete -C'Xenith new ')" complete -c ./bin/Xenith -n "__fish_seen_subcommand_from train" -a "(complete -C'Xenith train ')" complete -c ./bin/Xenith -n "__fish_seen_subcommand_from gen" -a "(complete -C'Xenith gen ')" function Xenith ./bin/Xenith $argv end if not set -q _OLD_VIRTUAL_PS1 functions -c fish_prompt _old_fish_prompt function fish_prompt echo -n "($VIRTUAL_ENV_PROMPT) " _old_fish_prompt end set -g _OLD_VIRTUAL_PS1 1 end echo "Xenith activate" function deactivate functions -e Xenith if functions -q _old_fish_prompt functions -e fish_prompt functions -c _old_fish_prompt fish_prompt functions -e _old_fish_prompt end set -e VIRTUAL_ENV_PROMPT set -e _OLD_VIRTUAL_PS1 complete -c Xenith -erase complete -c ./bin/Xenith -erase functions -e deactivate echo "Xenith deactivated" end