Run-Others-Java-Projects

🤔 如何运行别人的 Java 项目

[TOC]

刚到公司,导师给了一个 Java 项目,搞了一下午没搞定。(卒)

⤵️ 1. 克隆项目仓库

首先使用 GitLab 将代码拉取下来。

1
2
NilEra@MS-202109171212 MINGW64 /d/LocalGit
$ git clone https://<username>:<access token>@git.xxx.com/...projectName.git

2. 配置项目信息

idea 打开项目后,进入 idea 进行配置。

主要注意:JDK 版本一般是 JDK1.8maven 需要选择自己的 maven,这里我的版本为 3.6.1,如果使用 Idea 自带的 maven(虽然版本也是 3.6.1),但是可能会导致一些问题,这里我遇到的包括但不限于:

  • 明明有错误但是 Reimport 后检测不出错误
  • 有一些包没法正常的安装
  • 有一些包虽然正常安装了,但是却没法正常检测
  • 总之就是非常多的坑

选择 POM 文件,右键 Add as Maven Project

Add

Node版本不适应,node 12-14

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
npm ERR! code 1
npm ERR! path D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: D:\nvm\nodejs\node.exe D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'D:\\nvm\\nodejs\\node.exe',
npm ERR! gyp verb cli 'D:\\Inspur\\LocalGit\\base-vap\\src\\frontend\\web\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.20.2 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python D:\Python311\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: D:\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:402:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1100:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "D:\\nvm\\nodejs\\node.exe" "D:\\Inspur\\LocalGit\\base-vap\\src\\frontend\\web\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.20.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2024-10-17T07_55_40_886Z-debug-0.log

RedHat-Build-LLM

如何在 Linux 服务器上搭建本地LLMs (RedHat 篇)🤔

最近因为一些原因,需要在一台 RedHat 红帽机器上配置一个 qwen2-7B 模型来进行离线大模型的使用。过程非常曲折,特此记录本次过程。

拿到服务器账号之后,我先检查了一些环境配置,个人用户缺失很多环境,好消息是 root 用户可以使用 nvcc 命令。那么我们就可以不用费劲去安装 cuda 了。

那么我首先使用个人用户安装了 Anaconda。安装过程如下:

安装完成后,配置环境变量,创建虚拟环境(这里我使用的 Python 版本是我参考的组卡平台的版本,这个版本经过测试不存在什么问题)。

1
conda create -n qwen2 python=3.10.12

启动虚拟环境时可能会遇到问题:

① 出现错误:CondaError: Run 'conda init' before 'conda activate'

② 换源问题

然后我继续向下推进:

我们切换到 qwen2 环境,正常安装相应的 modelscope 软件包。

1
pip install modelscope

目前为止一切顺利。我们需要使用 git 命令将 llama.cpp 拉到本地,因为这个服务器无法访问 GitHub,这里我们可以使用 Gitee 来进行替代。使用 Gitee 可以将 GitHub 上的仓库拉取下来:

GiteePullGithub GiteePullGithub GiteePullGithub

然后对于 Gitee 中的文件,我们使用 wget 命令下载即可。

更新 GCC

⭐⭐Linux升级gcc到最新版本gcc-11.2.0_更新gcc-CSDN博客

⭐⭐⭐Linux gcc升级全过程,过程超详细-阿里云开发者社区 (aliyun.com)

安装 Ccache

  1. 从官方网站下载 CcacheCcache — Compiler cache,我们也可以从 GitHubReleases 页面上找到较旧的版本。

  2. 使用 tar -zxvf ccache-<VERSION>-linux-x86_64.tar.xz 命令,解压 Ccache 到文件夹

  3. 较早的版本需要执行三条语句进行安装

    1
    2
    3
    ./configure
    make
    sudo make install
  4. 较新的版本提供了一键安装方式

    1
    2
    # 一般为 /usr/local/ccache-your-version_num
    make install prefix=/usr/local/ccache-4.9
  5. 配置环境变量

  6. 检查 Ccache 的版本

    1
    ccache -V

安装 MPFRGMP

安装 MPC

  1. 官网:Download — multiprecision.org

问题:

error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory 安装 libmpfr6-4.1.0-alt1.x86_64.rpm 并且将缺少的库放到 /usr/lib64 中。

下载地址:libmpfr6-4.1.0-alt1.x86_64.rpm ALT Linux P10 Download (pkgs.org)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost gcc_bag]# wget https://altlinux.pkgs.org/sisyphus/classic-x86_64/libmpfr6-4.1.0-alt2.x86_64.rpm.html
[root@localhost gcc_bag]# ls
libmpfr6-4.1.0-alt2.x86_64.rpm
[root@localhost gcc_bag]# rpm2cpio libmpfr6-4.1.0-alt2.x86_64.rpm | cpio -div

