{
    "version": "https://jsonfeed.org/version/1",
    "title": "Study Notes",
    "subtitle": "",
    "icon": "http://longliveforfreedom.github.io/images/favicon.ico",
    "description": "",
    "home_page_url": "http://longliveforfreedom.github.io",
    "items": [
        {
            "id": "http://longliveforfreedom.github.io/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/",
            "url": "http://longliveforfreedom.github.io/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/",
            "title": "Implement-HiVT-with-Latest-pytorch-and-pl-Version",
            "date_published": "2025-02-28T07:11:57.000Z",
            "content_html": "<h1 id=\"implementdeploy-hivt-with-latest-pytorchpytorch-lightning-version\"><a class=\"anchor\" href=\"#implementdeploy-hivt-with-latest-pytorchpytorch-lightning-version\">#</a> Implement(deploy) HiVT with latest pytorch&amp;pytorch-lightning version</h1>\n<ul>\n<li>refer to <span class=\"exturl\" data-url=\"aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2tkZGIxMjM0L2FydGljbGUvZGV0YWlscy8xMzY4MzEyNTg=\">https://blog.csdn.net/kddb1234/article/details/136831258</span>, <span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL3B5Zy10ZWFtL3B5dG9yY2hfZ2VvbWV0cmljL2lzc3Vlcy80MzU4\">https://github.com/pyg-team/pytorch_geometric/issues/4358</span> and <span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL2d6ZXJ2ZWFzL212dHNfdHJhbnNmb3JtZXIvaXNzdWVzLzY4\">https://github.com/gzerveas/mvts_transformer/issues/68</span></li>\n<li>the official env of HiVT is pytorch 1.8, python 3.8, pytorch-geometric 1.7.2, pytorch-lightning 1.5.2 and cuda 11.1, which versions are too early. So, this blog will deploy HiVT with higher version of torch&amp;pl with python 3.10, pytorch 2.1.0, pytorch-lightning 2.0.3, PyG 2.3.1 and cuda 12.1.</li>\n</ul>\n<h1 id=\"preparation\"><a class=\"anchor\" href=\"#preparation\">#</a> Preparation</h1>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">conda create -n HiVT python=3.10</span><br><span class=\"line\">conda activate HiVT</span><br><span class=\"line\">conda install pytorch==2.1.0 cudatoolkit=12.1 -c pytorch -c conda -forge</span><br><span class=\"line\">conda install pytorch-geometric==2.3.1 -c rusty1s -c conda-forge</span><br><span class=\"line\">conda install pytorch-lightning==2.0.3 -c conda-forge</span><br></pre></td></tr></table></figure>\n<h1 id=\"modification-of-hivt-src\"><a class=\"anchor\" href=\"#modification-of-hivt-src\">#</a> Modification of hivt src</h1>\n<h2 id=\"trainpy\"><a class=\"anchor\" href=\"#trainpy\">#</a> <span class=\"exturl\" data-url=\"aHR0cDovL3RyYWluLnB5\">train.py</span></h2>\n<ul>\n<li>the “gpus” in parser should be changed to “devices”</li>\n</ul>\n<img data-src=\"/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/1.png\" class title=\"gpus\">\n<ul>\n<li>the ArgoverseV1DataModule has no from_argoverse_args function any more, it can be input directly like:</li>\n</ul>\n<img data-src=\"/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/2.png\" class title=\"datamodule\">\n<ul>\n<li>similarly to the datamodule, pl.Trainer should also be fixed</li>\n</ul>\n<img data-src=\"/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/3.png\" class title=\"trainer\">\n<h2 id=\"adepy\"><a class=\"anchor\" href=\"#adepy\">#</a> <span class=\"exturl\" data-url=\"aHR0cDovL2FkZS5weQ==\">ade.py</span> and other metrics</h2>\n<ul>\n<li>the compute_on_step parameter is no need, just delete it from the input parameter of <strong>init</strong> function</li>\n</ul>\n<img data-src=\"/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/4.png\" class title=\"metrics\">\n<ul>\n<li>same applies to other py files in the metrics directory</li>\n</ul>\n<h2 id=\"local_encoderpy\"><a class=\"anchor\" href=\"#local_encoderpy\">#</a> local_encoder.py</h2>\n<p>the new version of nn.Transformer add a parameter is_causal so it should be added in the TemporalEncoder class, which employs nn.TransformerEncoder as transformer_encoder variable</p>\n<img data-src=\"/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/5.png\" class title=\"is_causal\">\n<h1 id=\"modification-of-pyg-code\"><a class=\"anchor\" href=\"#modification-of-pyg-code\">#</a> Modification of PyG code</h1>\n<p>find the <span class=\"exturl\" data-url=\"aHR0cDovL2NvbGxhdGUucHk=\">collate.py</span> in the directory .conda/envs/${your env name}/lib/python3.10/site-pacakages/torch_geometric/data/collate.py. Then find the get_incs function and delete the input variable ‘store’ of data.<strong>inc</strong>()</p>\n<figure class=\"highlight plaintext\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">cd .conda/envs/$&#123;your env name&#125;/lib/python3.10/site-pacakages/torch_geometric/data</span><br><span class=\"line\">gedit collate.py</span><br></pre></td></tr></table></figure>\n<img data-src=\"/2025/02/28/Implement-HiVT-with-Latest-pytorch-and-pl-Version/6.png\" class title=\"pyg\">\n<h1 id=\"others\"><a class=\"anchor\" href=\"#others\">#</a> Others</h1>\n<p>If you encounter problems about variables, add ‘**kwargs’ in forward() function may be help</p>\n<h1 id=\"now-you-can-try-to-train-hivt-follow-the-official-doc\"><a class=\"anchor\" href=\"#now-you-can-try-to-train-hivt-follow-the-official-doc\">#</a> Now you can try to train HiVT follow the official doc</h1>\n<ul>\n<li>official doc: <span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL1ppa2FuZ1pob3UvSGlWVA==\">https://github.com/ZikangZhou/HiVT</span></li>\n</ul>\n",
            "tags": []
        },
        {
            "id": "http://longliveforfreedom.github.io/2024/11/06/hello-world/",
            "url": "http://longliveforfreedom.github.io/2024/11/06/hello-world/",
            "title": "Hello World",
            "date_published": "2024-11-06T08:54:04.531Z",
            "content_html": "<p>Welcome to <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvLw==\">Hexo</span>! This is your very first post. Check <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL2RvY3Mv\">documentation</span> for more info. If you get any problems when using Hexo, you can find the answer in <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL2RvY3MvdHJvdWJsZXNob290aW5nLmh0bWw=\">troubleshooting</span> or you can ask me on <span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL2hleG9qcy9oZXhvL2lzc3Vlcw==\">GitHub</span>.</p>\n<h2 id=\"quick-start\"><a class=\"anchor\" href=\"#quick-start\">#</a> Quick Start</h2>\n<h3 id=\"create-a-new-post\"><a class=\"anchor\" href=\"#create-a-new-post\">#</a> Create a new post</h3>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo new <span class=\"string\">&quot;My New Post&quot;</span></span><br></pre></td></tr></table></figure>\n<p>More info: <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL2RvY3Mvd3JpdGluZy5odG1s\">Writing</span></p>\n<h3 id=\"run-server\"><a class=\"anchor\" href=\"#run-server\">#</a> Run server</h3>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo server</span><br></pre></td></tr></table></figure>\n<p>More info: <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL2RvY3Mvc2VydmVyLmh0bWw=\">Server</span></p>\n<h3 id=\"generate-static-files\"><a class=\"anchor\" href=\"#generate-static-files\">#</a> Generate static files</h3>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo generate</span><br></pre></td></tr></table></figure>\n<p>More info: <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL2RvY3MvZ2VuZXJhdGluZy5odG1s\">Generating</span></p>\n<h3 id=\"deploy-to-remote-sites\"><a class=\"anchor\" href=\"#deploy-to-remote-sites\">#</a> Deploy to remote sites</h3>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo deploy</span><br></pre></td></tr></table></figure>\n<p>More info: <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL2RvY3Mvb25lLWNvbW1hbmQtZGVwbG95bWVudC5odG1s\">Deployment</span></p>\n",
            "tags": []
        },
        {
            "id": "http://longliveforfreedom.github.io/2024/11/06/Deploy-My-Own-Blog/",
            "url": "http://longliveforfreedom.github.io/2024/11/06/Deploy-My-Own-Blog/",
            "title": "Deploy My Own Blog",
            "date_published": "2024-11-06T05:39:36.000Z",
            "content_html": "<h1 id=\"deploy-my-own-blog-with-hexotheme-shoka-and-github\"><a class=\"anchor\" href=\"#deploy-my-own-blog-with-hexotheme-shoka-and-github\">#</a> Deploy my own blog with hexo(theme: Shoka) and github</h1>\n<h2 id=\"prepare\"><a class=\"anchor\" href=\"#prepare\">#</a> Prepare</h2>\n<ul>\n<li>a github account</li>\n<li>install Git(get ssh working) and Nodejs on your PC or Mac</li>\n</ul>\n<h2 id=\"hexo\"><a class=\"anchor\" href=\"#hexo\">#</a> Hexo</h2>\n<ul>\n<li>install<br>\n <code>sudo npm install -g hexo-cli</code> <br>\nwithout sudo may encounter permission issues result in install fail</li>\n<li>init your blog folder<br>\n <code>hexo init blog</code> <br>\n <code>cd blog</code></li>\n</ul>\n<img data-src=\"/2024/11/06/Deploy-My-Own-Blog/image.png\" class title=\"opration\">\n<ul>\n<li>install some dependencies<br>\n <code>sudo npm install</code> <br>\n <code>sudo npm install hexo-deployer-git --save</code></li>\n<li>get writing root for blog file<br>\n <code>sudo chmod -R 777 blog</code></li>\n<li>preview your blog<br>\n <code>hexo s</code> <br>\nvisit <span class=\"exturl\" data-url=\"aHR0cDovL2xvY2FsaG9zdDo0MDAwLw==\">http://localhost:4000/</span> you will see your blog page</li>\n<li>(optional) download a theme from <span class=\"exturl\" data-url=\"aHR0cHM6Ly9oZXhvLmlvL3RoZW1lcy8=\">https://hexo.io/themes/</span> and move the file to /blog/themes</li>\n<li>the Shoka theme is here <span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL2FtZWhpbWUvaGV4by10aGVtZS1zaG9rYQ==\">https://github.com/amehime/hexo-theme-shoka</span></li>\n</ul>\n<h2 id=\"github-pages\"><a class=\"anchor\" href=\"#github-pages\">#</a> Github pages</h2>\n<ul>\n<li>create a repository namely <span class=\"exturl\" data-url=\"aHR0cDovL3VzZXJuYW1lLmdpdGh1Yi5pbw==\">username.github.io</span></li>\n<li>modify the deploy section in /root/_config.yml</li>\n</ul>\n<figure class=\"highlight shell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">deploy:</span><br><span class=\"line\">  type: git</span><br><span class=\"line\">  repo: https://github.com/username/username.github.io.git</span><br><span class=\"line\">  branch: main</span><br></pre></td></tr></table></figure>\n<ul>\n<li>after coding your blog, you can deploy it<br>\n <code>hexo g</code> <br>\n <code>hexo d</code></li>\n<li>visit <span class=\"exturl\" data-url=\"aHR0cDovL3VzZXJuYW1lLmdpdGh1Yi5pbw==\">http://username.github.io</span> then you will see your blog</li>\n</ul>\n<h2 id=\"create-a-new-blog\"><a class=\"anchor\" href=\"#create-a-new-blog\">#</a> Create a new blog</h2>\n<p><code>hexo new &quot;new blog name&quot;</code> <br>\nput the picture in file with the same name of the new blog</p>\n<ul>\n<li>note: the title should not include special symbol such as ‘&amp;’</li>\n</ul>\n<h2 id=\"back-up-the-source-code-in-another-branch-of-the-repo\"><a class=\"anchor\" href=\"#back-up-the-source-code-in-another-branch-of-the-repo\">#</a> Back up the source code in another branch of the repo</h2>\n<p>refer to <span class=\"exturl\" data-url=\"aHR0cHM6Ly9ibG9nLjUxY3RvLmNvbS91XzE0MjMzMDM3LzU4MjQ1MjQ=\">https://blog.51cto.com/u_14233037/5824524</span></p>\n<ul>\n<li>enter the .deploy_git(hidden file) folder<br>\n <code>cd .deploy_git</code></li>\n<li>create a branch called src<br>\n <code>sudo git branch src</code></li>\n<li>then copy the .git(also hidden) file to the blog path(parent directory)</li>\n<li>associate the path to the repo<br>\n <code>sudo git remote add origin https://github.com/username/username.github.io.git</code></li>\n<li>run the command you will see the repo info<br>\n <code>sudo git remote show origin</code></li>\n<li>添加保存改动</li>\n</ul>\n<figure class=\"highlight shell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">sudo git add .</span><br><span class=\"line\">sudo git commit -m &quot;source code updata&quot;</span><br></pre></td></tr></table></figure>\n<ul>\n<li>change to the src branch<br>\n <code>sudo git checkout src</code></li>\n<li>pull your local source code to the repo<br>\n <code>sudo git push origin src:src</code></li>\n<li>every time update following commands are needed</li>\n</ul>\n<figure class=\"highlight shell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">sudo git add .</span><br><span class=\"line\">sudo git commit -m &quot;xxx&quot;</span><br><span class=\"line\">sudo git checkout src</span><br><span class=\"line\">sudo git push origin src:src</span><br></pre></td></tr></table></figure>\n",
            "tags": []
        },
        {
            "id": "http://longliveforfreedom.github.io/2024/11/05/Remote-Control-with-RustDesk/",
            "url": "http://longliveforfreedom.github.io/2024/11/05/Remote-Control-with-RustDesk/",
            "title": "Remote Control with RustDesk",
            "date_published": "2024-11-05T14:43:46.000Z",
            "content_html": "<h1 id=\"remote-control-with-rustdesk-and-zerotiermacbook-as-control-end-ubuntu-as-controlled-end-raspberrypi4b-as-relay-server\"><a class=\"anchor\" href=\"#remote-control-with-rustdesk-and-zerotiermacbook-as-control-end-ubuntu-as-controlled-end-raspberrypi4b-as-relay-server\">#</a> Remote Control with rustdesk and zerotier(Macbook as control end, ubuntu as controlled end, raspberrypi4B as relay server)</h1>\n<h2 id=\"preface\"><a class=\"anchor\" href=\"#preface\">#</a> Preface</h2>\n<ul>\n<li>macbook: m1 pro</li>\n<li>raspberry pi 4B with 4G ram and Ubuntu 20</li>\n<li>linux PC with ubuntu 20.04</li>\n<li>课题组的服务器在 1 楼，工位在 4 楼，因此需要远程。todesk 和向日葵免费版的都很糊而且 todesk 免费时长有限又需要经常登陆微信，不好用。</li>\n</ul>\n<h2 id=\"prepare\"><a class=\"anchor\" href=\"#prepare\">#</a> Prepare</h2>\n<h3 id=\"control-end\"><a class=\"anchor\" href=\"#control-end\">#</a> Control end</h3>\n<ul>\n<li>download rustdesk for mac: 官网 https://rustdesk.com/，选择 macos arm64 下载</li>\n<li>download zerotier(make sure that ssh is working)<br>\n <code>curl -s https://install.zerotier.com | sudo bash</code></li>\n</ul>\n<h3 id=\"controlled-end\"><a class=\"anchor\" href=\"#controlled-end\">#</a> Controlled end</h3>\n<p>与控制端同理</p>\n<h3 id=\"relay-server\"><a class=\"anchor\" href=\"#relay-server\">#</a> Relay server</h3>\n<ul>\n<li>download zerotier as before</li>\n<li>download rustdesk-server(Note that it’s not rustdesk, it’s rustdesk-server, i.e. the rustdesk server) in here <span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL3J1c3RkZXNrL3J1c3RkZXNrLXNlcnZlci9yZWxlYXNlcw==\">https://github.com/rustdesk/rustdesk-server/releases</span>, download hbbs-arm64 and hbbr-arm64(raspberry pi is arm architecture) then unzip</li>\n<li>pm2 is used to manage process hbbs and hbbr, so nodejs and npm are needed\n<ul>\n<li>install nodejs<br>\n <code>$ sudo apt install nodejs</code></li>\n<li>install npm<br>\n <code>$ sudo apt install npm</code> <br>\n <code>$ npm install -g n</code></li>\n<li>install pm2<br>\n <code>$ npm install pm2 -g</code> <br>\n <code>$ pm2 completion install</code></li>\n<li>check process list<br>\n <code>$ pm2 ls</code></li>\n</ul>\n</li>\n</ul>\n<img data-src=\"/2024/11/05/Remote-Control-with-RustDesk/image.png\" class title=\"pm list\">\n<ul>\n<li>enter the  directory hbbs and hbbr and run them respectively<br>\n <code>$ cd /Rustdesk/rustdesk-server-hbbs_1.1.11-1_arm64/data/usr/bin</code> <br>\n <code>$ pm2 start hbbs</code> <br>\n <code>$ cd /Rustdesk/rustdesk-server-hbbr_1.1.11-1_arm64/data/usr/bin</code> <br>\n <code>$ pm2 start hbbr</code></li>\n<li>copy the key in the file with pub suffix in the hbbs folder and it will be used later</li>\n<li>Open these ports on the firewall:\n<ul>\n<li>TCP(21115, 21116, 21117, 21118, 21119)</li>\n<li>UDP(21116)</li>\n</ul>\n</li>\n</ul>\n<h3 id=\"zerotier\"><a class=\"anchor\" href=\"#zerotier\">#</a> Zerotier</h3>\n<p>Register a zerotier account(<span class=\"exturl\" data-url=\"aHR0cHM6Ly93d3cuemVyb3RpZXIuY29tLw==\">https://www.zerotier.com/</span>) and create a network. Join the network in all three devices. Log in to the zerotier official website, enter the network, tick these devices, and authorize them. Get the IP address of these 3 devices</p>\n<h2 id=\"lets-go\"><a class=\"anchor\" href=\"#lets-go\">#</a> Let’s Go</h2>\n<img data-src=\"/2024/11/05/Remote-Control-with-RustDesk/image2.png\" class title=\"rustdesk\">\n<p>In both of control end and controlled end, 点击 ID 旁边的三个点选择 Network，然后解锁，ID server 和 Relay server 均填入 relay server 的内网 IP，api server 不填，key 中填入此前保存的 hbbs key。Control end 中输入 controlled end 的 ID 即可连接。</p>\n<h1 id=\"some-problems\"><a class=\"anchor\" href=\"#some-problems\">#</a> Some Problems</h1>\n<p>these may work<br>\n<span class=\"exturl\" data-url=\"aHR0cHM6Ly9naXRodWIuY29tL3J1c3RkZXNrL3J1c3RkZXNrL2lzc3Vlcy80NDAjaXNzdWUtMTE5MTAyMDIyNQ==\">https://github.com/rustdesk/rustdesk/issues/440#issue-1191020225</span></p>\n<!-- ---\n\ndate: 2024-11-05 22:30:01\ntags:\n--- -->",
            "tags": []
        }
    ]
}