Configuration for tracking version information from version.txt Attributes: fastdeploy_commit: Full FastDeploy git commit hash paddle_version: PaddlePaddle version string paddle_commit: PaddlePaddle git commit hash cuda_version: CUDA version string c
| 1580 | |
| 1581 | |
| 1582 | class CommitConfig: |
| 1583 | """ |
| 1584 | Configuration for tracking version information from version.txt |
| 1585 | |
| 1586 | Attributes: |
| 1587 | fastdeploy_commit: Full FastDeploy git commit hash |
| 1588 | paddle_version: PaddlePaddle version string |
| 1589 | paddle_commit: PaddlePaddle git commit hash |
| 1590 | cuda_version: CUDA version string |
| 1591 | compiler_version: CXX compiler version string |
| 1592 | """ |
| 1593 | |
| 1594 | def __init__( |
| 1595 | self, |
| 1596 | ): |
| 1597 | self.fastdeploy_commit: str = "" |
| 1598 | self.paddle_version: str = "" |
| 1599 | self.paddle_commit: str = "" |
| 1600 | self.cuda_version: str = "" |
| 1601 | self.compiler_version: str = "" |
| 1602 | |
| 1603 | self._load_from_version_file() |
| 1604 | |
| 1605 | def _load_from_version_file(self, file_path: str = None): |
| 1606 | """Internal method to load version info from file""" |
| 1607 | if file_path is None: |
| 1608 | file_path = os.path.join(fastdeploy.__path__[0], "version.txt") |
| 1609 | try: |
| 1610 | with open(file_path, "r") as f: |
| 1611 | for line in f: |
| 1612 | line = line.strip() |
| 1613 | if line.startswith("fastdeploy GIT COMMIT ID:"): |
| 1614 | self.fastdeploy_commit = line.split(":")[1].strip() |
| 1615 | elif line.startswith("Paddle version:"): |
| 1616 | self.paddle_version = line.split(":")[1].strip() |
| 1617 | elif line.startswith("Paddle GIT COMMIT ID:"): |
| 1618 | self.paddle_commit = line.split(":")[1].strip() |
| 1619 | elif line.startswith("CUDA version:"): |
| 1620 | self.cuda_version = line.split(":")[1].strip() |
| 1621 | elif line.startswith("CXX compiler version:"): |
| 1622 | self.compiler_version = line.split(":")[1].strip() |
| 1623 | except FileNotFoundError: |
| 1624 | logger.info(f"Warning: Version file not found at {file_path}") |
| 1625 | except Exception as e: |
| 1626 | logger.info(f"Warning: Could not read version file - {e!s}") |
| 1627 | |
| 1628 | def print(self): |
| 1629 | """ |
| 1630 | print all config |
| 1631 | |
| 1632 | """ |
| 1633 | logger.info("Fasedeploy Commit Information :") |
| 1634 | for k, v in self.__dict__.items(): |
| 1635 | logger.info("{:<20}:{:<6}{}".format(k, "", v)) |
| 1636 | logger.info("=============================================================") |
| 1637 | |
| 1638 | |
| 1639 | class StructuredOutputsConfig: |
no outgoing calls