Output issues

#3
by mgutierrezc442 - opened

Hi all! Congratulations on the paper! I'm having some issues when testing locally.

This is the raw response I get from the model

prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. After answering the question, you MUST output your EOS token. \n\n### Instruction:\nJanet’s ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?\n\n### Response: Let's think step by step.

response

First, let me parse the problem again to ensure I have all details correct.

Janet has ducks which produce 16 eggs each day (per day).<th, so total per day from the ducks).

She then consumes three of those eggs herself as part of her breakfast routine—so subtracting three from the original count gives us:

Total eggs produced = 16

Minus the three she uses for breakfast leaves us with remaining eggs after her consumption before any other use or sale occurs? Wait no—the problem says "bakes muffins...with four"—wait perhaps there are more steps here because the problem mentions "four" but it might be referring to something else like the number of muffins baked instead of the number of eggs used elsewhere besides the market sales.

Wait hold on—I need to read carefully once again since my initial parsing may not account correctly for some elements mentioned later possibly affecting calculations beyond just the eggs sold via the market.

The full sentence given was:

"Janet’s ducks lay 16 eggs per day; She eats three for breakfast every morning and bakes muffins for her friends every day with [four]; She sells the remainder at the farmers’ market daily for \$2 per fresh duck egg."

Ah! The key detail missing earlier could come into play when considering how many eggs are left over aside from what she bakes muffins using—if the baking process requires consuming additional eggs—but wait actually maybe the 'four' refers specifically about the number of muffins made rather than directly tied to the usage of eggs otherwise except through the market selling price being based only on the eggs leftover post her consumption plus whatever else isn't accounted yet until we clarify exactly where these numbers fit together properly.

Let me try breaking down this information piece-by-piece systematically now without prior assumptions interfering further analysis:

Given data points:

1) Ducks Lay 16 Eggs Per Day → Total eggs available/day=16
2) She Eats Three Eggs for Breakfast Every Morning→ So she takes away/uses up3 eggs per day.
Remaining eggs would thus initially seem calculated as 16-3=13?
But next point comes...

3) Bakes Muffins For Her Friends With Four → Hmm,the wording seems ambiguous whether “With” indicates quantity related to the previous action(i.e., making muffins)or if“Four”is another separate item。Perhaps the phrase should parsed differently。

Alternatively,“Bakes muffins…everyday with[四]”可能这里的“四”指的是某种固定参数比如每个朋友得到的 muffin数量是4个?或者可能是“每天用四个鸡蛋来制作松饼”,即使用四只鸡蛋来制作松饼?

This ambiguity needs resolving first因为如果“四”是指她用来制作松饼的鸡蛋数目,则这将影响剩余可出售的eggs的数量计算;而若“四”是无关紧要的信息如松饼的类型或数量不直接关联到鸡蛋消耗则可能可以忽略该信息对最终计算的影响——但需要明确问题陈述中的各个部分如何相互作用。

根据原题描述:“She bakes muffins for her friends every day with 四.” 这里的“with 四”的可能含义是:每制作一个松饼需要用到四只鸡蛋?或者说她每天为朋友们做松饼,每次用四只鸡蛋?或者更可能的是,在制作松饼时用了四只鸡蛋作为材料之一,并且这个过程消耗了额外的eggs从而减少可出售的eggs数量?

假设“四”指的是制作每个松饼所需的鸡蛋数目的话那么我们需要知道她每天为朋友们做多少松饼才能确定总鸡蛋被用于松饼的部分量。然而题目中并没有提到关于松饼的具体数量而是说“bakes muffins … 每天与四”所以或许这里的“四”是一个定值,例如每个松饼需要四只鸡蛋因此如果她每天为朋友们做X个松饼的话就会消耗4*X枚的eggs那这样我们就能算出具体数值但是由于题目中没有给出关于松饼数量的数据点,这就可能意味着我的理解有误之处。

另一种可能性就是“四”在这里指的是松饼的总数目而不是鸡蛋用量相关联的情况,此时可能这个“四”只是一个无关紧要的修饰词,例如“每天用四只松饼”或者其他无关紧要的信息,这种情况下我们可以忽略它对计算的影响因为它并不直接关联到鸡蛋的消耗上。

然而,原句的结构是:"She bakes muffins ... every day with 四." 如果这里的“with 四”是修饰整个烤松饼活动,那么可能这个“四”指的是每天烤松饼的总数目比如说四次?或者四批?但这又会回到需要具体数字的问题。

现在我意识到可能存在翻译上的误差导致误解关键数据点。“With four”在中文里可能更准确的表达方式是“用四只鸡蛋” 或者其他直接关联到eggs使用的语句,否则无法进行

Below is the code I used

def load_tok_and_model(model_id="open-thoughts/OpenThinker2-7B", 
                       device_map="auto", torch_dtype=torch.float16,
                       model_dir="/scratch/sgw3fy/models/lms",
                       skip_special_tokens=True, stop_strings=["</ANSWER>"]):
    """
    Load the tokenizer and model from the Hugging Face hub or local cache
    for autoregressive models
    """
    
    tokenizer = AutoTokenizer.from_pretrained(
        model_id,
        use_fast=False,
        trust_remote_code=True
        )
    model = AutoModelForCausalLM.from_pretrained(
        model_id,
        device_map=device_map,
        cache_dir=model_dir
        )

    if tokenizer.pad_token is None:
        tokenizer.pad_token = tokenizer.eos_token
        model.config.pad_token_id = tokenizer.eos_token_id
    
    return tokenizer, model
Open Thoughts org

Hi! I think you should apply the chat template. tokenizer.apply_chat_template around the prompt, and it should work! LMK if that doesn't work for you!

Hi again! Still have the issue