[root@localhost gcc_bag]# rpm2cpio libmpfr6-4.1.0-alt2.x86_64.rpm | cpio -div
./usr/lib64/libmpfr.so.6
./usr/lib64/libmpfr.so.6.1.0
./usr/share/doc/mpfr-4.1.0
./usr/share/doc/mpfr-4.1.0/AUTHORS
./usr/share/doc/mpfr-4.1.0/BUGS
./usr/share/doc/mpfr-4.1.0/NEWS
5494 blocks

[root@localhost gcc_bag]# ls
libmpfr6-4.1.0-alt2.x86_64.rpm usr

[root@localhost gcc_bag]# mv ./usr/lib64/libmpfr.so.6 /usr/lib64/
[root@localhost gcc_bag]# mv ./usr/lib64/libmpfr.so.6.1.0 /usr/lib64/

更新 binutils,包括 ldas

binutils 镜像:Index of /gnu/binutils

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@localhost Share]# wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2  
//wget如果下载不下来就 直接浏览器访问网址下载后再解压
[root@localhost Share]# tar -xjf binutils-2.25.1.tar.bz2
[root@localhost Share]# cd binutils-2.25.1
[root@localhost binutils-2.25.1]# ./configure --prefix=/usr
[root@localhost binutils-2.25.1]# make
[root@localhost binutils-2.25.1]# make install
//安装完毕验证结果
[root@localhost binutils-2.25.1]# as --version
GNU assembler (GNU Binutils) 2.25.1
[root@localhost binutils-2.25.1]# objdump -v
GNU objdump (GNU Binutils) 2.25.1
[root@localhost binutils-2.25.1]# ld -v
GNU ld (GNU Binutils) 2.25.1

安装 nvcc

https://blog.csdn.net/bigbaojian/article/details/129642388

Linux 下的 CUDA 安装和使用指南 - 知乎 (zhihu.com)

SVN-Quick-IN

SVN 快速入门

SVN 全称为 SubVersion,是近年来崛起的版本管理控制,是 CVS 的接班人。目前,绝大多数软件公司都使用SVN 作为代码版本管理软件。SVN 为了解决协作开发、远程开发。

特点:操作简单、入门容易、支持跨平台、支持版本回退功能。

安装出现问题:

Product: VisualSVN Server 5.4.0 – Error 25015. Failed to start HTTP service: The service has exited with a service-specific error code (1).

(OS 10013) 以一种访问权限不允许的方式做了一个访问套接字的尝试。

How2Use_Stable_Diffusion

🤔 How To Use Stable Diffusion

Extension:

ChatGPT-4V

1
2
chmod u+x install_linux_mac.sh
./install_linux_mac.sh

出现错误:

ImportError: Using SOCKS proxy, but the ‘socksio’ package is not installed. Make sure to install httpx using pip install httpx[socks].

unset all_proxy && unset ALL_PROXY

Kolmogorov-Arnold Networks

Kolmogorov-Arnold Networks (KAN)

What KAN I Say ? MLP OUT !

Kolmogorov-Arnold Networks(KAN)

[TOC]

KAN 源码中的核心组件:

核心代码 主要内容
KAN.py 主要的文件,包含定义 KAN 模型的主要类和函数,定义了 KAN 模型,它由多个 KANLayerSymbolic_KANLayer 组成,包含前向传播、模式设置、符号激活函数的固定和建议、模型训练、剪枝以及可视化等功能。
KANLayer.py 定义 KAN 模型中使用的自定义层,包括模型的核心组件,如特殊的激活函数或其他处理层,是构成 KAN 的基础。
LBFGS.py 包含使用 KAN 训练的 L-BFGS 优化器的实现,用于在训练过程中对 KAN 的参数进行优化。
Symbolic_KANLayer.py 实现了一种特殊的 KAN 层,用于处理符号计算或增强模型解释性,用符号函数(如正弦)来代替传统的数值激活函数。以便深入分析和解释。
spline.py 包含实现样条函数的代码,提供一系列函数,用于处理 B 样条曲线。包括:计算 B 样条基函数、从系数生成样条曲线,以及从样条曲线估计系数等。

RSNA-2024

RSNA 2024 Lumbar Spine Degenerative Classification 腰椎退行性分类

Classify lumbar spine degenerative conditions:对腰椎退行性疾病进行分类

[TOC]

Overview 概述

