gpu-worker 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Post-install script
4
+ * 在 npm install 后自动设置 Python 环境
5
+ */
6
+
7
+ const { execSync } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+
11
+ const PACKAGE_DIR = path.resolve(__dirname, '..');
12
+
13
+ // ANSI colors (不依赖 chalk)
14
+ const colors = {
15
+ green: (s) => `\x1b[32m${s}\x1b[0m`,
16
+ yellow: (s) => `\x1b[33m${s}\x1b[0m`,
17
+ cyan: (s) => `\x1b[36m${s}\x1b[0m`,
18
+ red: (s) => `\x1b[31m${s}\x1b[0m`,
19
+ bold: (s) => `\x1b[1m${s}\x1b[0m`
20
+ };
21
+
22
+ console.log(colors.cyan('\n📦 GPU Worker - Post-install setup\n'));
23
+
24
+ // 检测 Python
25
+ function findPython() {
26
+ const pythonCommands = ['python3', 'python', 'py'];
27
+
28
+ for (const cmd of pythonCommands) {
29
+ try {
30
+ const version = execSync(`${cmd} --version`, {
31
+ encoding: 'utf8',
32
+ stdio: ['pipe', 'pipe', 'pipe']
33
+ });
34
+ const match = version.match(/Python (\d+)\.(\d+)/);
35
+ if (match && parseInt(match[1]) >= 3 && parseInt(match[2]) >= 9) {
36
+ return { cmd, version: version.trim() };
37
+ }
38
+ } catch (e) {
39
+ continue;
40
+ }
41
+ }
42
+ return null;
43
+ }
44
+
45
+ const python = findPython();
46
+
47
+ if (python) {
48
+ console.log(colors.green(`✓ Found ${python.version}`));
49
+ console.log(colors.cyan('\nRun the following to get started:'));
50
+ console.log(colors.bold(' npx gpu-worker configure'));
51
+ console.log(colors.bold(' npx gpu-worker start'));
52
+ } else {
53
+ console.log(colors.yellow('⚠ Python 3.9+ not found'));
54
+ console.log(colors.yellow('\nPlease install Python 3.9+ before using gpu-worker:'));
55
+ console.log(' - Windows: https://www.python.org/downloads/');
56
+ console.log(' - macOS: brew install python@3.11');
57
+ console.log(' - Ubuntu: sudo apt install python3.11 python3.11-venv');
58
+ }
59
+
60
+ console.log(colors.cyan('\nFor more info: npx gpu-worker --help\n'));
package/setup.py ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ GPU Worker 安装脚本
4
+ 支持 pip install 安装
5
+ """
6
+ from setuptools import setup, find_packages
7
+
8
+ setup(
9
+ name="gpu-worker",
10
+ version="1.0.0",
11
+ description="分布式GPU推理 Worker 节点",
12
+ author="GPU Sharing Project",
13
+ python_requires=">=3.9",
14
+ packages=find_packages(),
15
+ install_requires=[
16
+ "torch>=2.0.0",
17
+ "transformers>=4.35.0",
18
+ "diffusers>=0.24.0",
19
+ "accelerate>=0.24.0",
20
+ "peft>=0.6.0",
21
+ "httpx>=0.25.0",
22
+ "pyyaml>=6.0",
23
+ "pydantic>=2.0.0",
24
+ "fastapi>=0.100.0",
25
+ "uvicorn>=0.23.0",
26
+ "rich>=13.0.0",
27
+ ],
28
+ extras_require={
29
+ "cuda": ["bitsandbytes>=0.41.0"],
30
+ },
31
+ entry_points={
32
+ "console_scripts": [
33
+ "gpu-worker=cli:main",
34
+ ],
35
+ },
36
+ classifiers=[
37
+ "Development Status :: 4 - Beta",
38
+ "Intended Audience :: Developers",
39
+ "Programming Language :: Python :: 3.9",
40
+ "Programming Language :: Python :: 3.10",
41
+ "Programming Language :: Python :: 3.11",
42
+ ],
43
+ )