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

Резултати

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

Пребарај: #tradesecrets

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

@ai_and_law · Post #259 · 12.03.2024 г., 08:04

Former Google Employee Charged with Stealing AI Trade Secrets Greetings everyone! Linwei Ding, a former Google employee, has been charged with stealing confidential AI trade secrets. He allegedly uploaded over 500 documents to his personal Google Drive account and shared them with Chinese companies. Ding is accused of leveraging stolen data to secure employment with Chinese AI firms and launch his own startup. The case underscores the importance of safeguarding sensitive technology from unauthorized access and theft. #AI#TradeSecrets

Торговый переговорщик

@tradenegotiator · Post #150 · 17.01.2023 г., 12:54

Технологическое противостояние США и Китая продолжается Джо Байден подписал закон о защите американской интеллектуальной собственности (Protecting American Intellectual Property Act of 2022), который требует предоставления периодических отчетов Конгрессу с указанием любых иностранных лиц, уличенных в краже американской коммерческой тайны (trade secrets). В отношении таких иностранных лиц закон предусматривает введение санкций на основе «меню», в котором помимо прочего есть опция введения блокирующих санкций. В законе нет отсылок к каким-то конкретным странам, но заявление для прессы сенатора Криса Ван Холлена, спонсора Закона, ясно указывает на то, что Китай является основной мишенью новых мер. #ИИ#законСША#Китай#санкции#tradesecrets

AI & Law

@ai_and_law · Post #783 · 12.03.2026 г., 07:04

🇺🇸Court Allows Enforcement of California AI Training Data Disclosure Law A US federal court has denied a request by Elon Musk’s AI company xAI to block enforcement of California Assembly Bill 2013. The law requires AI developers whose models are accessible in California to publicly disclose key information about training datasets, including dataset sources, collection timelines, whether collection is ongoing, and whether datasets contain copyrighted, trademarked, patented, or personal data. Companies must also indicate whether training data was licensed or purchased and the extent of synthetic data used. xAI argued the law would force disclosure of trade secrets, including dataset sources, dataset sizes, and data-cleaning methods. According to the company, such transparency could allow competitors to infer what datasets it uses and replicate its approach. The company warned that compliance could be “economically devastating” and reduce the value of its proprietary data practices. However, US District Judge Jesus Bernal ruled that xAI failed to demonstrate that the law requires disclosure of protected trade secrets. The court found the company’s claims too general and based largely on hypotheticals. The motion for a preliminary injunction was denied, allowing the law—which took effect in January—to remain in force while the lawsuit continues. #AIRegulation#AITransparency#TrainingData#TradeSecrets#AIAct#AIGovernance#TechLaw