File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 178178 " def initialize_local_llm():\n " ,
179179 " tracker = OfflineEmissionsTracker(country_iso_code=COUNTRY_ISO_CODE)\n " ,
180180 " tracker.start()\n " ,
181- " \n " ,
181+ " \n " ,
182182 " device = 0 if USE_GPU else -1\n " ,
183183 " tokenizer = AutoTokenizer.from_pretrained(LLM_MODEL)\n " ,
184184 " model = AutoModelForSeq2SeqLM.from_pretrained(\n " ,
198198 " top_p=0.95,\n " ,
199199 " device=device,\n " ,
200200 " )\n " ,
201- " \n " ,
201+ " \n " ,
202202 " emissions = tracker.stop()\n " ,
203203 " print(f\" Model loading emissions: {emissions:.6f} kg CO2\" )\n " ,
204- " \n " ,
204+ " \n " ,
205205 " return HuggingFacePipeline(pipeline=pipe), emissions\n " ,
206206 " \n " ,
207+ " \n " ,
207208 " llm, emissions_loading = initialize_local_llm()"
208209 ]
209210 },
835836 " print(f\" 15 queries: {emissions_inference:.6f} kg CO2\" )\n " ,
836837 " print(f\" TOTAL EMISSIONS: {total_emissions:.6f} kg CO2\" )\n " ,
837838 " print(f\" Equivalent to: {total_emissions * 1000:.2f} g CO2\" )\n " ,
838- " print(f\" - Per query average: {emissions_inference/ len(prompts):.6f} kg CO2\" )"
839+ " print(f\" - Per query average: {emissions_inference / len(prompts):.6f} kg CO2\" )"
839840 ]
840841 }
841842 ],
You can’t perform that action at this time.
0 commit comments