mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-09-18 19:10:08 +08:00
adding wwdc25 samples (#1370)
This commit is contained in:
@@ -0,0 +1,385 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
E51DFC5C2DF3729C00042DAC /* MLX in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC5B2DF3729C00042DAC /* MLX */; };
|
||||
E51DFC5E2DF3729C00042DAC /* MLXFFT in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC5D2DF3729C00042DAC /* MLXFFT */; };
|
||||
E51DFC602DF3729C00042DAC /* MLXFast in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC5F2DF3729C00042DAC /* MLXFast */; };
|
||||
E51DFC622DF3729C00042DAC /* MLXLinalg in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC612DF3729C00042DAC /* MLXLinalg */; };
|
||||
E51DFC642DF3729C00042DAC /* MLXNN in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC632DF3729C00042DAC /* MLXNN */; };
|
||||
E51DFC672DF372CA00042DAC /* MLXLLM in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC662DF372CA00042DAC /* MLXLLM */; };
|
||||
E51DFC692DF372CA00042DAC /* MLXLMCommon in Frameworks */ = {isa = PBXBuildFile; productRef = E51DFC682DF372CA00042DAC /* MLXLMCommon */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
E5158B942DF0BD71000A6E7E /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
E5158B962DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WWDC25MLXSwiftExamples; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
E5158B982DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = WWDC25MLXSwiftExamples;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
E5158B932DF0BD71000A6E7E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E51DFC672DF372CA00042DAC /* MLXLLM in Frameworks */,
|
||||
E51DFC642DF3729C00042DAC /* MLXNN in Frameworks */,
|
||||
E51DFC622DF3729C00042DAC /* MLXLinalg in Frameworks */,
|
||||
E51DFC5C2DF3729C00042DAC /* MLX in Frameworks */,
|
||||
E51DFC602DF3729C00042DAC /* MLXFast in Frameworks */,
|
||||
E51DFC5E2DF3729C00042DAC /* MLXFFT in Frameworks */,
|
||||
E51DFC692DF372CA00042DAC /* MLXLMCommon in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
E5158B8D2DF0BD71000A6E7E = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E5158B982DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */,
|
||||
E5158B972DF0BD71000A6E7E /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E5158B972DF0BD71000A6E7E /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E5158B962DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
E5158B952DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E5158B9D2DF0BD71000A6E7E /* Build configuration list for PBXNativeTarget "WWDC25MLXSwiftExamples" */;
|
||||
buildPhases = (
|
||||
E5158B922DF0BD71000A6E7E /* Sources */,
|
||||
E5158B932DF0BD71000A6E7E /* Frameworks */,
|
||||
E5158B942DF0BD71000A6E7E /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
E5158B982DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */,
|
||||
);
|
||||
name = WWDC25MLXSwiftExamples;
|
||||
packageProductDependencies = (
|
||||
E51DFC5B2DF3729C00042DAC /* MLX */,
|
||||
E51DFC5D2DF3729C00042DAC /* MLXFFT */,
|
||||
E51DFC5F2DF3729C00042DAC /* MLXFast */,
|
||||
E51DFC612DF3729C00042DAC /* MLXLinalg */,
|
||||
E51DFC632DF3729C00042DAC /* MLXNN */,
|
||||
E51DFC662DF372CA00042DAC /* MLXLLM */,
|
||||
E51DFC682DF372CA00042DAC /* MLXLMCommon */,
|
||||
);
|
||||
productName = WWDC25MLXSwiftExamples;
|
||||
productReference = E5158B962DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
E5158B8E2DF0BD71000A6E7E /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1620;
|
||||
LastUpgradeCheck = 1620;
|
||||
TargetAttributes = {
|
||||
E5158B952DF0BD71000A6E7E = {
|
||||
CreatedOnToolsVersion = 16.2;
|
||||
LastSwiftMigration = 1620;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = E5158B912DF0BD71000A6E7E /* Build configuration list for PBXProject "WWDC25MLXSwiftExamples" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = E5158B8D2DF0BD71000A6E7E;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
packageReferences = (
|
||||
E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */,
|
||||
E51DFC652DF372CA00042DAC /* XCRemoteSwiftPackageReference "mlx-swift-examples" */,
|
||||
);
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = E5158B972DF0BD71000A6E7E /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
E5158B952DF0BD71000A6E7E /* WWDC25MLXSwiftExamples */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
E5158B922DF0BD71000A6E7E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
E5158B9B2DF0BD71000A6E7E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 15.2;
|
||||
MTL_COMPILER_FLAGS = "-w";
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E5158B9C2DF0BD71000A6E7E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 15.2;
|
||||
MTL_COMPILER_FLAGS = "-w";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E5158B9E2DF0BD71000A6E7E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E5158B9F2DF0BD71000A6E7E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
E5158B912DF0BD71000A6E7E /* Build configuration list for PBXProject "WWDC25MLXSwiftExamples" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E5158B9B2DF0BD71000A6E7E /* Debug */,
|
||||
E5158B9C2DF0BD71000A6E7E /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E5158B9D2DF0BD71000A6E7E /* Build configuration list for PBXNativeTarget "WWDC25MLXSwiftExamples" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E5158B9E2DF0BD71000A6E7E /* Debug */,
|
||||
E5158B9F2DF0BD71000A6E7E /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ml-explore/mlx-swift";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 0.25.4;
|
||||
};
|
||||
};
|
||||
E51DFC652DF372CA00042DAC /* XCRemoteSwiftPackageReference "mlx-swift-examples" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ml-explore/mlx-swift-examples/";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 2.25.4;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
E51DFC5B2DF3729C00042DAC /* MLX */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */;
|
||||
productName = MLX;
|
||||
};
|
||||
E51DFC5D2DF3729C00042DAC /* MLXFFT */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */;
|
||||
productName = MLXFFT;
|
||||
};
|
||||
E51DFC5F2DF3729C00042DAC /* MLXFast */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */;
|
||||
productName = MLXFast;
|
||||
};
|
||||
E51DFC612DF3729C00042DAC /* MLXLinalg */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */;
|
||||
productName = MLXLinalg;
|
||||
};
|
||||
E51DFC632DF3729C00042DAC /* MLXNN */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC5A2DF3729C00042DAC /* XCRemoteSwiftPackageReference "mlx-swift" */;
|
||||
productName = MLXNN;
|
||||
};
|
||||
E51DFC662DF372CA00042DAC /* MLXLLM */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC652DF372CA00042DAC /* XCRemoteSwiftPackageReference "mlx-swift-examples" */;
|
||||
productName = MLXLLM;
|
||||
};
|
||||
E51DFC682DF372CA00042DAC /* MLXLMCommon */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = E51DFC652DF372CA00042DAC /* XCRemoteSwiftPackageReference "mlx-swift-examples" */;
|
||||
productName = MLXLMCommon;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = E5158B8E2DF0BD71000A6E7E /* Project object */;
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"originHash" : "4a76dabe83b4fd6993d6ea9526d9d28eb4a130352feeb35dab2fb36d0d73a556",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "gzipswift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/1024jp/GzipSwift",
|
||||
"state" : {
|
||||
"revision" : "731037f6cc2be2ec01562f6597c1d0aa3fe6fd05",
|
||||
"version" : "6.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "jinja",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/johnmai-dev/Jinja",
|
||||
"state" : {
|
||||
"revision" : "31c4dd39bcdc07eaa42a384bdc88ea599022b800",
|
||||
"version" : "1.1.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "mlx-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/ml-explore/mlx-swift",
|
||||
"state" : {
|
||||
"revision" : "b94473af8c50010edba87a48bbd60c3d7f949852",
|
||||
"version" : "0.25.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "mlx-swift-examples",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/ml-explore/mlx-swift-examples/",
|
||||
"state" : {
|
||||
"revision" : "8e41311a3c17e902441cfcaa46629244c9758afd",
|
||||
"version" : "2.25.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-argument-parser",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-argument-parser.git",
|
||||
"state" : {
|
||||
"revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b",
|
||||
"version" : "1.4.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-collections",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-collections.git",
|
||||
"state" : {
|
||||
"revision" : "c1805596154bb3a265fd91b8ac0c4433b4348fb0",
|
||||
"version" : "1.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-numerics",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-numerics",
|
||||
"state" : {
|
||||
"revision" : "e0ec0f5f3af6f3e4d5e7a19d2af26b481acb6ba8",
|
||||
"version" : "1.0.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-transformers",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/huggingface/swift-transformers",
|
||||
"state" : {
|
||||
"revision" : "c2f302a74cca59cbde683b1425ab43c05685515a",
|
||||
"version" : "0.1.21"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 3
|
||||
}
|
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>WWDC25MLXSwiftExamples.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,25 @@
|
||||
import Foundation
|
||||
import MLX
|
||||
import MLXLMCommon
|
||||
import MLXLLM
|
||||
|
||||
func SimpleMLXLM() async throws {
|
||||
// Load the model and tokenizer directly from HF
|
||||
let modelId = "mlx-community/Mistral-7B-Instruct-v0.3-4bit"
|
||||
let modelFactory = LLMModelFactory.shared
|
||||
let configuration = ModelConfiguration(id: modelId)
|
||||
let model = try await modelFactory.loadContainer(configuration: configuration)
|
||||
|
||||
try await model.perform({context in
|
||||
// Prepare the prompt for the model
|
||||
let prompt = "Write a quicksort in Swift"
|
||||
let input = try await context.processor.prepare(input: UserInput(prompt: prompt))
|
||||
|
||||
// Generate the text
|
||||
let params = GenerateParameters(temperature: 0.0)
|
||||
let tokenStream = try generate(input: input, parameters: params, context: context)
|
||||
for await part in tokenStream {
|
||||
print(part.chunk ?? "", terminator: "")
|
||||
}
|
||||
})
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
import Foundation
|
||||
import MLX
|
||||
import MLXLMCommon
|
||||
import MLXLLM
|
||||
|
||||
func SimpleMLXLMWithKVCache() async throws {
|
||||
// Load the model and tokenizer directly from HF
|
||||
let modelId = "mlx-community/Mistral-7B-Instruct-v0.3-4bit"
|
||||
let modelFactory = LLMModelFactory.shared
|
||||
let configuration = ModelConfiguration(id: modelId)
|
||||
let model = try await modelFactory.loadContainer(configuration: configuration)
|
||||
|
||||
try await model.perform({context in
|
||||
// Prepare the prompt for the model
|
||||
let prompt = "Write a quicksort in Swift"
|
||||
let input = try await context.processor.prepare(input: UserInput(prompt: prompt))
|
||||
|
||||
// Create the key-value cache
|
||||
let generateParameters = GenerateParameters()
|
||||
let cache = context.model.newCache(parameters: generateParameters)
|
||||
|
||||
// Low level token iterator
|
||||
let tokenIter = try TokenIterator(input: input,
|
||||
model: context.model,
|
||||
cache: cache,
|
||||
parameters: generateParameters)
|
||||
let tokenStream = generate(input: input, context: context, iterator: tokenIter)
|
||||
for await part in tokenStream {
|
||||
print(part.chunk ?? "", terminator: "")
|
||||
}
|
||||
|
||||
print("\n=============================================================================\n")
|
||||
|
||||
// Prompt the model again with a follow up questions:
|
||||
let newPrompt = "What is it's time complexity?"
|
||||
let newInput = try await context.processor.prepare(input: .init(prompt: newPrompt))
|
||||
let newTokenIter = try TokenIterator(input: newInput,
|
||||
model: context.model,
|
||||
cache: cache,
|
||||
parameters: generateParameters)
|
||||
|
||||
|
||||
let newTokenStream = generate(input: newInput, context: context, iterator: newTokenIter)
|
||||
for await part in newTokenStream {
|
||||
print(part.chunk ?? "", terminator: "")
|
||||
}
|
||||
})
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
// WWDC Session: Get started with MLX for Apple silicon
|
||||
|
||||
// Swift
|
||||
import MLX
|
||||
|
||||
// Make an array
|
||||
let a = MLXArray([1, 2, 3])
|
||||
|
||||
// Make another array
|
||||
let b = MLXArray([1, 2, 3])
|
||||
|
||||
// Do an operation
|
||||
let c = a + b
|
||||
|
||||
// Access information about the array
|
||||
let shape = c.shape
|
||||
let dtype = c.dtype
|
||||
|
||||
// Print results
|
||||
print("a: \(a)")
|
||||
print("b: \(b)")
|
||||
print("c = a + b: \(c)")
|
||||
print("shape: \(shape)")
|
||||
print("dtype: \(dtype)")
|
||||
|
||||
// WWDC Session: Explore large language models on Apple silicon with MLX
|
||||
|
||||
/// Example 1: Simple MLXLM Swift example using Mistral-7B-Instruct-v0.3-4bit
|
||||
try await SimpleMLXLM()
|
||||
|
||||
/// Example 2: Using KVCache and custom TokenIterator with Mistral-7B-Instruct-v0.3-4bit
|
||||
try await SimpleMLXLMWithKVCache()
|
Reference in New Issue
Block a user