Installation
Detailed installation and setup instructions for Tiny-DL-Inference.
System Requirements
Runtime Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| Node.js | 18.0 | 20.x |
| npm | 8.0 | 10.x |
| Browser | Chrome 113+ / Edge 113+ | Latest |
GPU Requirements
WebGPU requires a compatible GPU:
- NVIDIA: GTX 900 series or newer (Driver 470+)
- AMD: RX 400 series or newer
- Intel: Arc series or integrated graphics with latest drivers
- Apple: M1 or newer (macOS Sonoma+)
Installation Methods
npm (Recommended)
bash
npm install tiny-dl-inference1
yarn
bash
yarn add tiny-dl-inference1
pnpm
bash
pnpm add tiny-dl-inference1
Building from Source
1. Clone the Repository
bash
git clone https://github.com/LessUp/tiny-dl-inference.git
cd tiny-dl-inference1
2
2
2. Install Dependencies
bash
npm install1
3. Build the Project
bash
npm run build1
This generates the dist/ directory with:
- ESM module (
dist/index.js) - TypeScript declarations (
dist/index.d.ts) - Source maps for debugging
4. Verify Installation
bash
# Run tests
npm test
# Type checking
npm run typecheck1
2
3
4
5
2
3
4
5
Development Setup
IDE Configuration
VS Code
Recommended extensions:
- TypeScript + JavaScript
- WGSL (WebGPU Shading Language)
Settings (settings.json):
json
{
"typescript.preferences.importModuleSpecifier": "relative",
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}1
2
3
4
5
6
7
2
3
4
5
6
7
WebStorm / IntelliJ
Enable TypeScript service and configure the project to use the local TypeScript installation.
Browser Setup
Chrome / Edge
WebGPU is enabled by default in Chrome 113+ and Edge 113+.
To verify:
javascript
if (navigator.gpu) {
const adapter = await navigator.gpu.requestAdapter();
console.log('WebGPU Adapter:', adapter);
}1
2
3
4
2
3
4
Safari (Experimental)
WebGPU in Safari requires:
- macOS Sonoma or later
- Safari 18+
- Enable WebGPU in Develop menu
Firefox
WebGPU is behind a flag in Firefox:
- Navigate to
about:config - Set
dom.webgpu.enabledtotrue
Project Scripts
| Script | Description |
|---|---|
npm run build | Compile TypeScript to ESM |
npm run typecheck | Run TypeScript type checking |
npm test | Run test suite |
npm run test:watch | Run tests in watch mode |
npm run test:coverage | Run tests with coverage report |
npm run lint | Run linter |
npm run clean | Remove build artifacts |
Troubleshooting
"Cannot find module 'tiny-dl-inference'"
Ensure the package is installed:
bash
npm ls tiny-dl-inference1
TypeScript Errors
Make sure your tsconfig.json includes:
json
{
"compilerOptions": {
"moduleResolution": "bundler",
"target": "ES2022",
"module": "ESNext"
}
}1
2
3
4
5
6
7
2
3
4
5
6
7
WebGPU Not Available
- Update your browser to the latest version
- Check GPU driver version
- Try disabling GPU driver sandboxing (Chrome):
--disable-gpu-sandbox
Next Steps
- Quick Start Guide - Build your first inference
- Architecture - Understand the system design