コード例 #1
0
ファイル: frontends.py プロジェクト: chenghanpeng/tvm
    def load(self, path, shape_dict=None, **kwargs):
        # pylint: disable=C0415
        import paddle

        paddle.enable_static()
        paddle.disable_signal_handler()

        if not os.path.exists(path):
            raise TVMCException("File {} is not exist.".format(path))
        if not path.endswith(".pdmodel"):
            raise TVMCException(
                "Path of model file should be endwith suffixes '.pdmodel'.")
        prefix = "".join(path.strip().split(".")[:-1])
        params_file_path = prefix + ".pdiparams"
        if not os.path.exists(params_file_path):
            raise TVMCException(
                "File {} is not exist.".format(params_file_path))

        # pylint: disable=E1101
        exe = paddle.static.Executor(paddle.CPUPlace())
        prog, _, _ = paddle.static.load_inference_model(prefix, exe)

        return relay.frontend.from_paddle(prog,
                                          shape_dict=shape_dict,
                                          **kwargs)
コード例 #2
0
ファイル: frontends.py プロジェクト: OctoML-NN-team/tvm
    def load(self, path, shape_dict=None, **kwargs):
        # pylint: disable=C0415
        import paddle

        paddle.enable_static()
        paddle.disable_signal_handler()

        # pylint: disable=E1101
        exe = paddle.static.Executor(paddle.CPUPlace())
        prog, _, _ = paddle.static.load_inference_model(path, exe)

        return relay.frontend.from_paddle(prog, shape_dict=shape_dict, **kwargs)
コード例 #3
0
#     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.

__version__ = '2.2.0'  # Maybe dev is better
import sys
if 'datasets' in sys.modules.keys():
    from paddlenlp.utils.log import logger
    logger.warning(
        "datasets module loaded before paddlenlp. "
        "This may cause PaddleNLP datasets to be unavalible in intranet.")
from . import data
from . import datasets
from . import embeddings
from . import ops
from . import layers
from . import metrics
from . import seq2vec
from . import transformers
from . import utils
from . import losses
from . import experimental
from .taskflow import Taskflow
import paddle

paddle.disable_signal_handler()