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 слични објави

Пребарај: #turingaward

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

@ai_and_law · Post #522 · 10.03.2025 г., 08:04

❗️Turing Award Winners Sound the Alarm on AI Safety Andrew Barto and Richard Sutton, pioneers of foundational AI training method and recipients of this year’s Turing Award, are using their moment in the spotlight to issue a stark warning: AI companies are prioritizing profit over safety. Comparing the current approach to “building a bridge and testing it by having people use it,” they criticize the industry for rushing AI models to market without sufficient safeguards. Their concerns echo those of other leading AI researchers, including past Turing Award winners Geoffrey Hinton and Yoshua Bengio, who have also warned about the risks of unchecked AI development. With OpenAI shifting toward a for-profit model and major AI firms racing to deploy new technologies, the debate over responsible AI governance is more urgent than ever. #AI#AIGovernance#TuringAward#AISafety#ResponsibleAI

Venture Village Wall 🦄

@venturevillagewall · Post #4349 · 09.03.2025 г., 22:00

Weekly AI Digest: Key Developments 🔹 Anthropic raises $3.5B through incremental funding rounds. Read more 🔹 QwQ 32B launched, slightly trailing top performers. Details here 🔹 Wan 2.1 remains a top open-source model amid competition. Learn more 🔹 Hunyuan Image2Video: Tencent's response to Alibaba's offering. Explore here 🔹 SourceCraft introduces cloud-based team development as VM replacement. More info 🔹 Apple's Mac Studio handles demanding models and LLMs. Discover more 🔹 SpeechSense analyzes customer conversations using LLM technology. Details 🔹 RL wins Turing Award, recognized with a $1M prize. Full story 🔹 Bitcoin drops to $82,223; Ethereum to $1,998, with $243M in liquidations. Read market update. #AI#Crypto#VC#Anthropic#Bitcoin#Ethereum#Hunyuan#Tencent#AIModels#OpenSource#MacStudio#SpeechSense#Investments#Funding#TuringAward#Liquidations#QwQ#SourceCraft#SmartTech