The goal of this competition is to create models that can be used to aid in the detection and classification of degenerative spine conditions using lumbar spine MR images. Competitors will develop models that simulate a radiologist’s performance in diagnosing spine conditions.

本次竞赛的目标是创建可用于帮助使用腰椎 MR 图像检测和分类脊柱退行性疾病的模型。参赛者将开发模型来模拟放射科医生诊断脊柱疾病的表现。

Description 描述

Low back pain is the leading cause of disability worldwide, according to the World Health Organization, affecting 619 million people in 2020. Most people experience low back pain at some point in their lives, with the frequency increasing with age. Pain and restricted mobility are often symptoms of spondylosis, a set of degenerative spine conditions including degeneration of intervertebral discs and subsequent narrowing of the spinal canal (spinal stenosis), subarticular recesses, or neural foramen with associated compression or irritations of the nerves in the low back.

根据世界卫生组织的数据,腰痛是全球范围内导致残疾的主要原因,到 2020 年,腰痛将影响 6.19 亿人。大多数人在一生中的某个阶段都会经历腰痛,且频率随着年龄的增长而增加。疼痛和活动受限通常是脊椎病的症状,这是一组退行性脊柱疾病,包括椎间盘退变和随后的椎管变窄(椎管狭窄)、关节下隐窝或神经孔,并伴有下肢神经受压或刺激。

Magnetic resonance imaging (MRI) provides a detailed view of the lumbar spine vertebra, discs and nerves, enabling radiologists to assess the presence and severity of these conditions. Proper diagnosis and grading of these conditions help guide treatment and potential surgery to help alleviate back pain and improve overall health and quality of life for patients.

磁共振成像 (MRI) 提供腰椎、椎间盘和神经的详细视图,使放射科医生能够评估这些病症的存在和严重程度。对这些病症的正确诊断和分级有助于指导治疗和潜在的手术,以帮助减轻背痛并改善患者的整体健康和生活质量。

RSNA has teamed with the American Society of Neuroradiology (ASNR) to conduct this competition exploring whether artificial intelligence can be used to aid in the detection and classification of degenerative spine conditions using lumbar spine MR images.

RSNA 与美国神经放射学会 (ASNR)合作举办了本次竞赛,探讨人工智能是否可以利用腰椎 MR 图像来帮助检测和分类脊柱退行性疾病。

The challenge will focus on the classification of five lumbar spine degenerative conditions: Left Neural Foraminal Narrowing, Right Neural Foraminal Narrowing, Left Subarticular Stenosis, Right Subarticular Stenosis, and Spinal Canal Stenosis. For each imaging study in the dataset, we’ve provided severity scores (Normal/Mild, Moderate, or Severe) for each of the five conditions across the intervertebral disc levels L1/L2, L2/L3, L3/L4, L4/L5, and L5/S1.

挑战将集中于五种腰椎退行性疾病的分类:左神经椎间孔狭窄、右神经椎间孔狭窄、左关节下狭窄、右关节下狭窄和椎管狭窄。对于数据集中的每项影像学研究,我们为椎间盘 L1/L2、L2/L3、L3/L4、L4/L5 级别的五种情况中的每一种提供了严重性评分(正常/轻度、中度或严重)和 L5/S1。

To create the ground truth dataset, the RSNA challenge planning task force collected imaging data sourced from eight sites on five continents. This multi-institutional, expertly curated dataset promises to improve standardized classification of degenerative lumbar spine conditions and enable development of tools to automate accurate and rapid disease classification.

为了创建实况数据集,RSNA 挑战计划工作组收集了来自五大洲八个站点的成像数据。这个多机构、专业策划的数据集有望改善退行性腰椎疾病的标准化分类,并支持开发自动化准确、快速的疾病分类工具。

Challenge winners will be recognized at an event during the RSNA 2024 annual meeting. For more information on the challenge, contact RSNA Informatics staff at informatics@rsna.org.

挑战赛获胜者将在 RSNA 2024 年年会期间的活动中获得表彰。有关挑战的更多信息,请联系 RSNA 信息学工作人员: informatics@rsna.org

Evaluation 评估

Submissions are evaluated using the average of sample weighted log losses and an any_severe_spinal prediction generated by the metric. The metric notebook can be found here.

使用样本加权对数损失的平均值和由该指标生成的any_severe_spinal预测来评估提交的结果。公制笔记本可以在这里找到

The sample weights are as follows:

样本权重如下:

  • 1 for normal/mild. 1 为正常/轻度。
  • 2 for moderate. 2为中等。
  • 4 for severe. 4为严重。

For each row ID in the test set, you must predict a probability for each of the different severity levels. The file should contain a header and have the following format:

