初始化项目,由ModelHub XC社区提供模型
Model: seihyun87/broken-model Source: Original Platform
This commit is contained in:
72
README.md
Normal file
72
README.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
base_model:
|
||||
- Qwen/Qwen3-8B
|
||||
---
|
||||
|
||||
# broken-model: 수정 사항 문서
|
||||
|
||||
원본 모델: [yunmorning/broken-model](https://huggingface.co/yunmorning/broken-model)
|
||||
|
||||
## 문제
|
||||
|
||||
이 모델로 `/chat/completions` API 서버를 실행할 수 없었다. 요청 시 다음 에러 반환:
|
||||
|
||||
```json
|
||||
{"message": "no configured chat prompt template; use non-chat endpoint instead"}
|
||||
```
|
||||
|
||||
참고: `/v1/completions` (text completion)은 raw text prompt를 직접 사용하므로 chat template 없이도 정상 작동했다.
|
||||
|
||||
## 원인
|
||||
|
||||
`tokenizer_config.json`에 `chat_template` 필드가 누락되어 있었다.
|
||||
|
||||
`/chat/completions` 엔드포인트는 messages 배열 (예: `[{"role": "user", "content": "hello"}]`)을 모델이 이해하는 텍스트 형식으로 변환해야 한다. 이 변환 규칙이 `chat_template`에 정의되어 있으며, 이 필드가 없으면 서버가 messages를 모델 입력으로 변환할 수 없어 에러가 발생한다.
|
||||
|
||||
## 설정 파일 분석
|
||||
|
||||
| 파일 | 필드 | 값 | 판단 |
|
||||
|------|------|-----|------|
|
||||
| `config.json` | `architectures` | `["Qwen3ForCausalLM"]` | 정상 |
|
||||
| `config.json` | `model_type` | `"qwen3"` | 정상 |
|
||||
| `config.json` | `vocab_size` | `151936` | 정상 (Qwen3) |
|
||||
| `config.json` | `num_hidden_layers` | `36` | 정상 (Qwen3-8B) |
|
||||
| `tokenizer_config.json` | `tokenizer_class` | `"Qwen2Tokenizer"` | 허용 (Qwen3는 Qwen2Tokenizer 사용) |
|
||||
| `tokenizer_config.json` | `chat_template` | **누락** | **근본 원인** |
|
||||
| `README.md` | `base_model` | `meta-llama/Meta-Llama-3.1-8B` → `Qwen/Qwen3-8B` | 수정 (Optional — 추론에 영향 없지만 정확한 출처 기록) |
|
||||
|
||||
## 수정 내용
|
||||
|
||||
**변경 파일**: `tokenizer_config.json`
|
||||
|
||||
**변경 사항**: 공식 [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B)의 `chat_template` 필드를 추가했다.
|
||||
|
||||
이 템플릿은 ChatML 형식(`<|im_start|>` / `<|im_end|>`)을 사용하며 다음을 지원한다:
|
||||
- System / user / assistant 메시지 포맷팅
|
||||
- Tool call 포맷팅 (`<tool_call>` / `</tool_call>`)
|
||||
- Reasoning/thinking 블록 (`<think>` / `</think>`)
|
||||
|
||||
추가로 `README.md`의 YAML frontmatter에서 `base_model`을 `meta-llama/Meta-Llama-3.1-8B` → `Qwen/Qwen3-8B`로 수정했다. 이 필드는 HuggingFace Hub UI에 표시되는 metadata이며 추론 동작에는 영향을 주지 않지만, 모델 출처를 정확히 기록하여 사용자 혼란을 방지한다.
|
||||
|
||||
## 검증
|
||||
|
||||
**수정 전** (`/v1/chat/completions`):
|
||||
```json
|
||||
{"message": "no configured chat prompt template; use non-chat endpoint instead"}
|
||||
```
|
||||
|
||||
**수정 후** (`/v1/chat/completions`):
|
||||
```json
|
||||
{
|
||||
"choices": [{
|
||||
"finish_reason": "stop",
|
||||
"message": {
|
||||
"content": "Hello! How can I assist you today?",
|
||||
"reasoning_content": "Okay, the user just said \"hello\"...",
|
||||
"role": "assistant"
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user