spark.setBaseUrl
function setBaseUrl(url: string): voidSet the base URL for file operations.
By default, files are loaded from https://torchjs.org. Use this function to configure a different base URL for development, testing, or custom hosting.
Parameters
urlstring- Base URL to use for file operations (e.g., 'https://example.com' or 'http://localhost:3000')
Examples
// Use local development server
spark.setBaseUrl('http://localhost:3000');
const weights = await spark.load('kasumi/mnist/model.pt');See Also
- getBaseUrl - Get the current base URL