Okay, so I need to figure out how much money Janet makes each day from selling her duck eggs at the farmers' market. Hmm, let me start breaking down the information given.

First, the problem says that her ducks lay 16 eggs per day. That seems straightforward—so total eggs produced daily = 16. Now, she uses some of these eggs herself or gives them away, right? The rest would be sold at the market. So we have two main things here where she consumes eggs:

She eats three for breakfast every morning. And then there's another part about baking muffins "with" (wait, maybe it means using) four more... Wait actually reading again carefully—"bakes muffins ...every day with four." Maybe those numbers refer directly as well—that could mean either eating/making something else requires exactly x number of eggs but perhaps not sure yet...

Wait hold on—the exact wording was “eats three for breakfast” which subtracts straight off; similarly, when they say 'four', like ‘she bakes muffins…’ probably also consuming/using up certain amount too before any sales happen because otherwise if all were used except what remains after both actions can't sell anything left over unless specified differently.)

So first parse this correctly:

Total eggs laid/day=16

She EATS THREE for breakfast → consumed by her own consumption,

Then BAKES MUFFINS FOR HER FRIENDS EVERY DAY WITH FOUR – wait now parsing ambiguity arises—isn’t baked muffins needing ingredients possibly requiring multiple eggs—but since no further details provided beyond just stating quantity needed ("for", etc.), likely similar structure—if someone writes e.g., "uses five eggs," meaning takes X eggs towards their purpose regardless other than being counted toward usage/consumption/sales).

Alternatively, sometimes problems might phrase such quantities without specifying whether its absolute count versus proportionally based upon recipe requirements—for example, making one batch needs six eggs even though only wanting enough for half—a common trickery point—and thus leading into confusion between actual counts vs required amounts depending on batches made). But absence explicit info suggests simplest interpretation possible assuming direct subtraction rather than proportional recipes involved)

Assuming that "bakes muffins … with [number]" implies taking precisely N eggs specifically allocated solely for that use case—independently separate from the three eaten earlier), hence total eggs accounted-for via consumption/baking plus leftovers available for sale must equal original production minus whatever isn't mentioned elsewhere?)

Therefore proceeding under assumption that:

Total eggs starting : 16 /day

Subtract eggs eaten + eggs put into muffins ⇒ remaining will go to market.

Thus compute leftover = Total - (3+4)= ?

Let calculate mathematically:

Eggs Used For Breakfast & Muffins Combined Per Day =

3 (breakfast) +

4 (muffins),

totaling 7 eggs utilized/dedicated aside from market.

Hence remaining eggs unaccounted/unconsumed/not used in muffins remain to be sold => 16-7=9 eggs remained.

Each unsold egg brought home is sold at $2/fresh egg — therefore total revenue per day should equate to # of eggs * price/unit i.e.: \$0.02*9? No sorry dollar sign indicates USD presumably standard units—not cents! Thus calculation proceeds accordingly):

Wait correction: 9 eggs ×$2 per egg equals nine multiplied by twenty dollars…

Yes indeed, yes correct arithmetic-wise!

But hang-on double-check my steps once through thoroughly ensuring correctness.

Step-by-step breakdown:

Daily Production:16 eggs。

Consumption Breakdown:

1. Eaten By Jan: 3 eggs.

2. Eggs Used In Muffins: Assuming same way,the phrasing“bakes muffins……每 with 四个”(assuming translation may imply四 eggs)?The key term是中文原题中的“用四个”可能直接指代数量。因此,假设她每天用四枚鸡蛋来制作松饼或其他东西?

If 她每天用四枚鸡蛋做松饼,则总消耗的鸡蛋数为3( breakfast)+4(muffins )=七枚蛋被消耗或用于其他用途,并未进入市场销售环节)

剩下的就是16−7 =九枚鸡蛋,这些可以以每个$2的价格卖出.所以总销售额应为9×2=$十八美元每日.这似乎是答案了对吗?

但需要再仔细检查是否有哪里疏漏的地方或者理解错误之处呢?

比如是否“bakes muffins for her friends 每天与四位”这里的“四位”的单位是不是可能指的是人数而非鸡蛋的数量?例如,“和她的朋友们一起烤松饼用了四位”——但这样翻译的话可能不太对劲;而英文题目中原文可能是更明确的数字描述如:“With Four”即使用四枚鸡蛋作为松饼的材料等)。如果没有其他信息的情况下,必须按照常规数学题设定处理方式来看问题,即所有提到的数字都是直接消耗的鸡蛋数目而不是

This is the code for generation using the chat template

def obtain_response(instruction, dataset_name, input_question, model, tokenizer, examples=None, temperature=0, max_new_tokens=1000, apply_chat_template=False):
    """
    Obtains a response as a str
    """
    
    raw_input = instruction + "\n\n" + input_question

    # generate the response
    if apply_chat_template:
        input_ids = tokenizer.apply_chat_template([{"role": "user", "content": raw_input}], return_tensors="pt").to("cuda")
        if temperature != 0:
            output = model.generate(input_ids, max_new_tokens=max_new_tokens, do_sample=True, temperature=temperature, top_k=0, top_p=1, num_beams=1)     
        else:
            output = model.generate(input_ids, max_new_tokens=max_new_tokens, do_sample=False, num_beams=1) 
    else:
        input_ids = tokenizer(raw_input, return_tensors="pt").to("cuda")
        if temperature != 0:
            output = model.generate(**input_ids, max_new_tokens=max_new_tokens, do_sample=True, temperature=temperature, top_k=0, top_p=1, num_beams=1)     
        else:
            output = model.generate(**input_ids, max_new_tokens=max_new_tokens, do_sample=False, num_beams=1) 
    
    # decode the output
    return tokenizer.decode(output[0], skip_special_tokens=True)

Sign up or log in to comment