Skip to content

Teacherenv#416

Open
J-SUPHA wants to merge 55 commits intomainfrom
teacherenv
Open

Teacherenv#416
J-SUPHA wants to merge 55 commits intomainfrom
teacherenv

Conversation

@J-SUPHA
Copy link
Collaborator

@J-SUPHA J-SUPHA commented Mar 13, 2026

No description provided.


if isinstance(default_server_configs, APIServerConfig):
server_configs = final_openai_config
server_configs = [final_openai_config]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you pass a list of configs here it uses the configs directly. But if you pass a single non list config object, it goes into "template mode" and auto-generates server URLs/ports

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — the issue was the wrong config shape here. I fixed it so this path now returns [final_openai_config] instead of a bare APIServerConfig.

Copy link
Collaborator

@dmahan93 dmahan93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not think different tokenizer distillation is possible so at minimum remove it from this pr, if it is possible move to dms and we can get a blog post out

Comment on lines +66 to +89
teacher_base_url: Optional[str] = Field(
default=None,
description="Teacher server base URL (OpenAI-compatible).",
)
teacher_model_name: Optional[str] = Field(
default=None,
description="Teacher model name used in teacher server requests.",
)
teacher_api_key: str = Field(
default="",
description="Teacher API key, if required by the teacher endpoint.",
)
teacher_server_type: str = Field(
default="vllm",
description="Teacher server type (e.g. vllm, sglang, trl, openai).",
)
teacher_tokenizer_name: str = Field(
default="none",
description=(
"Tokenizer name for teacher server. If 'none', teacher_model_name is used. "
"When this resolves to a different vocabulary than the student tokenizer, "
"cross-tokenizer alignment is applied automatically."
),
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just make these ServerConfigs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — I moved those endpoint fields into teacher_server: APIServerConfig on TeacherDistillationConfig

)

async with self.server.managed_server(tokenizer=self.tokenizer) as managed:
logger.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.debug please

max_tokens=self.config.max_token_length,
temperature=1.0,
)
logger.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.debug


state = managed.get_state()
nodes = state["nodes"]
logger.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.debug

Comment on lines +106 to +107
"X-Atropos-Client": "trainer",
"X-Atropos-Pid": str(os.getpid()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

er, what are these for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a sanity check - it has been removed


if isinstance(default_server_configs, APIServerConfig):
server_configs = final_openai_config
server_configs = [final_openai_config]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teacher_server: Optional[APIServerConfig] = Field(
default=None,
description="Teacher inference server configuration.",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i probably commented poorly, it should be the same as how we setup the server_manager, so we may need to pass in a new thing to init

Copy link
Collaborator Author

@J-SUPHA J-SUPHA Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this to follow this pattern. I removed teacher_server from TeacherDistillationConfig, so the env config now only carries env-level knobs like teacher_enabled and teacher_top_k. Teacher server wiring is now passed separately via teacher_server_configs at init

"teacher_top_k", self.config.teacher_top_k
)
)
top_k = max(1, top_k)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max should be 0, because prompt logprobs are (selected token + topk), disabled would be setting it to -1 or lower. I would also be amenable to a group override that's skip_teacher_top_k

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this may need to be reverted?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

@J-SUPHA J-SUPHA requested a review from dmahan93 March 14, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants