ml # list these loaded modules ml miniconda3 # load the miniconda3 module ml -miniconda3 # unload the miniconda3 module module spider # inspect the possible modules that can be loaded module spider cuda # show available cuda versions
conda env config vars set LD_LIBRARY_PATH="/home/cyl/miniconda3/envs/dinov2/lib/" conda env config vars set CPATH="/home/cyl/miniconda3/envs/dinov2/include/" conda env config vars set CUDA_HOME="/home/cyl/miniconda3/envs/dinov2/"
export DATASET=/pth/to/dataset # path to your coco data
一些绊脚石 ^ ^
1
根据[[Cuda+Torch]],需要先安装cudatoolkit和cuda-toolkit
1 2 3 4 5
conda install nvidia/label/cuda-11.7.0::cuda-toolkit -c nvidia/label/cuda-11.7.0 conda install cudatoolkit # no need to specify version conda env config vars set LD_LIBRARY_PATH="/home/cyl/miniconda3/envs/<name>/lib/" conda env config vars set CPATH="/home/cyl/miniconda3/envs/<name>/include/" conda env config vars set CUDA_HOME="/home/cyl/miniconda3/envs/<name>/"
如果编译时出现ld: cannot find -lcudart: No such file or directory collect2: error: ld returned 1 exit status 报错,只是因为没有安装cudatoolkit ^ ^
3
安装完成后直接import semantic_sam会报错ModuleNotFoundError: No module named 'MultiScaleDeformableAttention' ^ ^ 提示:
1 2 3
Please compile MultiScaleDeformableAttention CUDA op with the following commands: `cd mask2former[/modeling/pixel_decoder/ops](http://127.0.0.1:8888/modeling/pixel_decoder/ops)` `sh make.sh`
需要手动make一下 Mask2Former:
1 2
cd Mask2Former/mask2former/modeling/pixel_decoder/ops/ sh make.sh
conda env config vars set LD_LIBRARY_PATH="/home/cyl/miniconda3/envs/gsam/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/:$LD_LIBRARY_PATH" conda env config vars set CPATH="/home/cyl/miniconda3/envs/gsam/lib/python3.10/site-packages/nvidia/cuda_runtime/include/:$CPATH" conda env config vars set CUDA_HOME="/home/cyl/miniconda3/envs/gsam/"
Note: 注意改变了库路径之后nvim中的lsp会报错,建议之后改回去
1 2 3
conda env config vars set LD_LIBRARY_PATH="" conda env config vars set CPATH="" conda env config vars set CUDA_HOME=""
Note: To find the correct path for CUDA_HOME use which nvcc. In my case, output of the command was:
1 2
>>> which nvcc /home/user/miniconda3/envs/py12/bin/nvcc
Therefore, I set the CUDA_HOME as /home/user/miniconda3/envs/py12/.
Note: To find the correct path for LD_LIBRARY_PATH use find ~ -name cuda_runtime_api.h. In my case, output of the command was:
So I set the LD_LIBRARY_PATH as /home/user/miniconda3/envs/py12/targets/x86_64-linux/lib/ and CPATH as /home/user/miniconda3/envs/py12/targets/x86_64-linux/include/. If you have multiple CUDA installations, the output of find ~ -name cuda_runtime_api.h will display multiple paths. Make sure to choose the path that corresponds to the environment you have created.
... [I 2024-12-10 14:30:24.585 ServerApp] http://127.0.0.1:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c [I 2024-12-10 14:30:24.586 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 2024-12-10 14:30:24.603 ServerApp]
To access the server, open this file in a browser: file:///home/bohanfeng/.local/share/jupyter/runtime/jpserver-11659-open.html Or copy and paste one of these URLs: http://localhost:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c http://127.0.0.1:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c
I use a hyprland plugin called hyprscroller to emulate the scroll functionality of PaperWM. However, I can’t get whether I am in row mode or column mode, so I want to show the mode status on my waybar.
scroller_mode_listener.sh, responsible for listening the IPC message of hyprscroller and store that information in a tmp file. This script can be executed in hyprland config file using exec-once
The lua scripts in plugin/ will be executed automatically and the scripts in lua/ will be called when required
To let nvim load the plugin, use lazy.nvim. Add this line in your lazy.nvim configuration:
1
{ dir = "/home/cyl/nvim_plugins/ColorfulDiff.nvim/" },
Then this plugin will be loaded on start.
How To Use API
Use :Telescope help_tags or short hand <Ctrl-h> to open the help search panel. If I want to know the API regarding the highlight:
the function with `nvim_` as prefix are the nvim api. Press `Enter` to see the detailed description:
1 2 3 4 5 6 7 8
*nvim_buf_add_highlight()* nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line},{col_start},{col_end}) Adds a highlight to buffer.
Useful for plugins that dynamically generate highlights to a buffer (like a semantic highlighter or linter). The function adds a single highlight to a buffer. Unlike |matchaddpos()| highlights follow changes to line numbering (as lines are inserted/removed above the highlighted line), like signs and marks do. ...
To use this api:
1
vim.api.nvim_buf_add_highlight(...)
Test
Create a new folder called test And create the test lua file