mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-11-01 00:28:11 +08:00 
			
		
		
		
	 4ba0c24a8f
			
		
	
	4ba0c24a8f
	
	
	
		
			
			* export and import functions * refactor + works for few primitives * nit * allow primitives with state * nit * nit * simplify serialize / deserialize * fix for constants * python bindings * maybe fix serialize failure case * add example * more primitives, training kind of works * same result for python and c++ * some fixes * fix export * template it up * some simplificatoin * rebase * allow kwargs and multiple functions * exporter * more primitives for exporting * deal with endianness * handle invalid stream * add docstring
		
			
				
	
	
	
		
			685 B
		
	
	
	
	
	
	
	
			
		
		
	
	
			685 B
		
	
	
	
	
	
	
	
Setup
Install MLX:
pip install mlx>=0.22
Build the C++ examples:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
Run
Eval MLP
Run the Python script to export the eval function:
python eval_mlp.py
Then run the C++ program to import and run the function:
./build/eval_mlp
The Python and C++ programs should output the same result.
Train MLP
Run the Python script to export the model initialization and training functions:
python train_mlp.py
Then run the C++ program to import and run the functions:
./build/train_mlp
The Python and C++ programs should output the same results.