You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "ycycse (via GitHub)" <gi...@apache.org> on 2025/05/07 06:01:24 UTC

Re: [PR] support Safetensors for timerxl [iotdb]

ycycse commented on code in PR #15450:
URL: https://github.com/apache/iotdb/pull/15450#discussion_r2076841900


##########
iotdb-core/ainode/ainode/TimerXL/models/timer_xl.py:
##########
@@ -185,6 +187,8 @@ def __init__(self, config: TimerxlConfig):
         if config.ckpt_path is not None and config.ckpt_path != '':
             if config.ckpt_path.endswith('.pt') or config.ckpt_path.endswith('.pth'):
                 state_dict = torch.load(config.ckpt_path)
+            elif config.ckpt_path.endswith('.safetensors'):
+                state_dict = load_file(config.ckpt_path)

Review Comment:
   use safetensors.torch.load_file() to make it more clearly.



##########
iotdb-core/ainode/ainode/core/model/built_in_model_factory.py:
##########
@@ -398,8 +398,8 @@ def parse_attribute(input_attributes: Dict[str, str], attribute_map: Dict[str, A
     ),
     AttributeName.TIMERXL_CKPT_PATH.value: StringAttribute(
         name=AttributeName.TIMERXL_CKPT_PATH.value,
-        default_value="",
-        value_choices=[""],
+        default_value=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'weights', 'timerxl', 'model.safetensors'),

Review Comment:
   If safetensor is used for built-in model. Put the corresponding file in the path?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org