This project is a TypeScript package designed to analyze model files and extract comprehensive metadata based on filenames and directory structures. The ModelAnalyzer
class provides functionality to detect model architectures, tasks, training methods, and more from filenames.
- Analyze model filenames to extract metadata.
- Determine storage requirements based on file types and folder structures.
- Support for various model formats and architectures.
- Utility functions for pattern matching in filenames.
- Returns metadata as a
ModelInfo
instance with typed properties (using Sets internally, but serialized as arrays viatoJSON
).
Clone the repository and run:
npm install
To use the ModelAnalyzer
, import it into your TypeScript files. For example:
import { ModelAnalyzer } from './src/analyzer';
const analyzer = new ModelAnalyzer();
const modelInfo = analyzer.analyzeModelFiles(['path/to/model/file1', 'path/to/model/file2']);
// Access metadata
console.log(modelInfo.format);
console.log(modelInfo.storageType);
// When serializing to JSON, collection properties become arrays:
console.log(JSON.stringify(modelInfo));
// Or to analyze a single filename:
const singleModel = analyzer.analyzeFilename('model.gguf');
console.log(singleModel);
To run tests, use:
npm test
Make sure you have Jest (or your chosen test runner) properly configured for TypeScript.
Contributions are welcome! Open an issue or submit a pull request for improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.