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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #425 · 20 апр.

Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках. Выглядело это примерно так: from fastapi.concurrency import run_in_threadpool async def execute(data: DataRequest) -> DataResponse: try: result = await run_in_threadpool(sync_function, data) return DataResponse(data=result) except Exception as e: return DataResponse( error=str(e), success=False, ) В общем работает нормально. Для всех вызовов под капотом используется общий тредпул, всё работает предсказуемо. Но потребовалось изменить количество запускаемых в пуле потоков (по умолчанию создается 40 воркеров). Так как дело происходит с FastAPI, делается это через lifespan используя настройки anyio: import anyio @asynccontextmanager async def lifespan(app: FastAPI): limiter = anyio.to_thread.current_default_thread_limiter() limiter.total_tokens = 100 yield # если вдруг нужно вернуть обратно limiter.total_tokens = 40 Зачем менять количество воркеров? - уменьшить, если оперативки мало (один тред занимает ~8мб) - увеличить чтобы выдержать нагрузку Если есть предложения получше при тех же вводных - предлагайте😉 #async

Hashtags

Резултати

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

Пребарај: #democratization

当前筛选 #democratization清除筛选
Crypto M - Crypto News

@CryptoM · Post #65110 · 11.04.2026 г., 02:24

🚀 AI TRENDS | OpenAI's Sam Altman Addresses AI Development Concerns and Recent Incident OpenAI founder Sam Altman has expressed understanding of societal fears regarding the rapid development of artificial intelligence. According to Odaily, Altman acknowledged that the current period is marked by significant technological change, with associated risks escalating to systemic challenges at the societal level. He emphasized that AI power should not be concentrated in a few institutions and advocated for broader distribution through technological democratization and institutional constraints. Addressing a recent incident where his residence was targeted with a Molotov cocktail, Altman admitted to underestimating the impact of public narratives and emotions amid AI-related anxieties. He also acknowledged mistakes in company governance and conflict management, offering apologies for past actions. Furthermore, Altman reiterated his decision to reject Elon Musk's attempts to control OpenAI, ensuring the company's independent development. Previously, it was reported that the OpenAI founder's residence was attacked with a Molotov cocktail. #AI#OpenAI#SamAltman#AIdevelopment#technologicalchange#AIsociety#democratization#institutionalconstraints#Molotovcocktail#publicnarratives#conflictmanagement#ElonMusk#companygovernance#independence

Venture Village Wall 🦄

@venturevillagewall · Post #3649 · 21.12.2024 г., 10:24

Decart Secures $32M Funding Round Decart raises $32M in a funding round on December 19, 2024. The company aims to democratize consumer AI with innovative solutions. Backed by Sequoia Capital and Zeev Ventures, Decart enhances GPU efficiency for AI model training, making advanced AI tools more accessible. It disrupts gaming and entertainment by enabling immersive experience creation from text prompts. Learn more #Decart#Funding#AI#GPU#Gaming#Entertainment#SequoiaCapital#ZeevVentures#ConsumerAI#TextToExperience#Innovation#Platform #2024 #Revolutionary#Technology#Access#Development#Efficiency#Democratization#Tools#Industry