--- base_model: - cyberagent/DeepSeek-R1-Distill-Qwen-32B-Japanese - Qwen/Qwen2.5-32B - karakuri-ai/karakuri-lm-32b-thinking-2501-exp - NovaSky-AI/Sky-T1-32B-Flash library_name: transformers tags: - mergekit - merge language: - ja pipeline_tag: text-generation license: apache-2.0 --- # FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-Japanese-32B-Preview 💡 **This model was created based on [FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-32B-Preview.yaml](https://github.com/fanqiwan/FuseAI/blob/main/FuseO1-Preview/mergekit/fuseo1_configs/)** This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit). ## Code Generation example These parameters are based on the `evaluation/README.md` of [FuseO1-Preview](https://github.com/fanqiwan/FuseAI/blob/main/FuseO1-Preview/evaluation). - temperature: 0.7 - max_tokens: 32768 ``` 1から100までのFizzBuzzプログラムをPythonで作成してください。 ``` ### Reasoning tokens ``` まず、FizzBuzzプログラムを作成する必要があります。1から100まで数えて、3の倍数ならFizz、5の倍数ならBuzz、両方の倍数ならFizzBuzzと出力します。 最初に、ループを作る必要があります。range関数を使って1から100まで回します。for文を使いますね。 次に、各数が3と5の両方の倍数かどうかをチェックします。つまり、15の倍数かどうかです。もし15の倍数ならFizzBuzzと出力します。 そうでなければ、3の倍数かどうかをチェックします。3の倍数ならFizzと出力。 さらに、5の倍数かどうかをチェックしてBuzzを出力。 それ以外の数はそのまま数字を出力します。 条件分岐の順番が重要です。両方の場合を先にチェックしないと、例えば15の場合、3の倍数と5の倍数のどちらかの条件に引っかかってFizzかBuzzだけになってしまうからです。 なので、最初に15の倍数かどうかをチェックします。次に3の倍数、次に5の倍数、それ以外は数字を出力する流れにします。 その条件をif文で表現します。Pythonでは、if、elif、elseを使います。 例えば、n % 15 == 0の場合、FizzBuzzをプリント。 n % 3 == 0ならFizz。 n %5 ==0ならBuzz。 それ以外はstr(n)をプリント。 これで1から100まで順番に出力できますね。 テストしてみます。例えば15はFizzBuzz、3はFizz、5はBuzz、2は2と出力されるはずです。 これで問題なさそうです。 ``` ### Code ```python for n in range(1, 101): if n % 15 == 0: print("FizzBuzz") elif n % 3 == 0: print("Fizz") elif n % 5 == 0: print("Buzz") else: print(n) ``` ### Details
Click to see the complete output of this model **Model**: [nitky/FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-Japanese-32B-Preview](https://huggingface.co/nitky/FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-Japanese-32B-Preview) ```` <|begin▁of▁sentence|><|User|>1から100までのFizzBuzzプログラムをPythonで作成してください。<|Assistant|> まず、FizzBuzzプログラムを作成する必要があります。1から100まで数えて、3の倍数ならFizz、5の倍数ならBuzz、両方の倍数ならFizzBuzzと出力します。 最初に、ループを作る必要があります。range関数を使って1から100まで回します。for文を使いますね。 次に、各数が3と5の両方の倍数かどうかをチェックします。つまり、15の倍数かどうかです。もし15の倍数ならFizzBuzzと出力します。 そうでなければ、3の倍数かどうかをチェックします。3の倍数ならFizzと出力。 さらに、5の倍数かどうかをチェックしてBuzzを出力。 それ以外の数はそのまま数字を出力します。 条件分岐の順番が重要です。両方の場合を先にチェックしないと、例えば15の場合、3の倍数と5の倍数のどちらかの条件に引っかかってFizzかBuzzだけになってしまうからです。 なので、最初に15の倍数かどうかをチェックします。次に3の倍数、次に5の倍数、それ以外は数字を出力する流れにします。 その条件をif文で表現します。Pythonでは、if、elif、elseを使います。 例えば、n % 15 == 0の場合、FizzBuzzをプリント。 n % 3 == 0ならFizz。 n %5 ==0ならBuzz。 それ以外はstr(n)をプリント。 これで1から100まで順番に出力できますね。 テストしてみます。例えば15はFizzBuzz、3はFizz、5はBuzz、2は2と出力されるはずです。 これで問題なさそうです。 以下はPythonでFizzBuzzプログラムを実装したものです。1から100までの数を順に処理し、条件に応じて「Fizz」「Buzz」「FizzBuzz」を出力します。 ```python for n in range(1, 101): if n % 15 == 0: print("FizzBuzz") elif n % 3 == 0: print("Fizz") elif n % 5 == 0: print("Buzz") else: print(n) ``` ### 解説 1. **ループ処理**: `range(1, 101)`で1から100までループします。 2. **条件チェック**: - 15の倍数(3と5の共通倍数)の場合、「FizzBuzz」を出力。 - 3の倍数の場合、「Fizz」を出力。 - 5の倍数の場合、「Buzz」を出力。 - 上記いずれにも当てはまらない数は、そのまま数値を出力します。 3. **条件分岐の順序**: 最も条件が厳しい「15の倍数」を最初にチェックすることで、重複を防ぎます。 このコードを実行すると、期待通りのFizzBuzzパターンが表示されます。 ````
Click to see the complete output of the base model **Model**: [FuseAI/FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-32B-Preview](https://huggingface.co/FuseAI/FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-32B-Preview) ```` <|begin▁of▁sentence|><|User|>1から100までのFizzBuzzプログラムをPythonで作成してください。<|Assistant|> Alright, I need to create a FizzBuzz program in Python that goes from 1 to 100. Let me think about how to approach this. First, I remember that FizzBuzz is a common programming problem where for numbers divisible by 3, you print "Fizz"; for those divisible by 5, "Buzz"; and for numbers divisible by both 3 and 5, "FizzBuzz". Otherwise, just print the number itself. So, I'll need to loop through numbers from 1 to 100. In Python, I can use a for loop with range(1, 101) since range is exclusive at the upper end. Next, for each number, I need to check the conditions: 1. If divisible by both 3 and 5 (i.e., divisible by 15), print "FizzBuzz". 2. Else if divisible by 3, print "Fizz". 3. Else if divisible by 5, print "Buzz". 4. Else, print the number. I should structure the if-elif-else statements in that order to ensure the correct hierarchy. Checking for 15 first is important because if I check for 3 first, it would trigger before 15, which is incorrect. Let me draft the code structure: - Loop from 1 to 100. - For each number, check divisibility by 15, then 3, then 5. - Print the corresponding string or the number. I also need to make sure that the print statements are correct, without any extra spaces or characters. Testing with a few examples might help. For instance: - 3 → "Fizz" - 5 → "Buzz" - 15 → "FizzBuzz" - 7 → 7 I think that's the correct logic. Now, I'll write the code accordingly. 以下に、1から100までのFizzBuzzプログラムのPythonコードを示します。 ```python for i in range(1, 101): if i % 15 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i) ``` ````
## Test environment This model was tested using [text-generation-webui](https://github.com/oobabooga/text-generation-webui/tree/main). I use preset `min_p` with temperature=1 for Generation. ## Usage This format must be adhered to strictly, as deviations may result in less optimal outputs from the model. The template used to construct a prompt for the instruct model is specified as follows: ``` <|begin▁of▁sentence|>{SYSTEM_PROMPT}<|User|>{USER_MESSAGE}<|Assistant|> ``` For the "{SYSTEM_PROMPT}" part, You can use "あなたは誠実で優秀な日本人のアシスタントです。" or "You are a helpful assistant." However, if you want to give complex instructions to this model, we recommend using {USER_MESSAGE}. For the "{USER_MESSAGE}" part, We recommend using {instruction}\n{input} In other words, We recommend the following: ``` <|begin▁of▁sentence|><|User|>{instruction}\n{input}<|Assistant|> ``` ### Use the instruct model ```python from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer model_name = "nitky/FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-Japanese-32B-Preview" model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto") tokenizer = AutoTokenizer.from_pretrained(model_name) streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True) messages = [ {"role": "user", "content": "Hello Worldを出力するシンプルなPythonプログラムを書いてください。"} ] input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device) output_ids = model.generate(input_ids, max_new_tokens=4096, temperature=0.7, streamer=streamer) ``` ## Merge Details ### Merge Method This model was merged using the [SCE](https://arxiv.org/abs/2408.07990) merge method using [Qwen/Qwen2.5-32B](https://huggingface.co/Qwen/Qwen2.5-32B) as a base. ### Models Merged The following models were included in the merge: * [cyberagent/DeepSeek-R1-Distill-Qwen-32B-Japanese](https://huggingface.co/cyberagent/DeepSeek-R1-Distill-Qwen-32B-Japanese) * [karakuri-ai/karakuri-lm-32b-thinking-2501-exp](https://huggingface.co/karakuri-ai/karakuri-lm-32b-thinking-2501-exp) * [NovaSky-AI/Sky-T1-32B-Flash](https://huggingface.co/NovaSky-AI/Sky-T1-32B-Flash) ### Configuration The following YAML configuration was used to produce this model: ```yaml merge_method: sce base_model: Qwen/Qwen2.5-32B models: # Pivot model - model: Qwen/Qwen2.5-32B # Target models - model: karakuri-ai/karakuri-lm-32b-thinking-2501-exp - model: cyberagent/DeepSeek-R1-Distill-Qwen-32B-Japanese - model: NovaSky-AI/Sky-T1-32B-Flash parameters: select_topk: 1.0 dtype: bfloat16 name: FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-Japanese-32B-Preview ``` In margekit v1.0, there are some merge methods that cause problems when specifying `tokenizer_source`, so you need to copy these correct configs. ```bash cd nitky_FuseO1-DeepSeekR1-QwQ-SkyT1-Flash-Japanese-32B-Preview # If special_tokens_map.json exists, the output will not stop, so please make sure to delete it. rm added_tokens.json merges.txt tokenizer.json tokenizer_config.json special_tokens_map.json vocab.json cp ../cyberagent_DeepSeek-R1-Distill-Qwen-32B-Japanese/tokenizer.json tokenizer.json cp ../cyberagent_DeepSeek-R1-Distill-Qwen-32B-Japanese/tokenizer_config.json tokenizer_config.json ``` [DeepSeek-R1-Distill-Qwen-32B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B) has [incorrect `bos_token_id`](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B/discussions/28), so you will also fix `config.json` to the correct parameters. ```json { "architectures": [ "Qwen2ForCausalLM" ], "attention_dropout": 0.0, "bos_token_id": 151646, "eos_token_id": 151643, "hidden_act": "silu", "hidden_size": 5120, "initializer_range": 0.02, "intermediate_size": 27648, "max_position_embeddings": 131072, "max_window_layers": 64, "model_type": "qwen2", "num_attention_heads": 40, "num_hidden_layers": 64, "num_key_value_heads": 8, "rms_norm_eps": 1e-05, "rope_theta": 1000000.0, "sliding_window": 131072, "tie_word_embeddings": false, "torch_dtype": "bfloat16", "transformers_version": "4.47.1", "use_cache": true, "use_sliding_window": false, "vocab_size": 152064 } ```