Are chatgpt threads taboo?  This isn't bad. - Page 1
Forum section: electronics / general

author: paulca
author_rank: Super Contributor
timestamp: February 24, 2023, 08:08:40 pm
content: https://gitlab.com/paulcam/home_heating/-/blob/master/mqtthub/future_processor.pyCode:from threading import Threadimport copyimport loggingfrom libs.master_clock import MasterClockfrom libs.logging_setup import setup_loggingsetup_logging()module_logger = logging.getLogger(__name__)module_logger.setLevel(logging.DEBUG)class FutureRequestProcessor:def __init__(self, request_queue):self.request_queue = request_queueself.handlers = []self.thread = Thread(target=self.run)self.thread.start()self.logger = module_logger.getChild(self.__class__.__name__)self.logger.addHandler(logging.NullHandler())def run(self):while True:request = self.request_queue.get()self.logger.debug("Got request: {0!s}".format(request))for handler in self.handlers:outbound_request = handler.handle(request)if outbound_request:self.logger.debug("Sending outbound request: {0!s}".format(outbound_request))def publish_request(self, request):request_json = request.to_json()topic = self.request_topic_root+"/"+request.data["zone"]self.cache.client.publish_retained(topic, request_json)class RampHandler:def __init__(self, zone, ramp_gradient):self.zone = zoneself.ramp_gradient = ramp_gradientdef handle(self, request):if request.data["zone"] != self.zone:returnif "metadata" not in request.data:return # can't compute ramp without targetmetadata = request.data["metadata"]if "targetTemp" not in metadata:return # can't compute ramp without targetif "currentTemp" not in metadata:return # can't compute ramp without current tempfuture = request.data["timestamp"]current_temp = metadata["currentTemp"]target_temp = metadata["targetTemp"]now = MasterClock.instance.get_current_time()request_gradient = self.compute_ramp(future, now, current_temp, target_temp)if request_gradient >= self.ramp_gradient:# should start to ramp up now.request_target = self.compute_ramp_point_temp(target_temp, now, future)metadata["targetTemp"] = request_targetmetadata["future"] = copy.deepcopy(request.data)return requestreturn Nonedef compute_ramp_point_temp(self, target, now, future):future_y = targetfuture_x = futurenow_x = nowdelta_x = future_x - now_xdelta_y = (delta_x/3600) * self.ramp_gradientnow_y = future_y - delta_y# TODO Does this assuming heating?# Oh fuck off. I live in Ireland.return now_ydef compute_ramp(self, future, now, current, target):delta = target - currentif delta < 0:return # negative shouldn't happen??? unless it's coolingtime_delta = future - nowrequest_gradient = float(delta) / float(time_delta)request_gradient_degrees_per_hour = float(delta) / float((time_delta / 3600))return request_gradient_degrees_per_hourCan you tell me what some code does?Quote<Paste example above.>QuoteSounds epic. Sounds about right. But is it correct?

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 25, 2023, 05:11:53 pm
content: Quote from: paulca on February 24, 2023, 08:08:40 pmAsk ChatGPT.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 25, 2023, 09:50:13 pm
content: Quote from: Nominal Animal on February 25, 2023, 05:11:53 pm

author: Psi
author_rank: Super Contributor
timestamp: February 25, 2023, 09:56:57 pm
content: I think a thread simply about asking ChatGPT something has probably had it's time now.Unless it's something actually novel and new.But I think it's fine to post a chatGPT answer to something in an existing thread. The modern day equivalent of "let me google that for you". hehe

author: xrunner
author_rank: Super Contributor
timestamp: February 25, 2023, 10:37:31 pm
content: How about how to build ChatGPT? I think this is pretty interesting. It's nearly 2 hours long but I found I understood much more about it by watching the first 20 minutes or so of the coding process.We build a Generatively Pretrained Transformer (GPT), following the paper "Attention is All You Need" and OpenAI's GPT-2 / GPT-3.