LLM: add first round files (#8225)
This commit is contained in:
		
							parent
							
								
									768b15881d
								
							
						
					
					
						commit
						ea22416525
					
				
					 5 changed files with 155 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								python/llm/readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								python/llm/readme.md
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
# BigDL LLM
 | 
			
		||||
							
								
								
									
										92
									
								
								python/llm/setup.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								python/llm/setup.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,92 @@
 | 
			
		|||
#!/usr/bin/env python
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2016 The BigDL Authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#!/usr/bin/env python
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2016 The BigDL Authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import fnmatch
 | 
			
		||||
from setuptools import setup
 | 
			
		||||
 | 
			
		||||
long_description = '''
 | 
			
		||||
    BigDL LLM
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
exclude_patterns = ["*__pycache__*", "*ipynb_checkpoints*"]
 | 
			
		||||
BIGDL_PYTHON_HOME = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
			
		||||
VERSION = open(os.path.join(BIGDL_PYTHON_HOME, 'version.txt'), 'r').read().strip()
 | 
			
		||||
llm_home = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_llm_packages():
 | 
			
		||||
    llm_packages = []
 | 
			
		||||
    for dirpath, _, _ in os.walk(os.path.join(llm_home, "bigdl")):
 | 
			
		||||
        print(dirpath)
 | 
			
		||||
        package = dirpath.split(llm_home + os.sep)[1].replace(os.sep, '.')
 | 
			
		||||
        if any(fnmatch.fnmatchcase(package, pat=pattern)
 | 
			
		||||
                for pattern in exclude_patterns):
 | 
			
		||||
            print("excluding", package)
 | 
			
		||||
        else:
 | 
			
		||||
            llm_packages.append(package)
 | 
			
		||||
            print("including", package)
 | 
			
		||||
    return llm_packages
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def setup_package():
 | 
			
		||||
    metadata = dict(
 | 
			
		||||
        name='bigdl-llm',
 | 
			
		||||
        version=VERSION,
 | 
			
		||||
        description='Large Language Model Develop Toolkit',
 | 
			
		||||
        long_description=long_description,
 | 
			
		||||
        long_description_content_type="text/markdown",
 | 
			
		||||
        author='BigDL Authors',
 | 
			
		||||
        author_email='bigdl-user-group@googlegroups.com',
 | 
			
		||||
        license='Apache License, Version 2.0',
 | 
			
		||||
        url='https://github.com/intel-analytics/BigDL',
 | 
			
		||||
        packages=get_llm_packages(),
 | 
			
		||||
        package_dir={"": "src"},
 | 
			
		||||
        install_requires=[],
 | 
			
		||||
        include_package_data=True,
 | 
			
		||||
        classifiers=[
 | 
			
		||||
            'License :: OSI Approved :: Apache Software License',
 | 
			
		||||
            'Programming Language :: Python :: 3',
 | 
			
		||||
            'Programming Language :: Python :: 3.9',
 | 
			
		||||
            'Programming Language :: Python :: Implementation :: CPython'],
 | 
			
		||||
        platforms=['linux', 'windows']
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    setup(**metadata)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    setup_package()
 | 
			
		||||
							
								
								
									
										22
									
								
								python/llm/src/bigdl/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								python/llm/src/bigdl/__init__.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright 2016 The BigDL Authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# This would makes sure Python is aware there is more than one sub-package within bigdl,
 | 
			
		||||
# physically located elsewhere.
 | 
			
		||||
# Otherwise there would be module not found error in non-pip's setting as Python would
 | 
			
		||||
# only search the first bigdl package and end up finding only one sub-package.
 | 
			
		||||
import pkgutil
 | 
			
		||||
__path__ = pkgutil.extend_path(__path__, __name__)  # type: ignore
 | 
			
		||||
							
								
								
									
										20
									
								
								python/llm/src/bigdl/llm/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								python/llm/src/bigdl/llm/__init__.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright 2016 The BigDL Authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# This would makes sure Python is aware there is more than one sub-package within bigdl,
 | 
			
		||||
# physically located elsewhere.
 | 
			
		||||
# Otherwise there would be module not found error in non-pip's setting as Python would
 | 
			
		||||
# only search the first bigdl package and end up finding only one sub-package.
 | 
			
		||||
							
								
								
									
										20
									
								
								python/llm/src/bigdl/llm/ggml/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								python/llm/src/bigdl/llm/ggml/__init__.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright 2016 The BigDL Authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# This would makes sure Python is aware there is more than one sub-package within bigdl,
 | 
			
		||||
# physically located elsewhere.
 | 
			
		||||
# Otherwise there would be module not found error in non-pip's setting as Python would
 | 
			
		||||
# only search the first bigdl package and end up finding only one sub-package.
 | 
			
		||||
		Loading…
	
		Reference in a new issue