fix: preserve null end_time when rendering dataset segments template (#1326)

* fix: preserve null end_time when rendering dataset segments template

* deps(qlib): bump qlib revision to 2fb9380

* fix: lint error
This commit is contained in:
Linlang
2026-02-13 10:50:46 +08:00
committed by GitHub
parent 56bd807d63
commit 747a764664
14 changed files with 40 additions and 65 deletions
+4 -8
View File
@@ -561,11 +561,9 @@ def research_window():
if hg := state.msgs[round]["hypothesis generation"]:
st.markdown("**Hypothesis💡**") # 🧠
h: Hypothesis = hg[0].content
st.markdown(
f"""
st.markdown(f"""
- **Hypothesis**: {h.hypothesis}
- **Reason**: {h.reason}"""
)
- **Reason**: {h.reason}""")
if eg := state.msgs[round]["experiment generation"]:
tasks_window(eg[0].content)
@@ -644,14 +642,12 @@ def feedback_window():
st.plotly_chart(fig)
st.markdown("**Hypothesis Feedback🔍**")
h: HypothesisFeedback = fb[0].content
st.markdown(
f"""
st.markdown(f"""
- **Observations**: {h.observations}
- **Hypothesis Evaluation**: {h.hypothesis_evaluation}
- **New Hypothesis**: {h.new_hypothesis}
- **Decision**: {h.decision}
- **Reason**: {h.reason}"""
)
- **Reason**: {h.reason}""")
if isinstance(state.scenario, KGScenario):
if fbe := state.msgs[round]["runner result"]:
+4 -8
View File
@@ -189,13 +189,11 @@ def task_win(task):
st.markdown(f"**:blue[Package Info:]**")
st.code(task.package_info)
if hasattr(task, "architecture"): # model task
st.markdown(
f"""
st.markdown(f"""
| Model_type | Architecture | hyperparameters |
|------------|--------------|-----------------|
| {task.model_type} | {task.architecture} | {task.hyperparameters} |
"""
)
""")
def workspace_win(workspace, cmp_workspace=None, cmp_name="last code."):
@@ -1168,8 +1166,7 @@ with st.sidebar:
st.toggle("**Show LLM Log**", key="show_llm_log")
st.toggle("*Show stdout*", key="show_stdout")
st.toggle("*Show save workspace*", key="show_save_input")
st.markdown(
f"""
st.markdown(f"""
- [Summary](#summary)
- [Exp Gen](#exp-gen)
- [Coding](#coding)
@@ -1177,8 +1174,7 @@ with st.sidebar:
- [Feedback](#feedback)
- [Record](#record)
- [SOTA Experiment](#sota-exp)
"""
)
""")
def get_state_data_range(state_data):
+8 -16
View File
@@ -171,11 +171,9 @@ class HypothesisWindow(StWindow):
h: Hypothesis = msg.content if isinstance(msg, Message) else msg
self.container.markdown("#### **Hypothesis💡**")
self.container.markdown(
f"""
self.container.markdown(f"""
- **Hypothesis**: {h.hypothesis}
- **Reason**: {h.reason}"""
)
- **Reason**: {h.reason}""")
class HypothesisFeedbackWindow(StWindow):
@@ -183,14 +181,12 @@ class HypothesisFeedbackWindow(StWindow):
h: HypothesisFeedback = msg.content if isinstance(msg, Message) else msg
self.container.markdown("#### **Hypothesis Feedback🔍**")
self.container.markdown(
f"""
self.container.markdown(f"""
- **Observations**: {h.observations}
- **Hypothesis Evaluation**: {h.hypothesis_evaluation}
- **New Hypothesis**: {h.new_hypothesis}
- **Decision**: {h.decision}
- **Reason**: {h.reason}"""
)
- **Reason**: {h.reason}""")
class FactorTaskWindow(StWindow):
@@ -225,8 +221,7 @@ class FactorFeedbackWindow(StWindow):
def consume_msg(self, msg: Message | FactorSingleFeedback):
fb: FactorSingleFeedback = msg.content if isinstance(msg, Message) else msg
self.container.markdown(
f"""### :blue[Factor Execution Feedback]
self.container.markdown(f"""### :blue[Factor Execution Feedback]
{fb.execution_feedback}
### :blue[Factor Code Feedback]
{fb.code_feedback}
@@ -236,16 +231,14 @@ class FactorFeedbackWindow(StWindow):
{fb.final_feedback}
### :blue[Factor Final Decision]
This implementation is {'SUCCESS' if fb.final_decision else 'FAIL'}.
"""
)
""")
class ModelFeedbackWindow(StWindow):
def consume_msg(self, msg: Message | ModelSingleFeedback):
mb: ModelSingleFeedback = msg.content if isinstance(msg, Message) else msg
self.container.markdown(
f"""### :blue[Model Execution Feedback]
self.container.markdown(f"""### :blue[Model Execution Feedback]
{mb.execution_feedback}
### :blue[Model Shape Feedback]
{mb.shape_feedback}
@@ -257,8 +250,7 @@ class ModelFeedbackWindow(StWindow):
{mb.final_feedback}
### :blue[Model Final Decision]
This implementation is {'SUCCESS' if mb.final_decision else 'FAIL'}.
"""
)
""")
class WorkspaceWindow(StWindow):
@@ -649,10 +649,8 @@ class DSProposalV2ExpGen(ExpGen):
# knowledge retrieval
if DS_RD_SETTING.enable_research_rag:
rag_agent = RAGAgent(
system_prompt="""You are a helpful assistant.
You help users retrieve relevant knowledge from community discussions and public code."""
)
rag_agent = RAGAgent(system_prompt="""You are a helpful assistant.
You help users retrieve relevant knowledge from community discussions and public code.""")
knowledge = rag_agent.query(problem_formatted_str)
else:
knowledge = None
+1 -1
View File
@@ -14,7 +14,7 @@ RUN git clone https://github.com/microsoft/qlib.git
WORKDIR /workspace/qlib
RUN git fetch && git reset 3e72593b8c985f01979bebcf646658002ac43b00 --hard
RUN git fetch && git reset 2fb9380b342556ddb50a4b24e4fe8655d548b2b8 --hard
RUN python -m pip install --upgrade cython
RUN python -m pip install -e .
@@ -7,7 +7,7 @@ benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: {{ train_start | default("2008-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
fit_start_time: {{ train_start | default("2008-01-01", true) }}
fit_end_time: {{ train_end | default("2014-12-31", true) }}
instruments: *market
@@ -43,7 +43,7 @@ port_analysis_config: &port_analysis_config
n_drop: 5
backtest:
start_time: {{ test_start | default("2017-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
account: 100000000
benchmark: *benchmark
exchange_kwargs:
@@ -77,7 +77,7 @@ task:
segments:
train: [{{ train_start | default("2008-01-01", true) }}, {{ train_end | default("2014-12-31", true) }}]
valid: [{{ valid_start | default("2015-01-01", true) }}, {{ valid_end | default("2016-12-31", true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default(null, true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default("null", true) }}]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
@@ -7,7 +7,7 @@ benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: {{ train_start | default("2008-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
instruments: *market
data_loader:
class: NestedDataLoader
@@ -51,7 +51,7 @@ port_analysis_config: &port_analysis_config
n_drop: 5
backtest:
start_time: {{ test_start | default("2017-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
account: 100000000
benchmark: *benchmark
exchange_kwargs:
@@ -86,7 +86,7 @@ task:
segments:
train: [{{ train_start | default("2008-01-01", true) }}, {{ train_end | default("2014-12-31", true) }}]
valid: [{{ valid_start | default("2015-01-01", true) }}, {{ valid_end | default("2016-12-31", true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default(null, true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default("null", true) }}]
record:
- class: SignalRecord
module_path: qlib.workflow.record_temp
@@ -7,7 +7,7 @@ benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: {{ train_start | default("2008-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
instruments: *market
data_loader:
class: NestedDataLoader
@@ -61,7 +61,7 @@ port_analysis_config: &port_analysis_config
n_drop: 5
backtest:
start_time: {{ test_start | default("2017-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
account: 100000000
benchmark: *benchmark
exchange_kwargs:
@@ -100,7 +100,7 @@ task:
segments:
train: [{{ train_start | default("2008-01-01", true) }}, {{ train_end | default("2014-12-31", true) }}]
valid: [{{ valid_start | default("2015-01-01", true) }}, {{ valid_end | default("2016-12-31", true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default(null, true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default("null", true) }}]
{% if step_len %}step_len: {{ step_len }}{% endif %}
record:
- class: SignalRecord
@@ -5,7 +5,7 @@ market: &market csi300
benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: {{ train_start | default("2008-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
fit_start_time: {{ train_start | default("2008-01-01", true) }}
fit_end_time: {{ train_end | default("2014-12-31", true) }}
instruments: *market
@@ -41,7 +41,7 @@ port_analysis_config: &port_analysis_config
n_drop: 5
backtest:
start_time: {{ test_start | default("2017-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
account: 100000000
benchmark: *benchmark
exchange_kwargs:
@@ -80,7 +80,7 @@ task:
segments:
train: [{{ train_start | default("2008-01-01", true) }}, {{ train_end | default("2014-12-31", true) }}]
valid: [{{ valid_start | default("2015-01-01", true) }}, {{ valid_end | default("2016-12-31", true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default(null, true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default("null", true) }}]
{% if step_len %}step_len: {{ step_len }}{% endif %}
record:
- class: SignalRecord
@@ -7,7 +7,7 @@ benchmark: &benchmark SH000300
data_handler_config: &data_handler_config
start_time: {{ train_start | default("2008-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
instruments: *market
data_loader:
class: NestedDataLoader
@@ -61,7 +61,7 @@ port_analysis_config: &port_analysis_config
n_drop: 5
backtest:
start_time: {{ test_start | default("2017-01-01", true) }}
end_time: {{ test_end | default(null, true) }}
end_time: {{ test_end | default("null", true) }}
account: 100000000
benchmark: *benchmark
exchange_kwargs:
@@ -100,7 +100,7 @@ task:
segments:
train: [{{ train_start | default("2008-01-01", true) }}, {{ train_end | default("2014-12-31", true) }}]
valid: [{{ valid_start | default("2015-01-01", true) }}, {{ valid_end | default("2016-12-31", true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default(null, true) }}]
test: [{{ test_start | default("2017-01-01", true) }}, {{ test_end | default("null", true) }}]
{% if step_len %}step_len: {{ step_len }}{% endif %}
record:
- class: SignalRecord
+2 -4
View File
@@ -67,8 +67,7 @@ def get_file_desc(p: Path, variable_list=[]) -> str:
"""
p = Path(p)
JJ_TPL = Environment(undefined=StrictUndefined).from_string(
"""
JJ_TPL = Environment(undefined=StrictUndefined).from_string("""
# {{file_name}}
## File Type
@@ -76,8 +75,7 @@ def get_file_desc(p: Path, variable_list=[]) -> str:
## Content Overview
{{content}}
"""
)
""")
if p.name.endswith(".h5"):
df = pd.read_hdf(p)
@@ -463,9 +463,7 @@ def __deduplicate_factor_dict(factor_dict: dict[str, dict[str, str]]) -> list[li
description = factor_dict[factor_name]["description"]
formulation = factor_dict[factor_name]["formulation"]
variables = factor_dict[factor_name]["variables"]
factor_name_to_full_str[
factor_name
] = f"""Factor name: {factor_name}
factor_name_to_full_str[factor_name] = f"""Factor name: {factor_name}
Factor description: {description}
Factor formulation: {formulation}
Factor variables: {variables}
+1 -1
View File
@@ -683,7 +683,7 @@ class QlibCondaEnv(LocalEnv[QlibCondaConf]):
shell=True,
)
subprocess.check_call(
f"conda run -n {self.conf.conda_env_name} pip install git+https://github.com/microsoft/qlib.git@3e72593b8c985f01979bebcf646658002ac43b00",
f"conda run -n {self.conf.conda_env_name} pip install git+https://github.com/microsoft/qlib.git@2fb9380b342556ddb50a4b24e4fe8655d548b2b8",
shell=True,
)
subprocess.check_call(
+2 -5
View File
@@ -30,13 +30,10 @@ class TestEmbedding(unittest.TestCase):
"""Test embedding with very long text that exceeds token limits"""
# Create a very long text that will definitely exceed embedding token limits
# Using a repetitive pattern to simulate a real long document
long_content = (
"""
long_content = """
This is a very long document that contains a lot of repetitive content to test the embedding truncation functionality.
We need to make this text long enough to exceed the typical embedding model token limits of around 8192 tokens.
"""
* 1000
) # This should create a text with approximately 50,000+ tokens
""" * 1000 # This should create a text with approximately 50,000+ tokens
# This should trigger the gradual truncation mechanism
emb = APIBackend().create_embedding(long_content)