TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #402 · 22 дек.

Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11. Ключевые отличия ▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля ▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста ▫️ошибка автоматически отменяет незавершенные задачи, ▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно import asyncio import random async def do_it() -> str: if random.random() < 0.1: raise ValueError('Oops') delay = random.uniform(0.5, 1.5) await asyncio.sleep(delay) return delay async def main(): try: async with asyncio.TaskGroup() as tg: for _ in range(10): tasks.append(tg.create_task(do_it())) for t in tasks: print(t.result()) except *ValueError as e: for err in e.exceptions: print(err) asyncio.run(main()) Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов - таймауты - отмена задач - создание задач из другого потока #async

Hashtags

Резултати

Пронајдени 1 слични објави

Пребарај: #cmaaiprinciples

当前筛选 #cmaaiprinciples清除筛选
AI & Law

@ai_and_law · Post #124 · 27.09.2023 г., 07:04

UK: CMA Releases Principles for Responsible AI Development Hello, everyone! The Competition and Markets Authority (CMA) has unveiled a set of principles to ensure the responsible development and use of foundation models (FMs) in AI. Foundation models, like ChatGPT and Office 365 Copilot, are versatile AI systems poised to revolutionize various sectors. The CMA's report lays out these guiding principles, with a focus on safeguarding consumer protection and fostering healthy competition in the AI industry. As AI rapidly integrates into our daily lives, the CMA recognizes the need for proactive intervention. These principles aim to strike a balance between promoting AI's potential for innovation and ensuring consumer safety. The CMA's proposed guiding principles focus on crucial areas like accountability, access, diversity, choice, flexibility, fairness, and transparency. These principles aim to guide FM developers and deployers toward responsible AI development and use. The CMA plans to engage extensively with stakeholders to refine these principles further. Stay tuned for updates in early 2024 as they continue shaping AI markets for the betterment of all. #ResponsibleAI#AIRegulation#ConsumerProtection#Competition#FoundationModels#CMAAIprinciples