对于测试集中的每个行 ID,您必须预测每个不同严重性级别的概率。该文件应包含标头并具有以下格式:

1
2
3
4
5
row_id,normal_mild,moderate,severe
123456_left_neural_foraminal_narrowing_l1_l2,0.333,0.333,0.333
123456_left_neural_foraminal_narrowing_l2_l3,0.333,0.333,0.333
123456_left_neural_foraminal_narrowing_l3_l4,0.333,0.333,0.333
etc.
row_id normal_mild moderate severe
123456_left_neural_foraminal_narrowing_l1_l2 0.333 0.333 0.333
123456_left_neural_foraminal_narrowing_l2_l3 0.333 0.333 0.333
123456_left_neural_foraminal_narrowing_l3_l4 0.333 0.333 0.333
etc.

In rare cases the lowest vertebrae aren’t visible in the imagery. You still need to make predictions (nulls will cause errors), but those rows will not be scored.

在极少数情况下,图像中看不到最低的椎骨。您仍然需要进行预测(空值会导致错误),但这些行不会被评分。

For this competition, the any_severe_scalar has been set to 1.0.

对于本次比赛,any_severe_scalar已设置为1.0

Dataset Description 数据集描述

The goal of this competition is to identify medical conditions affecting the lumbar spine in MRI scans.
本次比赛的目标是通过 MRI 扫描识别影响腰椎的医疗状况。

This competition uses a hidden test. When your submitted notebook is scored, the actual test data (including a full length sample submission) will be made available to your notebook.
本次比赛采用隐藏测试方式。当您提交的笔记本电脑被评分时,实际的测试数据(包括完整长度的样本提交)将提供给您的笔记本电脑。

Files 文件

train.csv Labels for the train set. 训练集的标签。

  • study_id - The study ID. Each study may include multiple series of images.
    study_id - 研究 ID,每个研究可能包括多个系列的图像。
  • [condition]_[level] - The target labels, such as spinal_canal_stenosis_l1_l2 , with the severity levels of Normal/Mild, Moderate , or Severe . Some entries have incomplete labels.
    [condition]_[level] - 目标标签,例如spinal_canal_stenosis_l1_l2 ,严重程度级别为 Normal/MildModerateSevere。有些条目的标签不完整。

train_label_coordinates.csv
训练标签坐标.csv

  • study_id
  • series_id - The imagery series ID.
    series_id - 图像系列 ID。
  • instance_number - The image’s order number within the 3D stack.
    instance_number - 图像在 3D 堆栈中的顺序号。
  • condition - There are three core conditions: spinal canal stenosis, neural_foraminal_narrowing, and subarticular_stenosis. The latter two are considered for each side of the spine.
    condition - 共有三种核心病症:椎管狭窄、神经椎间孔狭窄和关节下狭窄。脊柱的每一侧都考虑后两者。
  • level - The relevant vertebrae, such as l3_l4
    level - 相关椎骨,例如l3_l4
  • [x/y] - The x/y coordinates for the center of the area that defined the label.
    [x/y] - 定义标签的区域中心的 x/y 坐标。

sample_submission.csv 样本提交.csv

  • row_id - A slug of the study ID, condition, and level such as 12345_spinal_canal_stenosis_l3_l4.
    row_id - 研究 ID、条件和级别的 slug,例如12345_spinal_canal_stenosis_l3_l4
  • [normal_mild/moderate/severe] - The three prediction columns.
    [normal_mild/moderate/severe] - 三个预测列。

[train/test]_images/[study_id]/[series_id]/[instance_number].dcm The imagery data.图像数据。

[train/test]_series_descriptions.csv

  • study_id

  • series_id

  • series_description The scan’s orientation.
    series_description 扫描方向。

方案说明

Transformer + KAN 6.09 结果很不好

Virtual_Destructor_IN_Cpp

C++ 中虚析构函数的使用

析构函数是为了在对象不被使用之后释放它的资源,虚函数是为了实现多态。那么把析构函数声明为 vitual 有什么作用呢?
直接的讲,C++ 中基类采用virtual虚析构函数是为了防止内存泄漏。具体地说,如果派生类中申请了内存空间,并在其析构函数中对这些内存空间进行释放。假设基类中采用的是非虚析构函数,当删除基类指针指向的派生类对象时就不会触发动态绑定,因而只会调用基类的析构函数,而不会调用派生类的析构函数。那么在这种情况下,派生类中申请的空间就得不到释放从而产生内存泄漏。所以,为了防止这种情况的发生,C++ 中基类的析构函数应采用virtual虚析构函数

参考文献:

https://blog.csdn.net/qq_34673519/article/details/101429799