Skip to content

Commit 1ef3378

Browse files
authored
Fix package data in setup.py for single files. (#416)
* Fix package data in setup.py for single files. * Add specification of GPT jit build in README. * Remove tests from package. * Fix package data leaving out files with same names.
1 parent 792e47e commit 1ef3378

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

paddlenlp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = '2.0.0rc19' # Maybe dev is better
15+
__version__ = '2.0.0' # Maybe dev is better
1616

1717
from . import data
1818
from . import datasets

paddlenlp/ops/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ python sample/gpt_sample.py --model_name_or_path gpt2-medium-en --decoding_lib .
164164

165165
其中,各个选项的意义如下:
166166
* `--model_name_or_path`: 预训练模型的名称或是路径。
167-
* `--decoding_lib`: 指向 `libdecoding_op.so` 的路径。需要包含 `libdecoding_op.so`
167+
* `--decoding_lib`: 指向 `libdecoding_op.so` 的路径。需要包含 `libdecoding_op.so`若不存在则将自动进行 jit 编译产出该 lib。
168168
* `--batch_size`: 一个 batch 内,样本数目的大小。
169169
* `--candidate_num`: 执行 topk-sampling 的时候的 `k` 的大小,默认是 4。
170170
* `--probability_threshold`: 执行 topp-sampling 的时候的阈值的大小,默认是 0.0 表示不执行 topp-sampling。

paddlenlp/ops/ext_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, name, source_dir=None):
2727
# A CMakeExtension needs a source_dir instead of a file list.
2828
Extension.__init__(self, name, sources=[])
2929
if source_dir is None:
30-
self.source_dir = Path(__file__).parent.resolve()
30+
self.source_dir = str(Path(__file__).parent.resolve())
3131
else:
3232
self.source_dir = os.path.abspath(os.path.expanduser(source_dir))
3333
self.sources = [

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ def get_package_data_files(package, data, package_dir=None):
3131
all_files = []
3232
for f in data:
3333
path = os.path.join(package_dir, f)
34+
if os.path.isfile(path):
35+
all_files.append(f)
36+
continue
3437
for root, _dirs, files in os.walk(path, followlinks=True):
3538
root = os.path.relpath(root, package_dir)
3639
for file in files:
40+
file = os.path.join(root, file)
3741
if file not in all_files:
38-
all_files.append(os.path.join(root, file))
42+
all_files.append(file)
3943
return all_files
4044

4145

@@ -49,7 +53,7 @@ def get_package_data_files(package, data, package_dir=None):
4953
long_description_content_type="text/plain",
5054
url="https://github.com/PaddlePaddle/PaddleNLP",
5155
packages=setuptools.find_packages(
52-
where='.', exclude=('./examples')),
56+
where='.', exclude=('examples*', 'tests*')),
5357
package_data={
5458
'paddlenlp.ops': get_package_data_files('paddlenlp.ops', [
5559
'CMakeLists.txt', 'README.md', 'cmake', 'src', 'sample', 'patches',

tests/models/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)